summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-07-11 00:33:04 +0000
committerZac Medico <zmedico@gentoo.org>2007-07-11 00:33:04 +0000
commit82f809d68e837bbca380902dbeba8aaac6e2e2ba (patch)
tree8d333317e203b072c678be8f3a0b68c810520e1a
parent328c229156fabe3e3b9e20b27d6dabdd46c17d3a (diff)
downloadportage-82f809d68e837bbca380902dbeba8aaac6e2e2ba.tar.gz
portage-82f809d68e837bbca380902dbeba8aaac6e2e2ba.tar.bz2
portage-82f809d68e837bbca380902dbeba8aaac6e2e2ba.zip
For bug #184679, handle ENOTDIR by finding the non-directory parent and testing that for collision instead.
svn path=/main/trunk/; revision=7220
-rw-r--r--pym/portage/dbapi/vartree.py33
1 files changed, 29 insertions, 4 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index d91073705..93adc30a8 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1440,7 +1440,8 @@ class dblink(object):
stopmerge = False
i=0
collisions = []
-
+ destroot = normalize_path(destroot).rstrip(os.path.sep) + \
+ os.path.sep
print green("*")+" checking "+str(len(mycontents))+" files for package collisions"
for f in mycontents:
nocheck = False
@@ -1460,10 +1461,34 @@ class dblink(object):
try:
dest_lstat = os.lstat(dest_path)
except EnvironmentError, e:
- if e.errno != errno.ENOENT:
+ if e.errno == errno.ENOENT:
+ del e
+ continue
+ elif e.errno == errno.ENOTDIR:
+ del e
+ # A non-directory is in a location where this package
+ # expects to have a directory.
+ dest_lstat = None
+ parent_path = dest_path
+ while len(parent_path) > len(destroot):
+ parent_path = os.path.dirname(parent_path)
+ try:
+ dest_lstat = os.lstat(parent_path)
+ break
+ except EnvironmentError, e:
+ if e.errno != errno.ENOTDIR:
+ raise
+ del e
+ if not dest_lstat:
+ raise AssertionError(
+ "unable to find non-directory " + \
+ "parent for '%s'" % parent_path)
+ dest_path = parent_path
+ f = os.path.sep + dest_path[len(destroot):]
+ if f in collisions:
+ continue
+ else:
raise
- del e
- continue
if f[0] != "/":
f="/"+f
isowned = False