From: Michael Tremer Date: Sat, 26 Aug 2023 11:14:03 +0000 (+0000) Subject: sources: Capture & store Pakfire log on dist() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9ee5dce3ac7da08145ec4109faf1209b2315b9d1;p=pbs.git sources: Capture & store Pakfire log on dist() Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/sources.py b/src/buildservice/sources.py index c07d0c39..b31c59a4 100644 --- a/src/buildservice/sources.py +++ b/src/buildservice/sources.py @@ -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): """ diff --git a/src/database.sql b/src/database.sql index 0a8e2e51..6a083d62 100644 --- a/src/database.sql +++ b/src/database.sql @@ -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 );