]> git.ipfire.org Git - pbs.git/commitdiff
jobs: Use installcheck() to perform the dependency check
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 May 2023 13:56:20 +0000 (13:56 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 May 2023 13:56:20 +0000 (13:56 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/jobs.py

index 4190ede7a1e388132e38d40a95f1cc649817aefc..bad681fd50abde041a725760e2e357519c0af3d0 100644 (file)
@@ -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)