[jhbuild/desrt/master: 11/13] deps stuff
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild/desrt/master: 11/13] deps stuff
- Date: Tue, 17 Feb 2015 20:44:05 +0000 (UTC)
commit 7e70b073a99b9d00ea635cc78d6aebe033484c3c
Author: Ryan Lortie <desrt desrt ca>
Date: Mon Jan 26 10:24:14 2015 +0000
deps stuff
jhbuild/commands/base.py | 10 +++++++-
jhbuild/moduleset.py | 53 ++++++++++++++++++++-------------------------
2 files changed, 33 insertions(+), 30 deletions(-)
---
diff --git a/jhbuild/commands/base.py b/jhbuild/commands/base.py
index df745f7..cb771eb 100644
--- a/jhbuild/commands/base.py
+++ b/jhbuild/commands/base.py
@@ -424,6 +424,9 @@ class cmd_list(Command):
make_option('-r', '--show-revision',
action='store_true', dest='show_rev', default=False,
help=_('show which revision will be built')),
+ make_option('-d','--show-depends',
+ action='store_true', dest='show_depends', default=False,
+ help=_('for each module, list its direct dependencies')),
make_option('-s', '--skip', metavar='MODULES',
action='append', dest='skip', default=[],
help=_('treat the given modules as up to date')),
@@ -441,7 +444,7 @@ class cmd_list(Command):
help=_('also list soft-dependencies that could be skipped')),
make_option('-a', '--all-modules',
action='store_true', dest='list_all_modules', default=False,
- help=_('list all modules, not only those that would be built')),
+ help=_('list all modules, not only those that would be built'))
])
def run(self, config, options, args, help=None):
@@ -450,6 +453,9 @@ class cmd_list(Command):
if options.startat and options.list_all_modules:
raise UsageError(_('Conflicting options specified (\'--start-at\' and \'--all-modules\')'))
+ if options.show_rev and options.show_depends:
+ raise UsageError(_('Conflicting options specified (\'--show-rev\' and \'--show-depends\')'))
+
if options.list_all_modules:
module_list = module_set.modules.values()
else:
@@ -469,6 +475,8 @@ class cmd_list(Command):
uprint('%s (%s)' % (mod.name, rev))
else:
uprint(mod.name)
+ elif options.show_depends:
+ uprint(' '.join([mod.name] + mod.get_mixed_deps()))
else:
uprint(mod.name)
diff --git a/jhbuild/moduleset.py b/jhbuild/moduleset.py
index f74ff2e..520c2fa 100644
--- a/jhbuild/moduleset.py
+++ b/jhbuild/moduleset.py
@@ -98,14 +98,14 @@ class ModuleSet:
raise KeyError(module_name)
def get_module_list(self, module_names, skip=[], tags=[], include_suggests=None, include_afters=None):
- module_list = self.get_full_module_list(module_names, skip, include_suggests, include_afters)
- module_list = self.remove_system_modules(module_list)
+ module_list = self.get_full_module_list(module_names, skip, include_suggests, include_afters,
+ exclude_system=True)
module_list = self.remove_tag_modules(module_list, tags)
return module_list
def get_full_module_list(self, module_names='all', skip=[],
include_suggests=None, include_afters=None,
- warn_about_circular_dependencies=True):
+ exclude_system=False, warn_about_circular_dependencies=True):
def add_module(to_build, name, seen = []):
''' Recursive depth-first search of the dependency tree. Creates
@@ -145,6 +145,19 @@ class ModuleSet:
return False
+ # exclude system modules, as appropriate
+ if not toplevel and exclude_system:
+ # exclude straight-up system modules
+ if isinstance(module, SystemModule):
+ return True
+
+ # also skip if the pkg-config is installed on the system (but see below:
+ # installed_pkgconfig will be empty if partial_build is disabled)
+ if module.pkg_config and isinstance(module.branch, TarballBranch):
+ installed_version = installed_pkgconfig.get(module.pkg_config[:-3]) # Strip off the .pc
+ if installed_version is not None and compare_version(installed_version,
module.branch.version):
+ return True
+
# construct a new list so that we can avoid unwinding
seen = seen + [module]
@@ -180,6 +193,14 @@ class ModuleSet:
if module_names == 'all':
module_names = self.modules.keys()
+ # Only populate this if we are in partial build mode. If
+ # partial_build is disabled then act as if there is nothing
+ # installed on the system.
+ if exclude_system and self.config.partial_build:
+ installed_pkgconfig = systeminstall.get_installed_pkgconfigs (self.config)
+ else:
+ installed_pkgconfig = dict()
+
to_build = []
for name in module_names:
if not add_module(to_build, name):
@@ -233,32 +254,6 @@ class ModuleSet:
new_enough, systemmodule)
return module_state
- def remove_system_modules(self, modules):
- if not self.config.partial_build:
- return [module for module in modules \
- if not isinstance(module, SystemModule)]
-
- return_list = []
-
- installed_pkgconfig = systeminstall.get_installed_pkgconfigs \
- (self.config)
-
- for module in modules:
- if isinstance(module, SystemModule):
- continue
- skip = False
- if module.pkg_config is not None and \
- isinstance(module.branch, TarballBranch):
- # Strip off the .pc
- module_pkg = module.pkg_config[:-3]
- required_version = module.branch.version
- if module_pkg in installed_pkgconfig:
- installed_version = installed_pkgconfig[module_pkg]
- skip = compare_version(installed_version, required_version)
- if not skip:
- return_list.append(module)
- return return_list
-
def remove_tag_modules(self, modules, tags):
if tags:
return_list = []
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]