installdb,cli/listinstalled: Thinko fix
The build host should be an empty string for old packages. "pisi li -b ''" now returns old packages, too.
This commit is contained in:
@@ -41,7 +41,7 @@ Usage: list-installed
|
||||
|
||||
group.add_option("-b", "--with-build-host",
|
||||
action="store",
|
||||
default="localhost",
|
||||
default=None,
|
||||
help=_("Only list the installed packages built "
|
||||
"by the given host"))
|
||||
group.add_option("-l", "--long", action="store_true",
|
||||
@@ -57,7 +57,7 @@ Usage: list-installed
|
||||
self.init(database = True, write = False)
|
||||
|
||||
build_host = ctx.get_option("with_build_host")
|
||||
if not build_host:
|
||||
if build_host is None:
|
||||
installed = self.installdb.list_installed()
|
||||
else:
|
||||
installed = self.installdb.list_installed_with_build_host(build_host)
|
||||
|
||||
+10
-4
@@ -118,13 +118,19 @@ class InstallDB(lazydb.LazyDB):
|
||||
return self.installed_db.has_key(package)
|
||||
|
||||
def list_installed_with_build_host(self, build_host):
|
||||
xml_line = "<BuildHost>%s</BuildHost>" % re.escape(build_host)
|
||||
build_host_re = re.compile(xml_line)
|
||||
build_host_re = re.compile("<BuildHost>(.*?)</BuildHost>")
|
||||
found = []
|
||||
for name in self.list_installed():
|
||||
xml = open(os.path.join(self.package_path(name), ctx.const.metadata_xml)).read()
|
||||
if build_host_re.search(xml):
|
||||
found.append(name)
|
||||
matched = build_host_re.search(xml)
|
||||
if matched:
|
||||
if build_host != matched.groups()[0]:
|
||||
continue
|
||||
elif build_host:
|
||||
continue
|
||||
|
||||
found.append(name)
|
||||
|
||||
return found
|
||||
|
||||
def __get_version(self, meta_doc):
|
||||
|
||||
Reference in New Issue
Block a user