[jhbuild/external-deps: 92/93] Refactor as per discussion with fredp
- From: John Carr <johncarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [jhbuild/external-deps: 92/93] Refactor as per discussion with fredp
- Date: Sun, 7 Jun 2009 15:34:55 -0400 (EDT)
commit 6c18355919235c403ebede5c9f421ff34462b9cb
Author: John Carr <john carr unrouted co uk>
Date: Sun Jun 7 20:33:00 2009 +0100
Refactor as per discussion with fredp
---
jhbuild/commands/base.py | 11 +++--------
jhbuild/moduleset.py | 22 ++++++++++++++--------
2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/jhbuild/commands/base.py b/jhbuild/commands/base.py
index 8a7d470..65463a1 100644
--- a/jhbuild/commands/base.py
+++ b/jhbuild/commands/base.py
@@ -32,8 +32,6 @@ from jhbuild.commands import Command, register_command
from jhbuild.config import parse_relative_time
-from jhbuild.utils import systempackages
-
class cmd_update(Command):
doc = N_('Update all modules from version control')
@@ -61,12 +59,11 @@ class cmd_update(Command):
def run(self, config, options, args):
config.set_from_cmdline_options(options)
- pkgs = systempackages.get_system_packages()
module_set = jhbuild.moduleset.load(config)
module_list = module_set.get_module_list(args or config.modules,
config.skip, tags=config.tags,
ignore_suggests=config.ignore_suggests,
- should_skip=pkgs.satisfied)
+ reuse_system_packages=True)
# remove modules up to startat
if options.startat:
while module_list and module_list[0].name != options.startat:
@@ -271,14 +268,13 @@ class cmd_build(Command):
if not config.quiet_mode:
check_bootstrap_updateness(config)
- pkgs = systempackages.get_system_packages()
module_set = jhbuild.moduleset.load(config)
modules = args or config.modules
module_list = module_set.get_module_list(modules,
config.skip, tags = config.tags,
include_optional_modules=options.build_optional_modules,
ignore_suggests=config.ignore_suggests,
- should_skip=pkgs.satisfied)
+ reuse_system_packages=True)
# remove modules up to startat
if options.startat:
while module_list and module_list[0].name != options.startat:
@@ -459,7 +455,6 @@ class cmd_list(Command):
def run(self, config, options, args):
config.set_from_cmdline_options(options)
- pkgs = systempackages.get_system_packages()
module_set = jhbuild.moduleset.load(config)
if options.list_all_modules:
module_list = module_set.modules.values()
@@ -468,7 +463,7 @@ class cmd_list(Command):
config.skip, tags = config.tags,
include_optional_modules = options.list_optional_modules,
ignore_suggests=config.ignore_suggests,
- should_skip=pkgs.satisfied)
+ reuse_system_packages=True)
# remove modules up to startat
if options.startat:
diff --git a/jhbuild/moduleset.py b/jhbuild/moduleset.py
index 40d62d0..03c62b2 100644
--- a/jhbuild/moduleset.py
+++ b/jhbuild/moduleset.py
@@ -35,6 +35,7 @@ from jhbuild import modtypes
from jhbuild.versioncontrol import get_repo_type
from jhbuild.utils import httpcache
from jhbuild.utils.cmds import get_output
+from jhbuild.utils.systempackages import get_system_packages
__all__ = ['load', 'load_tests']
@@ -60,7 +61,7 @@ class ModuleSet:
def get_module_list(self, seed, skip=[], tags=[], ignore_cycles=False,
ignore_suggests=False, include_optional_modules=False,
- ignore_missing=False, should_skip=None):
+ ignore_missing=False, reuse_system_packages=False):
'''gets a list of module objects (in correct dependency order)
needed to build the modules in the seed list'''
@@ -122,12 +123,6 @@ class ModuleSet:
# no tag matched, mark module as processed
self._state[self.modules[modname]] = 'processed'
- if should_skip:
- for name, module in self.modules.iteritems():
- min_version = module.get_minimum_version(all_modules)
- if should_skip(module, min_version):
- self._state[module] = 'processed'
-
def order(modules, module, mode = 'dependencies'):
if self._state.get(module, 'clean') == 'processed':
# already seen
@@ -202,8 +197,19 @@ class ModuleSet:
ordered = self._ordered[:]
del self._ordered
del self._state
+
+ if reuse_system_packages:
+ pkgs = get_system_packages()
+ for module in ordered:
+ min_version = module.get_minimum_version(ordered)
+ if pkgs.satisfied(module, min_version):
+ skip.append(module.name)
+ return self.get_module_list(seed, skip=skip, tags=tags, ignore_cycles=ignore_cycles,
+ ignore_suggests=ignore_suggests, include_optional_modules=include_optional_modules,
+ ignore_missing=ignore_missing, reuse_system_packages=False)
+
return ordered
-
+
def get_full_module_list(self, skip=[], ignore_cycles=False):
return self.get_module_list(self.modules.keys(), skip=skip,
ignore_cycles=ignore_cycles, ignore_missing=True)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]