- 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
This commit is contained in:
Eray Özkural
2005-08-16 14:07:00 +00:00
parent d9539c3917
commit 33b1e5d2b6
2 changed files with 39 additions and 6 deletions
+12 -6
View File
@@ -29,7 +29,7 @@ from pisi.metadata import MetaData
from pisi.package import Package from pisi.package import Package
class PisiBuildError(pisi.Error): class Error(pisi.Error):
pass pass
@@ -70,6 +70,8 @@ def check_path_collision(package, pkgList):
# path.pathname: /usr/share/doc # path.pathname: /usr/share/doc
if util.subpath(pinfo.pathname, path.pathname): if util.subpath(pinfo.pathname, path.pathname):
collisions.append(path.pathname) collisions.append(path.pathname)
ui.error('Path %s belongs in multiple packages\n' %
path.pathname)
return collisions return collisions
@@ -199,7 +201,7 @@ class PisiBuild:
"""Calls the corresponding function in actions.py. """Calls the corresponding function in actions.py.
If mandatory parameter is True, and function is not present in 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 # we'll need our working directory after actionscript
# finished its work in the archive source directory. # finished its work in the archive source directory.
curDir = os.getcwd() curDir = os.getcwd()
@@ -210,7 +212,7 @@ class PisiBuild:
self.actionLocals[func]() self.actionLocals[func]()
else: else:
if mandatory: if mandatory:
PisiBuildError, "unable to call function from actions: %s" %func Error, "unable to call function from actions: %s" %func
os.chdir(curDir) os.chdir(curDir)
@@ -269,7 +271,10 @@ class PisiBuild:
files = Files() files = Files()
install_dir = self.ctx.pkg_install_dir() install_dir = self.ctx.pkg_install_dir()
collisions = check_path_collision(package, collisions = check_path_collision(package,
self.spec.packages) self.spec.packages)
if collisions:
raise Error('Path collisions detected')
d = {}
for pinfo in package.paths: for pinfo in package.paths:
path = install_dir + pinfo.pathname path = install_dir + pinfo.pathname
for fpath, fhash in util.get_file_hashes(path, collisions, install_dir): for fpath, fhash in util.get_file_hashes(path, collisions, install_dir):
@@ -279,8 +284,9 @@ class PisiBuild:
fsize = str(os.path.getsize(fpath)) fsize = str(os.path.getsize(fpath))
except OSError: except OSError:
fsize = "0" 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)) files.write(os.path.join(self.ctx.pkg_dir(), const.files_xml))
self.files = files self.files = files
+27
View File
@@ -329,6 +329,33 @@ Remove package(s) from your system. Just give the package names to remove.
self.finalize() 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): class ConfigurePending(PackageOp):
"""configure pending packages """configure pending packages
""" """