[jhbuild/desrt/master: 12/13] Revert "deps stuff"



commit d65889fb7fc910bf7a67c17d0bf915186828dd57
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Jan 26 10:24:19 2015 +0000

    Revert "deps stuff"
    
    This reverts commit b8012940917e29224f99962bc65fd7eb75a1f794.

 jhbuild/commands/base.py |   10 +-------
 jhbuild/moduleset.py     |   53 +++++++++++++++++++++++++--------------------
 2 files changed, 30 insertions(+), 33 deletions(-)
---
diff --git a/jhbuild/commands/base.py b/jhbuild/commands/base.py
index cb771eb..df745f7 100644
--- a/jhbuild/commands/base.py
+++ b/jhbuild/commands/base.py
@@ -424,9 +424,6 @@ 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')),
@@ -444,7 +441,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):
@@ -453,9 +450,6 @@ 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:
@@ -475,8 +469,6 @@ 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 520c2fa..f74ff2e 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,
-                                                exclude_system=True)
+        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.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,
-                                exclude_system=False, warn_about_circular_dependencies=True):
+                                warn_about_circular_dependencies=True):
 
         def add_module(to_build, name, seen = []):
             ''' Recursive depth-first search of the dependency tree. Creates
@@ -145,19 +145,6 @@ 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]
 
@@ -193,14 +180,6 @@ 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):
@@ -254,6 +233,32 @@ 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]