diff options
author | Jason Stubbs <jstubbs@gentoo.org> | 2005-12-25 08:39:22 +0000 |
---|---|---|
committer | Jason Stubbs <jstubbs@gentoo.org> | 2005-12-25 08:39:22 +0000 |
commit | 1e1c18b4d3b000d4ba2e49606c5f65480b9d5ca4 (patch) | |
tree | 27312dc3b93e7fecfacc5ce29fca71a40799d211 | |
parent | e38428bc53fac2bdabad194e20eb14b663396369 (diff) | |
download | portage-1e1c18b4d3b000d4ba2e49606c5f65480b9d5ca4.tar.gz portage-1e1c18b4d3b000d4ba2e49606c5f65480b9d5ca4.tar.bz2 portage-1e1c18b4d3b000d4ba2e49606c5f65480b9d5ca4.zip |
Only do one round of directory removal attempts. As symlinks are now removed
before directory removal begins, more than one round is unnecessary.
svn path=/main/trunk/; revision=2457
-rw-r--r-- | pym/portage.py | 51 |
1 files changed, 15 insertions, 36 deletions
diff --git a/pym/portage.py b/pym/portage.py index ab665ce64..854901956 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -5739,44 +5739,23 @@ class dblink: elif pkgfiles[obj][0]=="dev": print "--- ","dev",obj - #progress -- are we making progress? Initialized to 1 so loop will start - progress=1 - while progress: - #let's see if we're able to make progress this iteration... - progress=0 - - pos = 0 - while pos<len(mydirs): - obj=mydirs[pos] - objld=listdir(obj) - - if objld == None: - print "mydirs["+str(pos)+"]",mydirs[pos] - print "obj",obj - print "objld",objld - # the directory doesn't exist yet, continue - pos += 1 - continue + mydirs.sort() + mydirs.reverse() + last_non_empty = "" - if len(objld)>0: - #we won't remove this directory (yet), continue - pos += 1 - continue - elif (objld != None): - #zappo time - del mydirs[pos] - #we've made progress! - progress = 1 - try: - os.rmdir(obj) - print "<<< ","dir",obj - except (OSError,IOError),e: - #immutable? - pass + for obj in mydirs: + if not last_non_empty.startswith(obj) and not listdir(obj): + try: + os.rmdir(obj) + print "<<< ","dir",obj + last_non_empty = "" + except (OSError,IOError),e: + #immutable? + pass - #directories that aren't empty: - for x in mydirs: - print "--- !empty dir", x + print "--- !empty dir", obj + last_non_empty = obj + continue #remove self from vartree database so that our own virtual gets zapped if we're the last node db[self.myroot]["vartree"].zap(self.mycpv) |