diff --git a/lib/entropy/client/interfaces/dep.py b/lib/entropy/client/interfaces/dep.py index ebfe6db3f..36b599083 100644 --- a/lib/entropy/client/interfaces/dep.py +++ b/lib/entropy/client/interfaces/dep.py @@ -1075,7 +1075,8 @@ class CalculatorsMixin: def __generate_dependency_tree_inst_hooks(self, installed_match, pkg_match, build_deps, - elements_cache): + elements_cache, + ldpaths): if const_debug_enabled(): inst_atom = self.installed_repository().retrieveAtom( @@ -1096,7 +1097,7 @@ class CalculatorsMixin: broken_children_matches,)) after_pkgs, before_pkgs = self._lookup_library_breakages( - pkg_match, installed_match[0]) + pkg_match, installed_match[0], ldpaths) if const_debug_enabled(): const_debug_write(__name__, "__generate_dependency_tree_inst_hooks " @@ -1378,7 +1379,7 @@ class CalculatorsMixin: empty_deps = False, relaxed_deps = False, build_deps = False, only_deps = False, deep_deps = False, unsatisfied_deps_cache = None, elements_cache = None, post_deps_cache = None, recursive = True, - selected_matches = None, selected_matches_cache = None): + selected_matches = None, selected_matches_cache = None, ldpaths = None): pkg_id, pkg_repo = matched_atom if (pkg_id == -1) or (pkg_repo == 1): @@ -1395,6 +1396,10 @@ class CalculatorsMixin: if selected_matches is None: selected_matches = set() + + if ldpaths is None: + ldpaths = frozenset() + deps_not_found = set() conflicts = set() first_element = True @@ -1456,7 +1461,7 @@ class CalculatorsMixin: children_matches, after_pkgs, before_pkgs, inverse_deps = \ self.__generate_dependency_tree_inst_hooks( (cm_package_id, cm_result), pkg_match, - build_deps, elements_cache) + build_deps, elements_cache, ldpaths) # this is fine this way, these are strong inverse deps # and their order is already written in stone for inv_match in inverse_deps: @@ -1865,7 +1870,7 @@ class CalculatorsMixin: return inst_lib_dumps, repo_lib_dumps - def _lookup_library_breakages(self, match, installed_package_id): + def _lookup_library_breakages(self, match, installed_package_id, ldpaths): """ Lookup packages that need to be bumped because "match" is being installed and "installed_package_id" removed. @@ -1877,7 +1882,7 @@ class CalculatorsMixin: cache_key = None if self.xcache: - cache_s = "%s|%s|%s|%s|%s|%s|%s|r7" % ( + cache_s = "%s|%s|%s|%s|%s|%s|%s|%s|r8" % ( match, installed_package_id, inst_repo.checksum(), @@ -1885,6 +1890,7 @@ class CalculatorsMixin: self._settings.packages_configuration_hash(), self._settings_client_plugin.packages_configuration_hash(), ";".join(sorted(self._settings['repositories']['available'])), + ";".join(sorted(ldpaths)), ) sha = hashlib.sha1() sha.update(const_convert_to_rawstring(cache_s)) @@ -1899,7 +1905,7 @@ class CalculatorsMixin: match, installed_package_id) matches = self._lookup_library_breakages_available( - match, repo_side) + match, repo_side, ldpaths) installed_matches = self._lookup_library_breakages_installed( installed_package_id, client_side) @@ -1914,7 +1920,8 @@ class CalculatorsMixin: return installed_matches, matches def _lookup_library_breakages_available(self, package_match, - bumped_needed_libs): + bumped_needed_libs, + ldpaths): """ Generate a list of package matches that should be bumped if the given libraries were installed. @@ -1966,17 +1973,21 @@ class CalculatorsMixin: keyslot = repo.retrieveKeySlotAggregated(package_id) for needed, elfclass, rpath in bumped_needed_libs: - solved_neededs = [] + package_ldpaths = ldpaths | set(entropy.tools.parse_rpath(rpath)) + found = False for s_repo_id in self._settings['repositories']['order']: s_repo = self.open_repository(s_repo_id) solved_needed = s_repo.resolveNeeded( - needed, elfclass = elfclass) - if solved_needed: - solved_neededs.append((s_repo_id, solved_needed)) + needed, elfclass = elfclass, extended = True) - for repo_pkg_id in solved_needed: + # Filter out resolved needed that are not in package LDPATH. + solved_needed = filter( + lambda x: os.path.dirname(x[1]) in package_ldpaths, + solved_needed) + + for repo_pkg_id, path in solved_needed: repo_pkg_match = (repo_pkg_id, s_repo_id) if package_match == repo_pkg_match: @@ -2047,8 +2058,9 @@ class CalculatorsMixin: # pulled in and updated installed_package_ids = set() for needed, elfclass, rpath in bumped_needed_libs: - installed_package_ids |= inst_repo.searchNeeded( + found_neededs = inst_repo.searchNeeded( needed, elfclass = elfclass) + installed_package_ids |= found_neededs # drop myself installed_package_ids.discard(installed_package_id) @@ -2156,13 +2168,14 @@ class CalculatorsMixin: deep_deps = False, relaxed_deps = False, build_deps = False, only_deps = False, quiet = False, recursive = True): + ldpaths = frozenset(entropy.tools.collect_linker_paths()) inst_repo = self.installed_repository() cache_key = None if self.xcache: sha = hashlib.sha1() - cache_s = "%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|v7" % ( + cache_s = "%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|v8" % ( ";".join(["%s" % (x,) for x in sorted(package_matches)]), empty_deps, deep_deps, @@ -2177,7 +2190,8 @@ class CalculatorsMixin: ";".join(sorted(self._settings['repositories']['available'])), # needed when users do bogus things like editing config files # manually (branch setting) - self._settings['repositories']['branch']) + self._settings['repositories']['branch'], + ";".join(sorted(ldpaths))) sha.update(const_convert_to_rawstring(cache_s)) cache_key = "deptree/dep_tree_%s" % (sha.hexdigest(),) @@ -2248,7 +2262,8 @@ class CalculatorsMixin: post_deps_cache = post_deps_cache, recursive = recursive, selected_matches = selected_matches_set, - selected_matches_cache = selected_matches_cache + selected_matches_cache = selected_matches_cache, + ldpaths = ldpaths ) except DependenciesNotFound as err: deps_not_found |= err.value