public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Magnus Granberg" <zorry@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/tinderbox-cluster:master commit in: buildbot_gentoo_ci/steps/, buildbot_gentoo_ci/config/
Date: Sun,  2 May 2021 15:24:42 +0000 (UTC)	[thread overview]
Message-ID: <1619969045.c5da0d10e98b62390d47b5b13d66a135706177ed.zorry@gentoo> (raw)

commit:     c5da0d10e98b62390d47b5b13d66a135706177ed
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sun May  2 15:24:05 2021 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sun May  2 15:24:05 2021 +0000
URL:        https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=c5da0d10

Add support for emerge --info

Signed-off-by: Magnus Granberg <zorry <AT> gentoo.org>

 buildbot_gentoo_ci/config/buildfactorys.py |  2 ++
 buildbot_gentoo_ci/steps/builders.py       | 44 +++++++++++++++++++++++++++++-
 buildbot_gentoo_ci/steps/logs.py           | 24 +++++++++++++++-
 3 files changed, 68 insertions(+), 2 deletions(-)

diff --git a/buildbot_gentoo_ci/config/buildfactorys.py b/buildbot_gentoo_ci/config/buildfactorys.py
index e08127b..417e385 100644
--- a/buildbot_gentoo_ci/config/buildfactorys.py
+++ b/buildbot_gentoo_ci/config/buildfactorys.py
@@ -177,6 +177,8 @@ def parse_build_log():
     f.addStep(logs.MakeIssue())
     # add sum log to buildbot log
     f.addStep(logs.setBuildbotLog())
+    # add emerge info to log and db
+    f.addStep(logs.setEmergeInfoLog())
     # set BuildStatus
     f.addStep(logs.setBuildStatus())
     # setup things for the irc bot

diff --git a/buildbot_gentoo_ci/steps/builders.py b/buildbot_gentoo_ci/steps/builders.py
index 50f924d..3a5de47 100644
--- a/buildbot_gentoo_ci/steps/builders.py
+++ b/buildbot_gentoo_ci/steps/builders.py
@@ -164,6 +164,17 @@ def PersOutputOfDepclean(rc, stdout, stderr):
         'depclean_output' : depclean_output
         }
 
+def PersOutputOfEmergeInfo(rc, stdout, stderr):
+    emerge_info_output = {}
+    emerge_info_output['rc'] = rc
+    emerge_info_list = []
+    for line in stdout.split('\n'):
+        emerge_info_list.append(line)
+    emerge_info_output['emerge_info'] = emerge_info_list
+    return {
+        'emerge_info_output' : emerge_info_output
+        }
+
 class TriggerRunBuildRequest(BuildStep):
     
     name = 'TriggerRunBuildRequest'
@@ -650,7 +661,8 @@ class CheckEmergeLogs(BuildStep):
                             'pkg_check_log_data' : self.getProperty("pkg_check_log_data"),
                             'repository_data' : self.getProperty('repository_data'),
                             'faild_cpv' : faild_cpv,
-                            'step' : self.step
+                            'step' : self.step,
+                            'emerge_info' : self.getProperty('emerge_info_output')['emerge_info']
                         }
                     ))
         if not self.step is None and self.aftersteps_list != []:
@@ -761,6 +773,35 @@ class CheckPkgCheckLogs(BuildStep):
         self.setProperty('pkg_check_log_data', None, 'pkg_check_log_data')
         return SUCCESS
 
+class RunEmergeInfo(BuildStep):
+
+    name = 'RunEmergeInfo'
+    description = 'Running'
+    descriptionDone = 'Ran'
+    haltOnFailure = True
+    flunkOnFailure = True
+
+    def __init__(self, **kwargs):
+        super().__init__(**kwargs)
+
+    @defer.inlineCallbacks
+    def run(self):
+        aftersteps_list = []
+        shell_commad_list = [
+                    'emerge',
+                    ]
+        shell_commad_list.append('--info')
+        aftersteps_list.append(
+                steps.SetPropertyFromCommandNewStyle(
+                        command=shell_commad_list,
+                        strip=True,
+                        extract_fn=PersOutputOfEmergeInfo,
+                        workdir='/',
+                        timeout=None
+                ))
+        yield self.build.addStepsAfterCurrentStep(aftersteps_list)
+        return SUCCESS
+
 class RunBuild(BuildStep):
 
     name = 'RunBuild'
@@ -780,6 +821,7 @@ class RunBuild(BuildStep):
             # trigger pars_build_log if we have any logs to check
             return SUCCESS
         aftersteps_list = []
+        aftersteps_list.append(RunEmergeInfo())
         aftersteps_list.append(RunEmerge(step='pre-build'))
         aftersteps_list.append(RunEmerge(step='build'))
         self.setProperty('depclean', False, 'depclean')

diff --git a/buildbot_gentoo_ci/steps/logs.py b/buildbot_gentoo_ci/steps/logs.py
index 0960b9b..3c0ef8d 100644
--- a/buildbot_gentoo_ci/steps/logs.py
+++ b/buildbot_gentoo_ci/steps/logs.py
@@ -252,7 +252,29 @@ class setBuildbotLog(BuildStep):
         # add line for line
         for line in self.getProperty('summary_log_list'):
             yield log.addStdout(line + '\n')
-        # add emerge info log
+        return SUCCESS
+
+class setEmergeInfoLog(BuildStep):
+
+    name = 'setEmergeInfoLog'
+    description = 'Running'
+    descriptionDone = 'Ran'
+    descriptionSuffix = None
+    haltOnFailure = False
+    flunkOnFailure = True
+    warnOnWarnings = True
+
+    def __init__(self, **kwargs):
+        super().__init__(**kwargs)
+
+    @defer.inlineCallbacks
+    def run(self):
+        #setup the log
+        log = yield self.addLog('emerge_info')
+        #FIXME: add emerge info to db
+        # add line for line
+        for line in self.getProperty('emerge_info'):
+            yield log.addStdout(line + '\n')
         return SUCCESS
 
 class setBuildStatus(BuildStep):


             reply	other threads:[~2021-05-02 15:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-02 15:24 Magnus Granberg [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-11-09 21:05 [gentoo-commits] proj/tinderbox-cluster:master commit in: buildbot_gentoo_ci/steps/, buildbot_gentoo_ci/config/ Magnus Granberg
2022-09-01 14:57 Magnus Granberg
2022-05-28 14:55 Magnus Granberg
2021-12-24  0:33 Magnus Granberg
2021-10-07  9:17 Magnus Granberg
2021-04-04 20:30 Magnus Granberg
2021-04-04 20:30 Magnus Granberg
2021-03-24 23:15 Magnus Granberg
2021-03-18 23:18 Magnus Granberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1619969045.c5da0d10e98b62390d47b5b13d66a135706177ed.zorry@gentoo \
    --to=zorry@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox