summaryrefslogtreecommitdiffstats
path: root/pym/portage.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-07-11 00:39:18 +0000
committerZac Medico <zmedico@gentoo.org>2007-07-11 00:39:18 +0000
commit7f635807c45baca25a3f64c88cfe0260eeeccb19 (patch)
treed52041df900f4c482709ffa367269a410b3a6928 /pym/portage.py
parentad8b14f7df1314507ebcdc5e3b1c5174ae8ed6fd (diff)
downloadportage-7f635807c45baca25a3f64c88cfe0260eeeccb19.tar.gz
portage-7f635807c45baca25a3f64c88cfe0260eeeccb19.tar.bz2
portage-7f635807c45baca25a3f64c88cfe0260eeeccb19.zip
For bug #184679, handle ENOTDIR by finding the non-directory parent and testing that for collision instead. (trunk r7220)
svn path=/main/branches/2.1.2/; revision=7221
Diffstat (limited to 'pym/portage.py')
-rw-r--r--pym/portage.py33
1 files changed, 29 insertions, 4 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 158484195..2f916c81e 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -7613,7 +7613,8 @@ class dblink:
starttime=time.time()
i=0
collisions = []
-
+ destroot = normalize_path(destroot).rstrip(os.path.sep) + \
+ os.path.sep
print green("*")+" checking "+str(len(myfilelist))+" files for package collisions"
for f in myfilelist:
nocheck = False
@@ -7633,10 +7634,34 @@ class dblink:
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