pisi check -c [--component] support (caglar) (merged from trunk)
This commit is contained in:
+16
-1
@@ -1014,13 +1014,28 @@ If no packages are given, checks all installed packages.
|
|||||||
|
|
||||||
name = ("check", None)
|
name = ("check", None)
|
||||||
|
|
||||||
|
def options(self):
|
||||||
|
group = OptionGroup(self.parser, _("check options"))
|
||||||
|
group.add_option("-c", "--component", action="store",
|
||||||
|
default=None, help=_("Check installed packages under given component"))
|
||||||
|
self.parser.add_option_group(group)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.init(database = True, write = False)
|
self.init(database = True, write = False)
|
||||||
if self.args:
|
|
||||||
|
component = ctx.get_option('component')
|
||||||
|
if component:
|
||||||
|
#FIXME: pisi api is insufficient to do this
|
||||||
|
from sets import Set as set
|
||||||
|
installed = ctx.installdb.list_installed()
|
||||||
|
component_pkgs = ctx.componentdb.get_union_packages(component, walk=True)
|
||||||
|
pkgs = list(set(installed) & set(component_pkgs))
|
||||||
|
elif self.args:
|
||||||
pkgs = self.args
|
pkgs = self.args
|
||||||
else:
|
else:
|
||||||
ctx.ui.info(_('Checking all installed packages'))
|
ctx.ui.info(_('Checking all installed packages'))
|
||||||
pkgs = ctx.installdb.list_installed()
|
pkgs = ctx.installdb.list_installed()
|
||||||
|
|
||||||
for pkg in pkgs:
|
for pkg in pkgs:
|
||||||
ctx.ui.info(_('* Checking %s... ') % pkg, noln=True)
|
ctx.ui.info(_('* Checking %s... ') % pkg, noln=True)
|
||||||
if ctx.installdb.is_installed(pkg):
|
if ctx.installdb.is_installed(pkg):
|
||||||
|
|||||||
Reference in New Issue
Block a user