From 33b1e5d2b62afbf07bf5bb52609bec6a69713604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Tue, 16 Aug 2005 14:07:00 +0000 Subject: [PATCH] * fix #343 - inter-package path collisions raise pisi.build.Error - intra-package path collisions are resolved according to declaration order. * implement upgrade-all command * PisiBuildError -> pisi.build.Error --- pisi/build.py | 18 ++++++++++++------ pisi/cli/commands.py | 27 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/pisi/build.py b/pisi/build.py index 57a8d9fb..6c2ec933 100644 --- a/pisi/build.py +++ b/pisi/build.py @@ -29,7 +29,7 @@ from pisi.metadata import MetaData from pisi.package import Package -class PisiBuildError(pisi.Error): +class Error(pisi.Error): pass @@ -70,6 +70,8 @@ def check_path_collision(package, pkgList): # path.pathname: /usr/share/doc if util.subpath(pinfo.pathname, path.pathname): collisions.append(path.pathname) + ui.error('Path %s belongs in multiple packages\n' % + path.pathname) return collisions @@ -199,7 +201,7 @@ class PisiBuild: """Calls the corresponding function in actions.py. If mandatory parameter is True, and function is not present in - actionLocals PisiBuildError will be raised.""" + actionLocals pisi.build.Error will be raised.""" # we'll need our working directory after actionscript # finished its work in the archive source directory. curDir = os.getcwd() @@ -210,7 +212,7 @@ class PisiBuild: self.actionLocals[func]() else: if mandatory: - PisiBuildError, "unable to call function from actions: %s" %func + Error, "unable to call function from actions: %s" %func os.chdir(curDir) @@ -269,7 +271,10 @@ class PisiBuild: files = Files() install_dir = self.ctx.pkg_install_dir() collisions = check_path_collision(package, - self.spec.packages) + self.spec.packages) + if collisions: + raise Error('Path collisions detected') + d = {} for pinfo in package.paths: path = install_dir + pinfo.pathname for fpath, fhash in util.get_file_hashes(path, collisions, install_dir): @@ -279,8 +284,9 @@ class PisiBuild: fsize = str(os.path.getsize(fpath)) except OSError: fsize = "0" - files.append(FileInfo(frpath, ftype, fsize, fhash)) - + d[frpath] = FileInfo(frpath, ftype, fsize, fhash) + for (p, fileinfo) in d.iteritems(): + files.append(fileinfo) files.write(os.path.join(self.ctx.pkg_dir(), const.files_xml)) self.files = files diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index 5c36df35..23e680f7 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -329,6 +329,33 @@ Remove package(s) from your system. Just give the package names to remove. self.finalize() +class UpgradeAll(PackageOp): + """Upgrade system + +Usage: Upgrade + +Upgrade the entire system. +""" + def __init__(self): + super(Upgrade, self).__init__() + + def name(self): + return ("upgrade-all", None) + + def options(self): + super(UpgradeAll, self).options() + buildno_opts(self) + + def run(self): + if self.args: + self.help() + return + + self.init() + pisi.toplevel.upgrade(installdb.list_installed()) + self.finalize() + + class ConfigurePending(PackageOp): """configure pending packages """