From 28f129091c6a01bdb2ff22608f73c2a39b278840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=2E=C3=87a=C4=9Flar=20Onur?= Date: Thu, 22 Mar 2007 18:50:18 +0000 Subject: [PATCH] component support added to pisi check (pisi check -c system.base) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ***************************************************************** 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 --- pisi/cli/commands.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index 47081830..5aff320a 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -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):