]> git.ipfire.org Git - pbs.git/commitdiff
sources: Capture & store Pakfire log on dist()
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 26 Aug 2023 11:14:03 +0000 (11:14 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 26 Aug 2023 11:14:03 +0000 (11:14 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/sources.py
src/database.sql

index c07d0c39f8bca0dd6b776beddfe01329eaedd1fe..b31c59a4661e0f706869311ec48d0989fb9b0236 100644 (file)
@@ -9,6 +9,7 @@ import re
 import tempfile
 
 from . import base
+from . import config
 from . import misc
 
 from .constants import *
@@ -802,6 +803,9 @@ class Job(base.DataObject):
                """
                upload = None
 
+               # Collect the log from Pakfire
+               logger = config.PakfireLogger()
+
                try:
                        # Create a new temporary directory and check out the requested revision
                        async with self.backend.tempdir() as path:
@@ -814,7 +818,7 @@ class Job(base.DataObject):
                                makefile = os.path.join(path, "%s/%s.nm" % (self.name, self.name))
 
                                # Launch a Pakfire instance with the repository configuration
-                               async with self.source.repo.pakfire() as p:
+                               async with self.source.repo.pakfire(logger=logger) as p:
                                        log.debug("Running dist for %s..." % makefile)
 
                                        # Run dist() in a separate thread
@@ -844,11 +848,14 @@ class Job(base.DataObject):
                        # Store the error
                        self._set_attribute("error", "%s" % e)
 
-               # Always delete the upload
+               # Always delete the upload & store the log
                finally:
                        if upload:
                                await upload.delete()
 
+                       # Store log
+                       self._set_attribute("log", "%s" % logger)
+
 
 class Git(object):
        """
index 0a8e2e5104e344d5e2dbda54be7b293b3aabee50..6a083d62ee7af895c4cb3d593165ce8df2c37ec0 100644 (file)
@@ -945,7 +945,8 @@ CREATE TABLE public.source_commit_jobs (
     name text NOT NULL,
     finished_at timestamp without time zone,
     success boolean,
-    error text
+    error text,
+    log text
 );