* pisi li -c system.kernel.drivers. components are not recursive, yet.

This commit is contained in:
Faik Uygur
2006-09-25 13:29:21 +00:00
parent 4ddb9ce61e
commit afd0dc0a84
+14 -4
View File
@@ -942,6 +942,8 @@ Usage: list-installed
group.add_option("-l", "--long", action="store_true", group.add_option("-l", "--long", action="store_true",
default=False, help=_("show in long format")) default=False, help=_("show in long format"))
group.add_option("-c", "--component", action="store",
default=None, help=_("list installed packages under given component"))
group.add_option("-i", "--install-info", action="store_true", group.add_option("-i", "--install-info", action="store_true",
default=False, help=_("show detailed install info")) default=False, help=_("show detailed install info"))
@@ -949,12 +951,20 @@ Usage: list-installed
def run(self): def run(self):
self.init(database = True, write = False) self.init(database = True, write = False)
list = ctx.installdb.list_installed() installed = ctx.installdb.list_installed()
list.sort()
component = ctx.get_option('component')
if component:
#FIXME: pisi api is insufficient to do this
from sets import Set as set
component_pkgs = ctx.componentdb.get_component(component).packages
installed = list(set(installed) & set(component_pkgs))
installed.sort()
if self.options.install_info: if self.options.install_info:
ctx.ui.info(_('Package Name |St| Version| Rel.| Build| Distro| Date')) ctx.ui.info(_('Package Name |St| Version| Rel.| Build| Distro| Date'))
print '========================================================================' print '========================================================================'
for pkg in list: for pkg in installed:
package = ctx.packagedb.get_package(pkg, pisi.itembyrepodb.installed) package = ctx.packagedb.get_package(pkg, pisi.itembyrepodb.installed)
inst_info = ctx.installdb.get_info(pkg) inst_info = ctx.installdb.get_info(pkg)
if self.options.long: if self.options.long:
@@ -1320,7 +1330,7 @@ Lists the packages that will be upgraded.
if component: if component:
#FIXME: pisi api is insufficient to do this #FIXME: pisi api is insufficient to do this
from sets import Set as set from sets import Set as set
component_pkgs = ctx.componentdb.get_component(component, None).packages component_pkgs = ctx.componentdb.get_component(component).packages
upgradable_pkgs = list(set(upgradable_pkgs) & set(component_pkgs)) upgradable_pkgs = list(set(upgradable_pkgs) & set(component_pkgs))
if not upgradable_pkgs: if not upgradable_pkgs: