summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Mauch <genone@gentoo.org>2007-12-04 09:28:00 +0000
committerMarius Mauch <genone@gentoo.org>2007-12-04 09:28:00 +0000
commitee72bf14ea642df6077db3a1fa78c449909a12e6 (patch)
treee154ea4db364d974a019541e7a7d7c9c46255edc
parentf37967614d0b7ae7760875e25bf5491f45a2c541 (diff)
downloadportage-ee72bf14ea642df6077db3a1fa78c449909a12e6.tar.gz
portage-ee72bf14ea642df6077db3a1fa78c449909a12e6.tar.bz2
portage-ee72bf14ea642df6077db3a1fa78c449909a12e6.zip
make sure we only remove files that were previously preserved
svn path=/main/trunk/; revision=8837
-rw-r--r--pym/portage/dbapi/vartree.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 8162b9d11..ee71bb855 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1159,7 +1159,11 @@ class dblink(object):
break
else:
unlink_list.append(f)
- f = os.readlink(f)
+ # only follow symlinks if the target is also a preserved lib object
+ if os.readlink(f) in plib_dict[cpv]:
+ f = os.readlink(f)
+ else:
+ break
if not os.path.islink(f) and not os.path.basename(f) in self.vartree.dbapi.libmap.get():
unlink_list.append(f)
for obj in unlink_list:
@@ -1168,8 +1172,8 @@ class dblink(object):
obj_type = "sym"
else:
obj_type = "obj"
- writemsg_stdout("<<< !needed %s %s\n" % (obj_type, obj))
os.unlink(obj)
+ writemsg_stdout("<<< !needed %s %s\n" % (obj_type, obj))
except OSError, e:
if e.errno == errno.ENOENT:
pass