[jhbuild] Add --exit-on-error option
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild] Add --exit-on-error option
- Date: Tue, 14 Jul 2015 16:12:16 +0000 (UTC)
commit f524fbe120ebb4b7d209ce0d035cd3d2e4a66bd4
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Fri Jul 10 13:55:46 2015 -0500
Add --exit-on-error option
This option tells jhbuild to stop building immediately if a module
fails.
Based on a patch by Carlos Lopez
https://bugzilla.gnome.org/show_bug.cgi?id=752218
doc/C/index.docbook | 23 +++++++++++++++++++++++
jhbuild/config.py | 2 +-
jhbuild/defaults.jhbuildrc | 1 +
jhbuild/frontends/buildscript.py | 4 ++++
jhbuild/main.py | 4 ++++
5 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/doc/C/index.docbook b/doc/C/index.docbook
index 7414d06..0fbcb6b 100644
--- a/doc/C/index.docbook
+++ b/doc/C/index.docbook
@@ -691,6 +691,16 @@ jhbuildbot_password = 'password'
</varlistentry>
<varlistentry>
<term>
+ <option>--exit-on-error</option>
+ </term>
+ <listitem>
+ <simpara>Exit immediately if a module fails to build. This option is
+ primarily useful in noninteractive mode, in order to ensure jhbuild
+ does not continue to build any additional modules.</simpara>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
<option>--conditions</option>
</term>
<listitem>
@@ -1773,6 +1783,19 @@ Optional packages: (JHBuild will build the missing packages)
supported by Git and Bazaar repositories.</simpara>
</listitem>
</varlistentry>
+ <varlistentry id="exit-on-error">
+ <term>
+ <varname>exit_on_error</varname>
+ </term>
+ <listitem>
+ <simpara>A boolean value specifying whether to exit immediately when a
+ module fails to build. This is primarily useful in noninteractive
+ mode, in order to prevent additional modules from building after
+ one fails. Setting this value to <constant>True</constant> is
+ equivalent to passing the <option>--exit-on-error</option> option.
+ Defaults to <constant>False</constant>.</simpara>
+ </listitem>
+ </varlistentry>
<varlistentry id="cfg-extra-prefixes">
<term>
<varname>extra_prefixes</varname>
diff --git a/jhbuild/config.py b/jhbuild/config.py
index a481f6e..cf5d3d4 100644
--- a/jhbuild/config.py
+++ b/jhbuild/config.py
@@ -66,7 +66,7 @@ _known_keys = [ 'moduleset', 'modules', 'skip', 'tags', 'prefix',
'module_static_analyzer', 'static_analyzer_template',
'static_analyzer_outputdir', 'check_sysdeps', 'system_prefix',
'help_website', 'conditions', 'extra_prefixes',
- 'disable_Werror', 'xdg_cache_home',
+ 'disable_Werror', 'xdg_cache_home', 'exit_on_error'
]
env_prepends = {}
diff --git a/jhbuild/defaults.jhbuildrc b/jhbuild/defaults.jhbuildrc
index 4b9a390..8bb3c67 100644
--- a/jhbuild/defaults.jhbuildrc
+++ b/jhbuild/defaults.jhbuildrc
@@ -119,6 +119,7 @@ build_targets = ['install','test']
makecheck_advisory = False # whether to pass over 'make check' failures
interact = True # whether to interact with the user.
+exit_on_error = False # whether to immediately exit when a build fails, most useful for noninteractive mode
quiet_mode = False # whether to display running commands output
progress_bar = True # whether to display a progress bar when running in quiet mode
diff --git a/jhbuild/frontends/buildscript.py b/jhbuild/frontends/buildscript.py
index 3d0c20a..afc4603 100644
--- a/jhbuild/frontends/buildscript.py
+++ b/jhbuild/frontends/buildscript.py
@@ -21,6 +21,7 @@
import os
import logging
import subprocess
+import sys
from jhbuild.utils import trigger
from jhbuild.utils import cmds
@@ -172,6 +173,9 @@ class BuildScript:
self._end_phase_internal(module.name, phase, error)
if error:
+ if self.config.exit_on_error:
+ sys.exit(1)
+
try:
nextphase = build_phases[num_phase+1]
except IndexError:
diff --git a/jhbuild/main.py b/jhbuild/main.py
index 76712f7..da222f5 100644
--- a/jhbuild/main.py
+++ b/jhbuild/main.py
@@ -124,6 +124,9 @@ def main(args):
parser.add_option('--no-interact', action='store_true',
dest='nointeract', default=False,
help=_('do not prompt for input'))
+ parser.add_option('--exit-on-error', action='store_true',
+ dest='exit_on_error', default=False,
+ help=_('exit immediately when the build fails'))
parser.add_option('--conditions', action='append',
dest='conditions', default=[],
help=_('modify the condition set'))
@@ -138,6 +141,7 @@ def main(args):
if options.moduleset: config.moduleset = options.moduleset
if options.nointeract: config.interact = False
+ if options.exit_on_error: config.exit_on_error = True
if not args or args[0][0] == '-':
command = 'build' # default to cvs update + compile
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]