From 529d7a21ce23da49b63b5372b5cf6708aeea2a2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Wed, 7 Jun 2006 20:50:48 +0000 Subject: [PATCH] * improve check command a little, check installed packages by default --- pisi/api.py | 2 +- pisi/cli/commands.py | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/pisi/api.py b/pisi/api.py index e0f79f6a..cf78c4a1 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -317,7 +317,7 @@ def check(package): for file in files.list: if file.hash and file.type != "config" \ and not os.path.islink('/' + file.path): - ctx.ui.info(_("Checking %s...") % file.path, noln=False, verbose=True) + ctx.ui.info(_("Checking %s ") % file.path, noln=True, verbose=True) if file.hash != util.sha1_file('/' + file.path): corrupt.append(file) ctx.ui.info("Corrupt file: %s" % file) diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index 0e6b03c1..34cf893d 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -733,13 +733,15 @@ Usage: info ... class Check(Command): """Verify installation -Usage: check ... +Usage: check [ ... ] : package name A cryptographic checksum is stored for each installed file. Check command uses the checksums to verify a package. Just give the names of packages. + +If no packages are given, checks all installed packages. """ __metaclass__ = autocommand @@ -749,14 +751,17 @@ Just give the names of packages. name = ("check", None) def run(self): - if not self.args: - self.help() - return - self.init(database = True, write = False) - for pkg in self.args: + if self.args: + pkgs = self.args + else: + ctx.ui.info(_('Checking all installed packages')) + pkgs = ctx.installdb.list_installed() + for pkg in pkgs: if ctx.installdb.is_installed(pkg): - pisi.api.check(pkg) + corrupt = pisi.api.check(pkg) + if corrupt: + ctx.ui.info(_('Package %s is corrupt.') % pkg) else: ctx.ui.info(_('Package %s not installed') % pkg) self.finalize()