From b7ebbf8f478671a678fcab740f2e3264bd066dd5 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Fri, 22 Mar 2013 13:56:41 +0000 Subject: [PATCH] [entropy.client.dep] __get_library_breakages: handle the new library dependencies case It happened that __get_library_breakages only handled library bumps and not also another important case: new library dependencies. This check is very important at runtime, because it helps coping with unsatisfied library dependencies (that might be satisfied at the package dependencies level). For instance, upgrading udev may fail because the new udevadm depends against libblkid.so.1, which is a new dependency, while the util-linux dependency metadatum is not enforcing the new version well enough. --- lib/entropy/client/interfaces/dep.py | 30 +++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/entropy/client/interfaces/dep.py b/lib/entropy/client/interfaces/dep.py index 3fb0bd304..24d2ad7c8 100644 --- a/lib/entropy/client/interfaces/dep.py +++ b/lib/entropy/client/interfaces/dep.py @@ -1754,7 +1754,15 @@ class CalculatorsMixin: return broken_matches def __get_library_breakages(self, package_match, installed_package_id): - + """ + Get a list of library dependencies (at ELF metadata level) + that have been bumped for the given package. + The newly added ones, are considered a bump. In this way, whether + they are already present in the package dependencies or not, a + proper relation will be inserted on the dependency graph. + It can happen that a library may be considered satisfied + as package dependency but not on the current system state. + """ package_id, repository_id = package_match repo = self.open_repository(repository_id) @@ -1792,6 +1800,26 @@ class CalculatorsMixin: if lib_name in installed_split.values(): repo_lib_dumps.add((lib, repo_needed[lib])) + # now consider the case in where we have new libraries + # that are not in the installed libraries set. + new_libraries = set(repo_split.values()) - set(installed_split.values()) + if new_libraries: + + # Reverse repo_split in order to generate a mapping + # between a library name and its set of full libraries + reversed_repo_split = {} + for lib, lib_name in repo_split.items(): + obj = reversed_repo_split.setdefault(lib_name, set()) + obj.add(lib) + + new_repo_lib_dumps = set() + for lib_name in new_libraries: + libs = reversed_repo_split[lib_name] + for lib in libs: + elf_class = repo_needed[lib] + new_repo_lib_dumps.add((lib, elf_class)) + repo_lib_dumps |= new_repo_lib_dumps + return inst_lib_dumps, repo_lib_dumps def _lookup_library_breakages(self, match, installed_package_id):