summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-06-17 22:05:40 +0000
committerZac Medico <zmedico@gentoo.org>2007-06-17 22:05:40 +0000
commit46faef9797ae9c39328a1c4268e9eec34d010a11 (patch)
tree752ea94f2a4f50ade920e82732372d731d57c881
parent8b9b85e61ce218ba8ef6cf44b5509cc743ca1a07 (diff)
downloadportage-46faef9797ae9c39328a1c4268e9eec34d010a11.tar.gz
portage-46faef9797ae9c39328a1c4268e9eec34d010a11.tar.bz2
portage-46faef9797ae9c39328a1c4268e9eec34d010a11.zip
For bug #182346, use dblink.isowner() during unmerge so that device/inode numbers are used to determine ownership (despite path mismatch due to symlinks).
svn path=/main/trunk/; revision=6863
-rw-r--r--pym/portage/dbapi/vartree.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index ee134547b..3920fd096 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1146,9 +1146,9 @@ class dblink(object):
others_in_slot.append(dblink(self.cat, catsplit(cur_cpv)[1],
self.vartree.root, self.settings,
vartree=self.vartree))
- claimed_paths = set()
- for dblnk in others_in_slot:
- claimed_paths.update(dblnk.getcontents())
+ dest_root = normalize_path(self.vartree.root).rstrip(os.path.sep) + \
+ os.path.sep
+ dest_root_len = len(dest_root)
unmerge_orphans = "unmerge-orphans" in self.settings.features
@@ -1164,12 +1164,6 @@ class dblink(object):
obj = normalize_path(objkey)
file_data = pkgfiles[objkey]
file_type = file_data[0]
- if obj in claimed_paths:
- # A new instance of this package claims the file, so don't
- # unmerge it.
- writemsg_stdout("--- !owned %s %s\n" % \
- (pkgfiles[objkey][0], obj))
- continue
statobj = None
try:
statobj = os.stat(obj)
@@ -1184,6 +1178,19 @@ class dblink(object):
if lstatobj is None:
writemsg_stdout("--- !found %s %s\n" % (file_type, obj))
continue
+ if obj.startswith(dest_root):
+ relative_path = obj[dest_root_len:]
+ is_owned = False
+ for dblnk in others_in_slot:
+ if dblnk.isowner(relative_path, dest_root):
+ is_owned = True
+ break
+ if is_owned:
+ # A new instance of this package claims the file, so
+ # don't unmerge it.
+ writemsg_stdout("--- !owned %s %s\n" % \
+ (file_type, obj))
+ continue
# next line includes a tweak to protect modules from being unmerged,
# but we don't protect modules from being overwritten if they are
# upgraded. We effectively only want one half of the config protection