pisi li -b
lists installed packages without build nos.
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user