[jhbuild] Trigger output to respect quiet_mode and tinderbox (GNOME bug 655340)
- From: Craig Keogh <cskeogh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild] Trigger output to respect quiet_mode and tinderbox (GNOME bug 655340)
- Date: Sat, 3 Sep 2011 12:02:58 +0000 (UTC)
commit ff0fd7e50f844a7bc2be57432085697d7b7aa4ef
Author: Craig Keogh <cskeogh adam com au>
Date: Wed Aug 24 22:09:32 2011 +0930
Trigger output to respect quiet_mode and tinderbox (GNOME bug 655340)
If trigger returns a nonzero return code an error is logged and the
build continues.
Execute subprocesses via buildscript so we respect frontend handling.
Currently frontends do logging etc. for subprocesses; reuse the
buildscript.execute() so that for e.g. tinderbox we respect quiet_mode.
jhbuild/frontends/buildscript.py | 12 +++++++++++-
jhbuild/utils/trigger.py | 7 +++----
2 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/jhbuild/frontends/buildscript.py b/jhbuild/frontends/buildscript.py
index 8e87470..d025be4 100644
--- a/jhbuild/frontends/buildscript.py
+++ b/jhbuild/frontends/buildscript.py
@@ -214,6 +214,7 @@ class BuildScript:
def run_triggers(self, module_name):
"""See triggers/README."""
+ assert 'JHBUILD_PREFIX' in os.environ
if PKGDATADIR is not None:
trigger_path = os.path.join(PKGDATADIR, 'triggers')
else:
@@ -235,7 +236,16 @@ class BuildScript:
triggers_to_run.append(trig)
for trig in triggers_to_run:
logging.info(_('Running post-installation trigger script: %r') % (trig.name, ))
- trig.run()
+ try:
+ self.execute(trig.command())
+ except CommandError, err:
+ if isinstance(trig.command(), (str, unicode)):
+ displayed_command = trig.command()
+ else:
+ displayed_command = ' '.join(trig.command())
+ logging.error(_('%(command)s returned with an error code '
+ '(%(rc)s)') % {'command' : displayed_command,
+ 'rc' : err.returncode})
def get_build_phases(self, module, targets=None):
'''returns the list of required phases'''
diff --git a/jhbuild/utils/trigger.py b/jhbuild/utils/trigger.py
index ec1f1a9..669656f 100644
--- a/jhbuild/utils/trigger.py
+++ b/jhbuild/utils/trigger.py
@@ -72,10 +72,9 @@ should be run."""
return True
return False
- def run(self):
- """Synchronously execute this trigger script."""
- assert 'JHBUILD_PREFIX' in os.environ
- subprocess.check_call(['/bin/sh', self._file], stdin=open('/dev/null'))
+ def command(self):
+ """Returns the command required to execute the trigger script."""
+ return ['/bin/sh', self._file]
def load_all(dirpath):
result = []
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]