[jhbuild] sysdeps: add yum backend



commit b7a5b7fdd77af93c059f97dddf24b65b55d3b7f4
Author: Ray Strode <rstrode redhat com>
Date:   Thu May 10 15:01:18 2012 -0400

    sysdeps: add yum backend
    
    PackageKit isn't available in some situations
    (buildroots).
    
    This commit adds a yum backend for Fedora mock
    buildroots.

 jhbuild/utils/systeminstall.py |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/jhbuild/utils/systeminstall.py b/jhbuild/utils/systeminstall.py
index bdebe55..4718dea 100755
--- a/jhbuild/utils/systeminstall.py
+++ b/jhbuild/utils/systeminstall.py
@@ -127,6 +127,30 @@ class PKSystemInstall(SystemInstall):
     def detect(cls):
         return cmds.has_command('pkcon')
 
+class YumSystemInstall(SystemInstall):
+    def __init__(self):
+        SystemInstall.__init__(self)
+
+    def install(self, pkgconfig_ids):
+        logging.info(_('Using yum to install packages.  Please wait.'))
+
+        native_packages = []
+        for pkgconfig in pkgconfig_ids:
+            native_packages.append('pkgconfig(' + pkgconfig + ')')
+
+        if native_packages:
+            logging.info(_('Installing: %(pkgs)s') % {'pkgs': ' '.join(native_packages)})
+            args = self._root_command_prefix_args + ['yum', '-y', 'install']
+            args.extend(native_packages)
+            subprocess.check_call(args)
+        else:
+            logging.info(_('Nothing to install'))
+
+    @classmethod
+    def detect(cls):
+        return cmds.has_command('yum')
+
+
 class AptSystemInstall(SystemInstall):
     def __init__(self):
         SystemInstall.__init__(self)
@@ -175,7 +199,7 @@ class AptSystemInstall(SystemInstall):
         return cmds.has_command('apt-file')
 
 # Ordered from best to worst
-_classes = [AptSystemInstall, PKSystemInstall]
+_classes = [AptSystemInstall, PKSystemInstall, YumSystemInstall]
 
 if __name__ == '__main__':
     logging.basicConfig(level=logging.INFO)



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