[jhbuild] systeminstall: Work around broken pkg-config installations



commit 9fb817ca2eac0a922e7866f3d64706f7339f21f7
Author: Colin Walters <walters verbum org>
Date:   Wed Aug 31 09:45:35 2011 -0400

    systeminstall: Work around broken pkg-config installations
    
    On a stock Ubuntu Lucid install, pkg-config is broken in that
    xml2po.pc is missing, which causes pkg-config --modversion <list of pkgs>
    to fail.
    
    Work around this by forking for each package =(
    
    https://bugzilla.gnome.org/show_bug.cgi?id=654701

 jhbuild/utils/systeminstall.py |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/jhbuild/utils/systeminstall.py b/jhbuild/utils/systeminstall.py
index 12f1440..3d1d8ff 100644
--- a/jhbuild/utils/systeminstall.py
+++ b/jhbuild/utils/systeminstall.py
@@ -35,14 +35,18 @@ def get_installed_pkgconfigs(config):
     for line in StringIO(stdout):
         pkg, rest = line.split(None, 1)
         pkgs.append(pkg)
-    args = ['pkg-config', '--modversion']
-    args.extend(pkgs)
-    proc = subprocess.Popen(args, stdout=subprocess.PIPE, env=config.get_original_environment(), close_fds=True)
-    stdout = proc.communicate()[0]
-    proc.wait()
+    # We have to rather inefficiently repeatedly fork to work around
+    # broken pkg-config installations - if any package has a missing
+    # dependency pkg-config will fail entirely.
     pkgversions = {}
-    for pkg,verline in zip(pkgs, StringIO(stdout)):
-        pkgversions[pkg] = verline.strip()
+    for pkg in pkgs:
+        args = ['pkg-config', '--modversion']
+        args.append(pkg)
+        proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=open('/dev/null'),
+                                close_fds=True, env=config.get_original_environment())
+        stdout = proc.communicate()[0]
+        proc.wait()
+        pkgversions[pkg] = stdout.strip()
     return pkgversions
 
 class SystemInstall(object):



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