Bug #194081 - Add EBUSY to the list of ignored errnos for unlink
authorZac Medico <zmedico@gentoo.org>
Fri, 28 Sep 2007 17:07:37 +0000 (17:07 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 28 Sep 2007 17:07:37 +0000 (17:07 -0000)
and rmdir calls during unmerge.

svn path=/main/trunk/; revision=7869

pym/portage/dbapi/vartree.py

index f3b806ea5b4346dc065830e249c7b69259f36306..9cde9624fd7bdbf60d2b2ec88262dc571cfeb90b 100644 (file)
@@ -1184,7 +1184,13 @@ class dblink(object):
 
                        #process symlinks second-to-last, directories last.
                        mydirs = []
-                       ignored_unlink_errnos = (errno.ENOENT, errno.ENOTDIR, errno.EISDIR)
+                       ignored_unlink_errnos = (
+                               errno.EBUSY, errno.ENOENT,
+                               errno.ENOTDIR, errno.EISDIR)
+                       ignored_rmdir_errnos = (
+                               errno.EEXIST, errno.ENOTEMPTY,
+                               errno.EBUSY, errno.ENOENT,
+                               errno.ENOTDIR, errno.EISDIR)
                        modprotect = os.path.join(self.vartree.root, "lib/modules/")
 
                        def unlink(file_name, lstatobj):
@@ -1349,9 +1355,7 @@ class dblink(object):
                                                        bsd_chflags.chflags(parent_name, pflags)
                                        show_unmerge("<<<", "", "dir", obj)
                                except EnvironmentError, e:
-                                       if e.errno not in (errno.ENOENT,
-                                               errno.EEXIST, errno.ENOTEMPTY,
-                                               errno.ENOTDIR):
+                                       if e.errno not in ignored_rmdir_errnos:
                                                raise
                                        if e.errno != errno.ENOENT:
                                                show_unmerge("---", "!empty", "dir", obj)