[jhbuild] add new command 'jhbuild postinst'
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild] add new command 'jhbuild postinst'
- Date: Tue, 6 Jan 2015 19:50:57 +0000 (UTC)
commit e5dc774107d7eb2108e6ecaebfb14379de0d86ca
Author: Ryan Lortie <desrt desrt ca>
Date: Wed Mar 19 20:07:21 2014 -0400
add new command 'jhbuild postinst'
This will run triggers as appropriate for the modules listed as
arguments to the command.
If no arguments are given, all available triggers are run.
https://bugzilla.gnome.org/show_bug.cgi?id=726755
jhbuild/commands/base.py | 18 ++++++++++++++++++
jhbuild/frontends/buildscript.py | 21 +++++++++++++++------
2 files changed, 33 insertions(+), 6 deletions(-)
---
diff --git a/jhbuild/commands/base.py b/jhbuild/commands/base.py
index 33f9720..f66ac14 100644
--- a/jhbuild/commands/base.py
+++ b/jhbuild/commands/base.py
@@ -519,3 +519,21 @@ class cmd_dot(Command):
module_set.write_dot(modules, **kwargs)
register_command(cmd_dot)
+
+class cmd_postinst(Command):
+ doc = N_('Run post-install triggers for named modules (or all)')
+
+ name = 'postinst'
+ usage_args = N_('[ modules ... ]')
+
+ def __init__(self):
+ Command.__init__(self, [])
+
+ def run(self, config, options, args, help=None):
+ config.set_from_cmdline_options(options)
+
+ module_set = jhbuild.moduleset.load(config)
+ build = jhbuild.frontends.get_buildscript(config, args, module_set=module_set)
+ return build.run_triggers(args)
+
+register_command(cmd_postinst)
diff --git a/jhbuild/frontends/buildscript.py b/jhbuild/frontends/buildscript.py
index a0c6013..3d0c20a 100644
--- a/jhbuild/frontends/buildscript.py
+++ b/jhbuild/frontends/buildscript.py
@@ -219,7 +219,7 @@ class BuildScript:
return 1
return 0
- def run_triggers(self, module_name):
+ def run_triggers(self, modules):
"""See triggers/README."""
assert 'JHBUILD_PREFIX' in os.environ
if os.environ.get('JHBUILD_TRIGGERS') is not None:
@@ -229,11 +229,15 @@ class BuildScript:
else:
trigger_path = os.path.join(SRCDIR, 'triggers')
all_triggers = trigger.load_all(trigger_path)
- triggers_to_run = []
- for trig in all_triggers:
+
+ triggers_to_run = set()
+
+ for module_name in modules:
# Skip if somehow the module isn't really installed
if self.moduleset.packagedb.installdate(module_name) is None:
+ logging.warning(_('Ignoring uninstalled package: %s') % (module_name, ))
continue
+
pkg = self.moduleset.packagedb.get(module_name)
assert pkg is not None
@@ -242,8 +246,13 @@ class BuildScript:
if pkg.manifest is None:
continue
- if trig.matches(pkg.manifest):
- triggers_to_run.append(trig)
+ for trig in all_triggers:
+ if trig.matches(pkg.manifest):
+ triggers_to_run.add(trig)
+
+ if not modules:
+ triggers_to_run = set(all_triggers)
+
for trig in triggers_to_run:
logging.info(_('Running post-installation trigger script: %r') % (trig.name, ))
try:
@@ -314,7 +323,7 @@ class BuildScript:
pass
def _end_phase_internal(self, module, phase, error):
if error is None and phase == 'install':
- self.run_triggers(module)
+ self.run_triggers([module])
self.end_phase(module, phase, error)
def message(self, msg, module_num=-1):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]