summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-09-24 23:25:57 +0000
committerZac Medico <zmedico@gentoo.org>2007-09-24 23:25:57 +0000
commit8d2522f15de684808a850bb946c284c3a0bfcb2c (patch)
treeb6ae7cdcfeb8e0ab3411fa798e215a42d88a29d5
parentfbb24f41bbdf93a741196fa8a66ecc94ae6fb4d7 (diff)
downloadportage-8d2522f15de684808a850bb946c284c3a0bfcb2c.tar.gz
portage-8d2522f15de684808a850bb946c284c3a0bfcb2c.tar.bz2
portage-8d2522f15de684808a850bb946c284c3a0bfcb2c.zip
Bugs #168772 and #193695 - During unmerge, only ignore specific
exceptions raised from unlink() and rmdir() calls. svn path=/main/trunk/; revision=7804
-rw-r--r--pym/portage/dbapi/vartree.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 5ff8e1e33..71ccdf183 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1184,6 +1184,7 @@ class dblink(object):
#process symlinks second-to-last, directories last.
mydirs = []
+ ignored_unlink_errnos = (errno.ENOENT, errno.EISDIR)
modprotect = os.path.join(self.vartree.root, "lib/modules/")
def show_unmerge(zing, desc, file_type, file_name):
writemsg_stdout("%s %s %s %s\n" % \
@@ -1240,7 +1241,9 @@ class dblink(object):
os.chmod(obj, 0)
os.unlink(obj)
except EnvironmentError, e:
- pass
+ if e.errno not in ignored_unlink_errnos:
+ raise
+ del e
show_unmerge("<<<", "", file_type, obj)
continue
@@ -1269,6 +1272,9 @@ class dblink(object):
os.unlink(obj)
show_unmerge("<<<", "", file_type, obj)
except (OSError, IOError),e:
+ if e.errno not in ignored_unlink_errnos:
+ raise
+ del e
show_unmerge("!!!", "", file_type, obj)
elif pkgfiles[objkey][0] == "obj":
if statobj is None or not stat.S_ISREG(statobj.st_mode):
@@ -1294,7 +1300,9 @@ class dblink(object):
os.chmod(obj, 0)
os.unlink(obj)
except (OSError, IOError), e:
- pass
+ if e.errno not in ignored_unlink_errnos:
+ raise
+ del e
show_unmerge("<<<", "", file_type, obj)
elif pkgfiles[objkey][0] == "fif":
if not stat.S_ISFIFO(lstatobj[stat.ST_MODE]):
@@ -1311,8 +1319,14 @@ class dblink(object):
try:
os.rmdir(obj)
show_unmerge("<<<", "", "dir", obj)
- except EnvironmentError:
- show_unmerge("---", "!empty", "dir", obj)
+ except EnvironmentError, e:
+ if e.errno not in (errno.ENOENT,
+ errno.EEXIST, errno.ENOTEMPTY,
+ errno.ENOTDIR):
+ raise
+ if e.errno != errno.ENOENT:
+ show_unmerge("---", "!empty", "dir", obj)
+ del e
#remove self from vartree database so that our own virtual gets zapped if we're the last node
self.vartree.zap(self.mycpv)