summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-11-09 16:58:36 +0000
committerZac Medico <zmedico@gentoo.org>2008-11-09 16:58:36 +0000
commitf726c7f089857dc65cf7c8ac62eb41f498fac46c (patch)
tree7bce07bdbc2673031326ed52726bfe2c2d3c5224
parent893cb8b3cd25ee4cfe9ba28c6118abe33147dda8 (diff)
downloadportage-f726c7f089857dc65cf7c8ac62eb41f498fac46c.tar.gz
portage-f726c7f089857dc65cf7c8ac62eb41f498fac46c.tar.bz2
portage-f726c7f089857dc65cf7c8ac62eb41f498fac46c.zip
Handle a corner case inside dblink._add_preserve_libs_to_contents() in which
a path to be preserved doesn't exist in the contents of the installed instance. svn path=/main/trunk/; revision=11835
-rw-r--r--pym/portage/dbapi/vartree.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 89764f085..d2a123934 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -2575,11 +2575,20 @@ class dblink(object):
old_contents = self._installed_instance.getcontents()
for f in list(preserve_paths):
f_abs = os.path.join(root, f.lstrip(os.sep))
- new_contents[f_abs] = old_contents[f_abs]
- if os.path.islink(f_abs):
- obj_type = "sym"
- else:
- obj_type = "obj"
+ contents_entry = old_contents.get(f_abs)
+ if contents_entry is None:
+ # This will probably never happen, but it might if one of the
+ # paths returned from findConsumers() refers to one of the libs
+ # that should be preserved yet the path is not listed in the
+ # contents. Such a path might belong to some other package, so
+ # it shouldn't be preserved here.
+ showMessage(("!!! File '%s' will not be preserved " + \
+ "due to missing contents entry\n") % (f_abs,),
+ level=logging.ERROR, noiselevel=-1)
+ preserve_paths.remove(f)
+ continue
+ new_contents[f_abs] = contents_entry
+ obj_type = contents_entry[0]
showMessage(">>> needed %s %s\n" % (obj_type, f_abs))
# Add parent directories to contents if necessary.
parent_dir = os.path.dirname(f_abs)