[jhbuild/desrt/master: 3/8] sysdeps: add two new modes



commit 7c74ab4740fcf36185c9d12b8a847a5ac3502640
Author: Ryan Lortie <desrt desrt ca>
Date:   Sat Dec 13 19:20:32 2014 -0500

    sysdeps: add two new modes
    
    Add two modes to 'jhbuild sysdeps' to dump a machine-readable list of:
    
     - all system depends that need to be installed
    
     - all system depends (regardless of if they are installed or not)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741496

 jhbuild/commands/sysdeps.py |   53 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)
---
diff --git a/jhbuild/commands/sysdeps.py b/jhbuild/commands/sysdeps.py
index b59d780..c54407e 100644
--- a/jhbuild/commands/sysdeps.py
+++ b/jhbuild/commands/sysdeps.py
@@ -26,6 +26,8 @@ from jhbuild.errors import FatalError
 from jhbuild.commands import Command, register_command
 from jhbuild.commands.base import cmd_build
 from jhbuild.utils.systeminstall import SystemInstall
+from jhbuild.modtypes.systemmodule import SystemModule
+from jhbuild.versioncontrol.tarball import TarballBranch
 from jhbuild.utils import cmds
 
 class cmd_sysdeps(cmd_build):
@@ -35,6 +37,12 @@ class cmd_sysdeps(cmd_build):
 
     def __init__(self):
         Command.__init__(self, [
+            make_option('--dump',
+                        action='store_true', default = False,
+                        help=_('Machine readable list of missing sysdeps')),
+            make_option('--dump-all',
+                        action='store_true', default = False,
+                        help=_('Machine readable list of all sysdeps')),
             make_option('--install',
                         action='store_true', default = False,
                         help=_('Install pkg-config modules via system'))])
@@ -61,11 +69,56 @@ class cmd_sysdeps(cmd_build):
         module_set = jhbuild.moduleset.load(config)
         modules = args or config.modules
         module_list = module_set.get_full_module_list(modules, config.skip)
+
+        if options.dump_all:
+            for module in module_list:
+                if (isinstance(module, SystemModule) or isinstance(module.branch, TarballBranch) and
+                                                        module.pkg_config is not None):
+                    if module.pkg_config is not None:
+                        print 'pkgconfig:{0}'.format(module.pkg_config[:-3]) # remove .pc
+
+                    if module.systemdependencies is not None:
+                        for dep_type, value in module.systemdependencies:
+                            print '{0}:{1}'.format(dep_type, value)
+
+            return
+
         module_state = module_set.get_module_state(module_list)
 
         have_new_enough = False
         have_too_old = False
 
+        if options.dump:
+            for module, (req_version, installed_version, new_enough, systemmodule) in 
module_state.iteritems():
+                if new_enough:
+                    continue
+
+                if installed_version is not None and systemmodule:
+                    # it's already installed but it's too old and we
+                    # don't know how to build a new one for ourselves
+                    have_too_old = True
+
+                # request installation in two cases:
+                #   1) we don't know how to build it
+                #   2) we don't want to build it ourselves
+                #
+                # partial_build is on by default so this check will only
+                # fail if someone explicitly turned it off
+                if systemmodule or config.partial_build:
+                    assert (module.pkg_config or module.systemdependencies)
+
+                    if module.pkg_config is not None:
+                        print 'pkgconfig:{0}'.format(module.pkg_config[:-3]) # remove .pc
+
+                    if module.systemdependencies is not None:
+                        for dep_type, value in module.systemdependencies:
+                            print '{0}:{1}'.format(dep_type, value)
+
+            if have_too_old:
+                return 1
+
+            return
+
         print _('System installed packages which are new enough:')
         for module,(req_version, installed_version, new_enough, systemmodule) in module_state.iteritems():
             if (installed_version is not None) and new_enough and (config.partial_build or systemmodule):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]