diff --git a/pisi/cli/listinstalled.py b/pisi/cli/listinstalled.py index fd328364..590063b8 100644 --- a/pisi/cli/listinstalled.py +++ b/pisi/cli/listinstalled.py @@ -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) diff --git a/pisi/db/installdb.py b/pisi/db/installdb.py index d77d73bd..41142dab 100644 --- a/pisi/db/installdb.py +++ b/pisi/db/installdb.py @@ -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 = "%s" % re.escape(build_host) - build_host_re = re.compile(xml_line) + build_host_re = re.compile("(.*?)") 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):