pisi li -b

lists installed packages without build nos.
This commit is contained in:
Faik Uygur
2008-02-28 08:25:50 +00:00
parent e63ef31522
commit 04d88e01e0
2 changed files with 16 additions and 1 deletions
+7 -1
View File
@@ -40,6 +40,8 @@ Usage: list-installed
group = optparse.OptionGroup(self.parser, _("list-installed options"))
group.add_option("-b", "--without-buildno", action="store_true",
default=False, help=_("Only list the installed packages without build nos"))
group.add_option("-l", "--long", action="store_true",
default=False, help=_("Show in long format"))
group.add_option("-c", "--component", action="store",
@@ -51,7 +53,11 @@ Usage: list-installed
def run(self):
self.init(database = True, write = False)
installed = self.installdb.list_installed()
if not ctx.get_option('without_buildno'):
installed = self.installdb.list_installed()
else:
installed = self.installdb.list_installed_without_buildno()
component = ctx.get_option('component')
if component:
+9
View File
@@ -99,6 +99,15 @@ class InstallDB(lazydb.LazyDB):
def has_package(self, package):
return self.installed_db.has_key(package)
def list_installed_without_buildno(self):
rebuildno = '<Build>.*?</Build>'
found = []
for name in self.list_installed():
xml = open(os.path.join(self.package_path(name), ctx.const.metadata_xml)).read()
if not re.compile(rebuildno).search(xml):
found.append(name)
return found
def get_version(self, package):
metadata_xml = os.path.join(self.package_path(package), ctx.const.metadata_xml)