* implement a command to check packages

This commit is contained in:
Eray Özkural
2005-12-12 18:26:18 +00:00
parent b697c75f09
commit 835e6310c9
4 changed files with 39 additions and 1 deletions
+14
View File
@@ -253,6 +253,20 @@ def search_package(terms, lang = None):
r = r1.union(r2)
return r
def check(package):
md, files = info(package)
corrupt = []
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, True, True)
if file.hash != util.sha1_file('/' + file.path):
corrupt.append(file)
ctx.ui.info("Corrupt file: %s" % file)
else:
ctx.ui.info("OK", True)
return corrupt
def index(dirs, output = 'pisi-index.xml'):
index = Index()
if not dirs:
+1 -1
View File
@@ -355,7 +355,7 @@ class Remove(AtomicOperation):
# usage. Currently we'are doing it like rpm does, saving
# with a prefix and leaving the user to edit it. In the future
# we'll have a plan for these configuration files.
if fileinfo.type == ctx.const.conf:
if fileinfo.type == "config":
if os.path.isfile(fpath):
os.rename(fpath, fpath + ".oldconfig")
else:
+23
View File
@@ -559,6 +559,29 @@ Usage: info <package1> <package2> ... <packagen>
ctx.ui.warning(_('File information not available'))
class Check(Command):
"""Verify installation
Usage: check <package1> <package2> ... <packagen>
"""
__metaclass__ = autocommand
def __init__(self):
super(Check, self).__init__()
name = ("check", "c")
def run(self):
if not self.args:
self.help()
return
self.init(True)
for arg in self.args:
pisi.api.check(arg)
self.finalize()
class Index(Command):
"""Index PISI files in a given directory
+1
View File
@@ -67,6 +67,7 @@ class Constants:
self.__c.install_func = "install"
# file types
# FIXME: these are redundant
self.__c.doc = "doc"
self.__c.man = "man"
self.__c.info = "info"