From: Michael Tremer Date: Mon, 8 May 2023 13:56:20 +0000 (+0000) Subject: jobs: Use installcheck() to perform the dependency check X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c79bd046dbaa18b3bb18feaf7d7ede515cad03ee;p=pbs.git jobs: Use installcheck() to perform the dependency check Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/jobs.py b/src/buildservice/jobs.py index 4190ede7..bad681fd 100644 --- a/src/buildservice/jobs.py +++ b/src/buildservice/jobs.py @@ -823,7 +823,7 @@ class Job(base.DataObject): """ Perform dependency check """ - log.info("Performing dependency check for %s" % self) + log.info("Performing dependency check for %s (%s)" % (self, self.uuid)) with self.db.transaction(): return await asyncio.to_thread(self._depcheck) @@ -831,17 +831,30 @@ class Job(base.DataObject): def _depcheck(self): # Create a Pakfire instance with self.pakfire() as p: - # Try to install the source package + # Fetch the commandline repository + repo = p.get_repo("@commandline") + + # Open the archive + archive = p.open(self.pkg.path) + + # Fetch the package + package = archive.get_package(repo) + + # Perform the installcheck try: - p.install([self.pkg.path], dryrun=True) + package.installcheck() - # XXX Pakfire should throw a better exception - except Exception as e: + # Store any dependency errors + except DependencyError as e: self._set_attribute("depcheck_succeeded", False) # Store the message self._set_attribute("message", "%s" % e) + # Raise any other exceptions + except Exception as e: + raise e + # Everything OK else: self._set_attribute("depcheck_succeeded", True)