Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 108894 Details for
Bug 16162
"MD5 + timestamp equal or empty directory" unmerge check is insufficient
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Additional check before removing empty directory
portage-2.1.2-empty-directory.patch (text/plain), 2.93 KB, created by
Kaiting Chen
on 2007-02-01 21:41:29 UTC
(
hide
)
Description:
Additional check before removing empty directory
Filename:
MIME Type:
Creator:
Kaiting Chen
Created:
2007-02-01 21:41:29 UTC
Size:
2.93 KB
patch
obsolete
>diff -ur portage-2.1.2.orig/pym/portage.py portage-2.1.2/pym/portage.py >--- portage-2.1.2.orig/pym/portage.py 2007-02-01 21:33:13.000000000 -0500 >+++ portage-2.1.2/pym/portage.py 2007-02-01 21:34:32.000000000 -0500 >@@ -6788,7 +6788,7 @@ > return pkgfiles > > def unmerge(self, pkgfiles=None, trimworld=1, cleanup=1, >- ldpath_mtimes=None): >+ ldpath_mtimes=None, alreadyinstalled=0): > """ > Calls prerm > Unmerges a given package (CPV) >@@ -6867,7 +6867,7 @@ > writemsg("!!! FAILED prerm: %s\n" % retval, noiselevel=-1) > return retval > >- self._unmerge_pkgfiles(pkgfiles) >+ self._unmerge_pkgfiles(pkgfiles, alreadyinstalled=alreadyinstalled) > > if myebuildpath: > retval = doebuild(myebuildpath, "postrm", self.myroot, >@@ -6906,7 +6906,7 @@ > contents=contents) > return os.EX_OK > >- def _unmerge_pkgfiles(self, pkgfiles): >+ def _unmerge_pkgfiles(self, pkgfiles, alreadyinstalled=0): > """ > > Unmerges the contents of a package from the liveFS >@@ -7014,11 +7014,38 @@ > mydirs.sort() > mydirs.reverse() > >+ # Get a list of versions for this package to check empty directories >+ otherversions=[] >+ for v in self.vartree.dbapi.cp_list(self.mysplit[0]): >+ otherversions.append(v.split("/")[1]) >+ # Remove ourselves only if we're upgrading >+ # If alreadyinstalled is set, we're only replacing ourself with the same package >+ if not alreadyinstalled and self.pkg in otherversions: >+ otherversions.remove(self.pkg) >+ >+ otherpkglist = [] >+ destroot = '/' # Setup this for convenience since we only unmerge live packages >+ for v in otherversions: >+ # Actual dblink object since package names are not useful >+ otherpkglist.append( >+ dblink(self.cat, v, destroot, self.settings, vartree = self.vartree)) >+ > for obj in mydirs: >- try: >- os.rmdir(obj) >- writemsg_stdout("<<< %s %s\n" % ("dir",obj)) >- except (OSError, IOError): >+ # The directory is empty, then check before removing >+ if len(os.listdir(obj)) == 0: >+ for p in otherpkglist: >+ if p.isowner(obj, destroot): >+ break >+ else: >+ # Nothing else owns the directory >+ os.rmdir(obj) >+ writemsg_stdout("<<< %s %s\n" % ("dir",obj)) >+ continue >+ >+ # Execution reaches here if something owns the directory >+ writemsg_stdout("--- !keep dir %s\n" % obj) >+ else: >+ # This is for directories that are not empty > writemsg_stdout("--- !empty dir %s\n" % obj) > > #remove self from vartree database so that our own virtual gets zapped if we're the last node >@@ -7353,7 +7380,7 @@ > if os.path.exists(self.dbpkgdir): > writemsg_stdout(">>> Safely unmerging already-installed instance...\n") > self.dbdir = self.dbpkgdir >- self.unmerge(oldcontents, trimworld=0, ldpath_mtimes=prev_mtimes) >+ self.unmerge(oldcontents, trimworld=0, ldpath_mtimes=prev_mtimes, alreadyinstalled=1) > self.dbdir = self.dbtmpdir > writemsg_stdout(">>> Original instance of package unmerged safely.\n") >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 16162
: 108894 |
108896