|
|
8256c5 |
From c0d0e59df7d73feb971ba495c81f4651a8cea8a6 Mon Sep 17 00:00:00 2001
|
|
|
8256c5 |
From: Martin Kutlak <mkutlak@redhat.com>
|
|
|
8256c5 |
Date: Wed, 5 Dec 2018 16:52:07 +0100
|
|
|
8256c5 |
Subject: [PATCH] reportclient: Search for required packages recursively
|
|
|
8256c5 |
|
|
|
8256c5 |
Adds recursive function to search for required packages of required packages
|
|
|
8256c5 |
of re...
|
|
|
8256c5 |
|
|
|
8256c5 |
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
|
|
|
8256c5 |
---
|
|
|
8256c5 |
.../reportclient/dnfdebuginfo.py | 21 +++++++++++++++++--
|
|
|
8256c5 |
1 file changed, 19 insertions(+), 2 deletions(-)
|
|
|
8256c5 |
|
|
|
8256c5 |
diff --git a/src/client-python/reportclient/dnfdebuginfo.py b/src/client-python/reportclient/dnfdebuginfo.py
|
|
|
8256c5 |
index 04f98579..165c12d0 100644
|
|
|
8256c5 |
--- a/src/client-python/reportclient/dnfdebuginfo.py
|
|
|
8256c5 |
+++ b/src/client-python/reportclient/dnfdebuginfo.py
|
|
|
8256c5 |
@@ -112,6 +112,23 @@ class DNFDebugInfoDownload(DebugInfoDownload):
|
|
|
8256c5 |
not_found = []
|
|
|
8256c5 |
todownload_size = 0
|
|
|
8256c5 |
installed_size = 0
|
|
|
8256c5 |
+
|
|
|
8256c5 |
+ def required_packages(query, package, origin):
|
|
|
8256c5 |
+ """
|
|
|
8256c5 |
+ Recursive function to find all required packages of required packages of ...
|
|
|
8256c5 |
+ origin - should stop infinite recursion (A => B => ... => X => A)
|
|
|
8256c5 |
+ """
|
|
|
8256c5 |
+ required_pkg_list = []
|
|
|
8256c5 |
+ if package.requires:
|
|
|
8256c5 |
+ pkg_reqs = query.filter(provides=package.requires, arch=package.arch)
|
|
|
8256c5 |
+ for p in pkg_reqs:
|
|
|
8256c5 |
+ if p.name != origin.name and p not in required_pkg_list:
|
|
|
8256c5 |
+ required_pkg_list.append(p)
|
|
|
8256c5 |
+ required_pkg_list += required_packages(query, p, origin)
|
|
|
8256c5 |
+
|
|
|
8256c5 |
+ return required_pkg_list
|
|
|
8256c5 |
+
|
|
|
8256c5 |
+
|
|
|
8256c5 |
for debuginfo_path in files:
|
|
|
8256c5 |
di_package_list = []
|
|
|
8256c5 |
packages = dnf_available.filter(file=debuginfo_path)
|
|
|
8256c5 |
@@ -122,13 +139,13 @@ class DNFDebugInfoDownload(DebugInfoDownload):
|
|
|
8256c5 |
else:
|
|
|
8256c5 |
di_package_list.append(packages[0])
|
|
|
8256c5 |
if packages[0].requires:
|
|
|
8256c5 |
- package_reqs = dnf_available.filter(provides=packages[0].requires,
|
|
|
8256c5 |
- arch=packages[0].arch)
|
|
|
8256c5 |
+ package_reqs = required_packages(dnf_available, packages[0], packages[0])
|
|
|
8256c5 |
for pkg in package_reqs:
|
|
|
8256c5 |
if pkg not in di_package_list:
|
|
|
8256c5 |
di_package_list.append(pkg)
|
|
|
8256c5 |
log2("found required package {0} for {1}".format(pkg, packages[0]))
|
|
|
8256c5 |
|
|
|
8256c5 |
+
|
|
|
8256c5 |
for pkg in di_package_list:
|
|
|
8256c5 |
if pkg in package_files_dict.keys():
|
|
|
8256c5 |
package_files_dict[pkg].append(debuginfo_path)
|
|
|
8256c5 |
--
|
|
|
8256c5 |
2.24.1
|
|
|
8256c5 |
|