summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-01-02 04:54:56 +0000
committerZac Medico <zmedico@gentoo.org>2007-01-02 04:54:56 +0000
commitff6aefe931380e74b6d6df1fd7d7297ab1e6552a (patch)
tree768f0ab6b680d0a54bc1be4a1ea8f95c55ac1b08
parentfd70eeca02eb36ca9f9d803ac176b375e6f0fa30 (diff)
downloadportage-ff6aefe931380e74b6d6df1fd7d7297ab1e6552a.tar.gz
portage-ff6aefe931380e74b6d6df1fd7d7297ab1e6552a.tar.bz2
portage-ff6aefe931380e74b6d6df1fd7d7297ab1e6552a.zip
Don't bother to list the contents of directories before they are unmerged since it triggers unnecessary stat calls. Thanks to James Cloos <cloos@jhcloos.com> for reporting.
svn path=/main/trunk/; revision=5443
-rw-r--r--pym/portage.py19
1 files changed, 5 insertions, 14 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 0fba8dfd4..685ba9568 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -6853,22 +6853,13 @@ class dblink:
mydirs.sort()
mydirs.reverse()
- last_non_empty = ""
for obj in mydirs:
- if not last_non_empty.startswith(obj) and not listdir(obj):
- try:
- os.rmdir(obj)
- writemsg_stdout("<<< %s %s\n" % ("dir",obj))
- last_non_empty = ""
- continue
- except (OSError,IOError),e:
- #immutable?
- pass
-
- writemsg_stdout("--- !empty dir %s\n" % obj)
- last_non_empty = obj
- continue
+ try:
+ os.rmdir(obj)
+ writemsg_stdout("<<< %s %s\n" % ("dir",obj))
+ except (OSError, IOError):
+ 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
self.vartree.zap(self.mycpv)