[jhbuild] Automatially create not found modules (on buildone)
- From: Frederic Peters <fpeters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild] Automatially create not found modules (on buildone)
- Date: Sun, 18 Jul 2010 14:38:48 +0000 (UTC)
commit 400976d05104f911234c4a400f9117be33a0937a
Author: Frédéric Péters <fpeters 0d be>
Date: Sun Jul 18 16:35:52 2010 +0200
Automatially create not found modules (on buildone)
Using the buildone command only, if a module is not found, a stub
autotools module will automatically be created, hooked to the
default repository.
jhbuild/commands/base.py | 18 ++++++++++++++----
jhbuild/moduleset.py | 14 +++++++++++---
2 files changed, 25 insertions(+), 7 deletions(-)
---
diff --git a/jhbuild/commands/base.py b/jhbuild/commands/base.py
index 86f7b90..2338d98 100644
--- a/jhbuild/commands/base.py
+++ b/jhbuild/commands/base.py
@@ -344,10 +344,20 @@ class cmd_buildone(Command):
check_bootstrap_updateness(config)
module_set = jhbuild.moduleset.load(config)
- try:
- module_list = [module_set.get_module(modname, ignore_case = True) for modname in args]
- except KeyError, e:
- raise FatalError(_("A module called '%s' could not be found.") % e)
+ module_list = []
+ for modname in args:
+ try:
+ module = module_set.get_module(modname, ignore_case=True)
+ except KeyError, e:
+ default_repo = jhbuild.moduleset.get_default_repo()
+ if not default_repo:
+ continue
+ from jhbuild.modtypes.autotools import AutogenModule
+ module = AutogenModule(modname, default_repo.branch(modname))
+ module.config = config
+ logging.info(_('module "%s" does not exist, created automatically using repository "%s"') % \
+ (modname, default_repo.name))
+ module_list.append(module)
if not module_list:
self.parser.error(_('This command requires a module parameter.'))
diff --git a/jhbuild/moduleset.py b/jhbuild/moduleset.py
index fd05ed0..f07c7c6 100644
--- a/jhbuild/moduleset.py
+++ b/jhbuild/moduleset.py
@@ -37,7 +37,11 @@ from jhbuild.utils import httpcache
from jhbuild.utils.cmds import get_output
from jhbuild.modtypes.testmodule import TestModule
-__all__ = ['load', 'load_tests']
+__all__ = ['load', 'load_tests', 'get_default_repo']
+
+_default_repo = None
+def get_default_repo():
+ return _default_repo
class ModuleSet:
def __init__(self, config = None):
@@ -57,8 +61,7 @@ class ModuleSet:
logging.info(_('fixed case of module \'%(orig)s\' to \'%(new)s\'') % {
'orig': module_name, 'new': module})
return self.modules[module]
- print "Couldn't find the specified module: %s" % module_name
- sys.exit(2)
+ raise KeyError(module_name)
def get_module_list(self, seed, skip=[], tags=[], ignore_cycles=False,
ignore_suggests=False, include_optional_modules=False,
@@ -408,6 +411,11 @@ def _parse_module_set(config, uri):
module.config = config
moduleset.add(module)
+ # keep default repository around, used when creating automatic modules
+ global _default_repo
+ if default_repo:
+ _default_repo = repositories[default_repo]
+
return moduleset
def warn_local_modulesets(config):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]