浏览代码

fix check for detection of installed packages on Debian

dpkg-query returns an exit code of 1 when a package is not installed,
which causes an error in the build script. Now, the full list of
packages is read and the desired packages are looked up in it which
should fix #1707
Ashish Kulkarni 11 年之前
父节点
当前提交
b54f3aa700
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      scripts/build.py

+ 3 - 2
scripts/build.py

@@ -399,10 +399,11 @@ def check_running_on_debian():
 
 PACKAGE_NAME = re.compile(r'ii\s+(.+?)\s+.*')
 def install_packages(*names):
-    lines = get_output('dpkg-query', '--list', *names).split('\n')
+    lines = get_output('dpkg-query', '--list').split('\n')
     avail = [PACKAGE_NAME.match(line).group(1) for line in lines if PACKAGE_NAME.match(line)]
+    inst  = [name for name in names if name in avail]
 
-    if len(avail) != len(names):
+    if len(inst) != len(names):
         shell('apt-get update')
         shell('apt-get install --assume-yes %s' % (' '.join(names)))