[entropy.qa] drop warn_missing_dependencies, no longer used

This commit is contained in:
Fabio Erculiani
2014-10-20 16:41:38 +02:00
parent d857d99832
commit 376d8e11ce

View File

@@ -369,135 +369,6 @@ class QAInterface(TextInterface, EntropyPluginStore):
return missing_map
def warn_missing_dependencies(self, entropy_client, package_matches):
"""
Scan given package matches looking for missing dependencies.
This method scans the live filesystem looking for library matches,
so the returned information might be incorrect (packages using
runtime LD_LIBRARY_PATH and other dlopen() magic might be reported
as false positives).
@param entropy_client: Entropy Client instance
@type entropy_client: entropy.client.interfaces.client.Client based
instance object
@param package_matches: list of entropy package matches tuples
(package id, repo id)
@type package_matches: list
@return: list (set) of broken package matches
@rtype: set
"""
repos = sorted(entropy_client.repositories())
# populate the system packages cache
system_packages = set()
for s_repo_id in repos:
s_repo = entropy_client.open_repository(s_repo_id)
for s_package_id in s_repo.listAllSystemPackageIds():
system_packages.add((s_package_id, s_repo_id))
def _warn_soname(soname, elfclass):
# try to resolve soname
for needed_repo in repos:
needed_dbconn = entropy_client.open_repository(needed_repo)
pkg_ids = needed_dbconn.resolveNeeded(soname,
elfclass = elfclass)
if pkg_ids:
pkg_atoms = sorted((
needed_dbconn.retrieveKeySlotAggregated(x) for x in \
pkg_ids))
pkg_atoms_string = ', '.join(pkg_atoms)
else:
pkg_atoms_string = _("no packages")
self.output(
"[%s:%s] %s" % (
brown(needed_repo),
teal(soname),
purple(pkg_atoms_string),
),
importance = 0,
level = "info",
header = brown(" # ")
)
def _filter_missing_sonames(missing):
"""
Determine whether the missing sonames bound to individual
executables are valid. Check if soname points to a system pkg
and filter it out in case.
"""
filtered_missing_sonames = {}
for executable, sonames in missing.items():
elfclass = entropy.tools.read_elf_class(executable)
for soname in sonames:
system_pkgs = set()
for needed_repo in repos:
needed_dbconn = entropy_client.open_repository(
needed_repo)
pkg_ids = needed_dbconn.resolveNeeded(
soname, elfclass = elfclass)
system_pkg = all(
[self._is_system_package(
entropy_client, x, needed_dbconn,
system_packages) for x in pkg_ids])
system_pkgs.add(system_pkg)
if not all(system_pkgs):
filtered_sonames = filtered_missing_sonames.setdefault(
executable, set())
filtered_sonames.add(soname)
return filtered_missing_sonames
broken_matches = set()
for count, (package_id, repo_id) in enumerate(package_matches, 1):
dbconn = entropy_client.open_repository(repo_id)
atom = dbconn.retrieveAtom(package_id)
# check for untracked missing sonames (using less reliable
# ldd check, but just warn)
missing_sonames = self._get_unresolved_sonames(entropy_client,
(package_id, repo_id))
if missing_sonames:
missing_sonames = _filter_missing_sonames(missing_sonames)
if missing_sonames:
broken_matches.add((package_id, repo_id))
self.output(
"[%s] %s: %s %s:" % (
darkgreen(repo_id),
blue("package"),
darkgreen(atom),
blue(_("is potentially missing these dependencies")),
),
importance = 1,
level = "info",
header = red(" @@ "),
count = (count, len(package_matches),)
)
for executable, sonames in missing_sonames.items():
elfclass = entropy.tools.read_elf_class(executable)
self.output(
"%s (elf class: %s):" % (
brown(executable),
teal(str(elfclass)),
),
importance = 0,
level = "info",
header = purple(" ## ")
)
for soname in sonames:
_warn_soname(soname, elfclass)
return broken_matches
def test_missing_runtime_libraries(self, entropy_client, package_matches,
base_repository_id = None, excluded_libraries = None, silent = False):
"""