[jhbuild/external-deps: 11/19] Crude aliases support



commit 8c944f81624f0737fcace191a71a5f6d41927b1d
Author: John Carr <john carr unrouted co uk>
Date:   Fri May 29 11:22:51 2009 +0100

    Crude aliases support
---
 jhbuild/commands/builddeps.py   |    2 +-
 jhbuild/utils/systempackages.py |   25 +++++++++++++++++++++++--
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/jhbuild/commands/builddeps.py b/jhbuild/commands/builddeps.py
index 69b4f0d..b3bb6b8 100644
--- a/jhbuild/commands/builddeps.py
+++ b/jhbuild/commands/builddeps.py
@@ -50,7 +50,7 @@ class cmd_builddeps(Command):
 
         for module in module_set.get_module_list(args or config.modules):
             if pkgs.satisfiable(module.name, module) and not pkgs.satisfied(module.name, module):
-                to_install.append(module.name)
+                to_install.append(pkgs.get_pkgname(module.name))
 
         if options.dryrun:
             print "Will install: %s" % " ".join(to_install)
diff --git a/jhbuild/utils/systempackages.py b/jhbuild/utils/systempackages.py
index 7d3d51b..47badf1 100644
--- a/jhbuild/utils/systempackages.py
+++ b/jhbuild/utils/systempackages.py
@@ -20,16 +20,34 @@
 # Authors:
 #   John Carr <john carr unrouted co uk>
 
+import os
 
 class SystemPackages(object):
 
+    def __init__(self):
+        self.aliases = {}
+
+        af = os.path.join(".", "aliases", self.aliasesfile)
+        tmp = {}
+        if os.path.exists(af+'.generated'):
+            execfile(af+'.generated', tmp)
+            self.aliases.update(tmp['aliases'])
+        if os.path.exists(af):
+            execfile(af, tmp)
+            self.aliases.update(tmp['aliases'])
+
+    def get_pkgname(self, name):
+        if name in self.aliases:
+            return self.aliases[name]
+        return name
+
     def satisfiable(self, name, module):
         """ Returns true if a module is satisfiable by installing a system package """
-        return self.is_available(name)
+        return self.is_available(self.get_pkgname(name))
 
     def satisfied(self, name, module):
         """ Returns true if module is satisfied by an already installed system package """
-        return self.is_installed(name)
+        return self.is_installed(self.get_pkgname(name))
 
     def is_installed(self, name, version=None):
         return False
@@ -54,7 +72,10 @@ class PackageKitPackages(SystemPackages):
 
 class DebianPackages(SystemPackages):
 
+    aliasesfile = "debian.aliases"
+
     def __init__(self):
+        super(DebianPackages, self).__init__()
         import apt
         self.apt_cache = apt.Cache()
 



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