From f726c7f089857dc65cf7c8ac62eb41f498fac46c Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 9 Nov 2008 16:58:36 +0000 Subject: 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 --- pym/portage/dbapi/vartree.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'pym') 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) -- cgit v1.2.3-1-g7c22