component support added to pisi check (pisi check -c system.base)

*****************************************************************

By the way get_union_packages function is not validates component names so if one enter wrong one pisi end up with exception.

[caglar@zangetsu][~]> pisi li -c desktop.kde.i18n.a -d
DEBUG: PiSi API initialized
Sistem Hatası: Program Sonlandırıldı.
exceptions.AttributeError: 'NoneType' object has no attribute 'has_key'
Genel yardım için lütfen 'pisi help' komutunu kullanınız.
Geri-iz:
  File "/usr/bin/pisi", line 89, in ?
    cli.run_command()
  File "/usr/lib/pardus/pisi/cli/pisicli.py", line 111, in run_command
    self.command.run()
  File "/usr/lib/pardus/pisi/cli/commands.py", line 1137, in run
    component_pkgs = ctx.componentdb.get_union_packages(component, walk=True)
  File "/usr/lib/pardus/pisi/component.py", line 139, in get_union_packages
    component = self.get_union_comp(component_name, txn, repo)
  File "/usr/lib/pardus/pisi/component.py", line 129, in get_union_comp
    return self.d.txn_proc(proc, txn)
  File "/usr/lib/pardus/pisi/itembyrepodb.py", line 53, in txn_proc
    return self.d.txn_proc(proc, txn)
  File "/usr/lib/pardus/pisi/dbshelve.py", line 86, in txn_proc
    retval = proc(None)
  File "/usr/lib/pardus/pisi/component.py", line 122, in proc
    if s.has_key(repostr):
DEBUG: PiSi API finalized
This commit is contained in:
S.Çağlar Onur
2007-03-22 18:50:18 +00:00
parent f4d50eb3ae
commit 28f129091c
+16 -1
View File
@@ -1009,13 +1009,28 @@ If no packages are given, checks all installed packages.
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):
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
else:
ctx.ui.info(_('Checking all installed packages'))
pkgs = ctx.installdb.list_installed()
for pkg in pkgs:
ctx.ui.info(_('* Checking %s... ') % pkg, noln=True)
if ctx.installdb.is_installed(pkg):