* temporarily ignore file conflicts in upgrades, in upgrade plan the

presence of an actual file conflict is conveyed by "conflicts" tags. 
  it is a package error. this should fix #2911, because during 
  upgrades, temporary and insignificant file conflicts may happen. after 
  the whole operation ends, no file conflicts remain. this happens for 
  instance when a file has moved from package a to b, and both packages
  must be upgraded.
This commit is contained in:
Eray Özkural
2006-06-16 12:30:46 +00:00
parent 8ef3c1dc1d
commit 0bdbf3a7b2
2 changed files with 11 additions and 10 deletions
+9 -8
View File
@@ -82,9 +82,12 @@ class Install(AtomicOperation):
else: else:
raise Error(_("Package %s not found in any active repository.") % name) raise Error(_("Package %s not found in any active repository.") % name)
def __init__(self, package_fname, ignore_dep = None): def __init__(self, package_fname, ignore_dep = None, ignore_file_conflicts = None):
"initialize from a file name" "initialize from a file name"
super(Install, self).__init__(ignore_dep) super(Install, self).__init__(ignore_dep)
if not ignore_file_conflicts:
ignore_file_conflicts = ctx.get_option('ignore_file_conflicts')
self.ignore_file_conflicts = ignore_file_conflicts
self.package_fname = package_fname self.package_fname = package_fname
self.package = pisi.package.Package(package_fname) self.package = pisi.package.Package(package_fname)
self.package.read() self.package.read()
@@ -165,7 +168,7 @@ class Install(AtomicOperation):
for (pkg, existing_file) in file_conflicts: for (pkg, existing_file) in file_conflicts:
file_conflicts_str += _("%s from %s package") % (existing_file.path, pkg) file_conflicts_str += _("%s from %s package") % (existing_file.path, pkg)
msg = _('File conflicts:\n%s') % file_conflicts_str msg = _('File conflicts:\n%s') % file_conflicts_str
if ctx.get_option('ignore_file_conflicts'): if self.ignore_file_conflicts:
ctx.ui.warning(msg) ctx.ui.warning(msg)
else: else:
raise Error(msg) raise Error(msg)
@@ -460,12 +463,10 @@ class Remove(AtomicOperation):
def remove_file(fileinfo): def remove_file(fileinfo):
fpath = pisi.util.join_path(ctx.config.dest_dir(), fileinfo.path) fpath = pisi.util.join_path(ctx.config.dest_dir(), fileinfo.path)
# FIXME: the following is obsolete becuase --ignore-file-conflicts # we should check if the file belongs to another
# is just a workaround that will be removed soon. --exa # package (this can legitimately occur while upgrading
# two packages such that a file has moved from one package to
# we should check if the file is also provided by another # another as in #2911)
# package (this is clearly the package's fault but we
# shouldn't left system in an inconsistent state).
if ctx.filesdb.has_file(fpath): if ctx.filesdb.has_file(fpath):
pkg, existing_file = ctx.filesdb.get_file(fpath) pkg, existing_file = ctx.filesdb.get_file(fpath)
if pkg != self.package_name: if pkg != self.package_name:
+1 -1
View File
@@ -446,7 +446,7 @@ def upgrade_pkg_names(A = []):
paths.append(install_op.package_fname) paths.append(install_op.package_fname)
for path in paths: for path in paths:
install_op = atomicoperations.Install(path) install_op = atomicoperations.Install(path, ignore_file_conflicts = True)
install_op.install(True) install_op.install(True)
if 'pisi' in order: if 'pisi' in order: