diff --git a/SOURCES/0000-lib-Seek-beginning-of-mountinfo-file.patch b/SOURCES/0000-lib-Seek-beginning-of-mountinfo-file.patch deleted file mode 100644 index 97b4523..0000000 --- a/SOURCES/0000-lib-Seek-beginning-of-mountinfo-file.patch +++ /dev/null @@ -1,34 +0,0 @@ -From c767c5b858c88aa9fad0ca3aa80e5fd18c6d830d Mon Sep 17 00:00:00 2001 -From: Matej Marusak -Date: Tue, 4 Dec 2018 09:38:32 +0100 -Subject: [PATCH 0/2] lib: Seek beginning of mountinfo file - -Signed-off-by: Matej Marusak -(cherry picked from commit c8afd2847f59278faac8d12c150db1d29f7ad622) ---- - src/lib/get_cmdline.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/lib/get_cmdline.c b/src/lib/get_cmdline.c -index 83c2fb45..49d419d5 100644 ---- a/src/lib/get_cmdline.c -+++ b/src/lib/get_cmdline.c -@@ -905,6 +905,7 @@ int process_has_own_root_at(int pid_proc_fd) - close(mnt_fd); - return r; - } -+ fseek(fin, 0, SEEK_SET); - - r = get_mountinfo_for_mount_point(fin, &pid_root, "/"); - fclose(fin); -@@ -925,6 +926,7 @@ int process_has_own_root_at(int pid_proc_fd) - return r; - } - -+ fseek(fin, 0, SEEK_SET); - r = get_mountinfo_for_mount_point(fin, &system_root, "/"); - fclose(fin); - if (r) --- -2.21.0 - diff --git a/SOURCES/0001-testsuite-Correct-string-format.patch b/SOURCES/0001-testsuite-Correct-string-format.patch deleted file mode 100644 index 70fd2b7..0000000 --- a/SOURCES/0001-testsuite-Correct-string-format.patch +++ /dev/null @@ -1,27 +0,0 @@ -From e8e69f0bf6f0bf067bc7f58f018a74c35d469342 Mon Sep 17 00:00:00 2001 -From: Matej Marusak -Date: Tue, 4 Dec 2018 11:47:16 +0100 -Subject: [PATCH 1/2] testsuite: Correct string format - -Signed-off-by: Matej Marusak -(cherry picked from commit 7b123846bc8baa3ff3a6ab8b4e1c5c062d666b5f) ---- - tests/reported_to.at | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/reported_to.at b/tests/reported_to.at -index ecf323d8..f95971f7 100644 ---- a/tests/reported_to.at -+++ b/tests/reported_to.at -@@ -221,7 +221,7 @@ bool parse_and_check(const char *reported_to, GList *expected) - - if(e->timestamp != c->timestamp) - { -- printf("Timestamps: '%lld' != '%lld'\n", e->timestamp, c->timestamp); -+ printf("Timestamps: '%ld' != '%ld'\n", e->timestamp, c->timestamp); - goto finish; - } - --- -2.21.0 - diff --git a/SOURCES/0002-lib-Explicitly-do-not-use-DST.patch b/SOURCES/0002-lib-Explicitly-do-not-use-DST.patch deleted file mode 100644 index 46bf669..0000000 --- a/SOURCES/0002-lib-Explicitly-do-not-use-DST.patch +++ /dev/null @@ -1,33 +0,0 @@ -From a5fbbd2fca0c8cd2a3c0c9a898dca37addf4b2e0 Mon Sep 17 00:00:00 2001 -From: Matej Marusak -Date: Thu, 6 Dec 2018 11:59:56 +0100 -Subject: [PATCH 2/2] lib: Explicitly do not use DST - -DST = Daylight Saving Time -Value of this field is not set up by strptime and therefore value -of `tm_isdst` field is undefined. Bacause of this reason, output of -`mktime` may differ +-1 hour. - -Signed-off-by: Matej Marusak -(cherry picked from commit bd7b93d056d780df18b377f5c553611deeff2443) ---- - src/lib/iso_date_string.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/lib/iso_date_string.c b/src/lib/iso_date_string.c -index ab23f05b..cb887832 100644 ---- a/src/lib/iso_date_string.c -+++ b/src/lib/iso_date_string.c -@@ -61,6 +61,9 @@ int iso_date_string_parse(const char *date, time_t *pt) - return -EINVAL; - } - -+ // daylight saving time not in use -+ local.tm_isdst = 0; -+ - *pt = mktime(&local); - return 0; - } --- -2.21.0 - diff --git a/SOURCES/0025-report-client-Find-debuginfos-in-own-method.patch b/SOURCES/0025-report-client-Find-debuginfos-in-own-method.patch new file mode 100644 index 0000000..891f67d --- /dev/null +++ b/SOURCES/0025-report-client-Find-debuginfos-in-own-method.patch @@ -0,0 +1,146 @@ +From f4a632838a453f168037257d0c48e9b0976d6321 Mon Sep 17 00:00:00 2001 +From: Matej Marusak +Date: Fri, 30 Nov 2018 11:40:09 +0100 +Subject: [PATCH] report-client: Find debuginfos in own method + +This commit picks a piece of code responsible for looking up debuginfo +packages into own method. For making sure that it works in any code that +used it the old way, it checks if the method for finding packages was +already called and if not, calls it directly. + +Purpose of this change is to be able to get size of packages those are +going to be installed before installing them. In that case anyone using +these downloader classes is going to be able for example prepare enough +space for the newly installed packages. + +Related to #811978. + +Signed-off-by: Matej Marusak +--- + src/client-python/reportclient/debuginfo.py | 69 +++++++++++++-------- + 1 file changed, 43 insertions(+), 26 deletions(-) + +diff --git a/src/client-python/reportclient/debuginfo.py b/src/client-python/reportclient/debuginfo.py +index 4390304e..561de52f 100644 +--- a/src/client-python/reportclient/debuginfo.py ++++ b/src/client-python/reportclient/debuginfo.py +@@ -233,6 +233,17 @@ class DebugInfoDownload(object): + self.keeprpms = keep_rpms + self.noninteractive = noninteractive + self.repo_pattern = repo_pattern ++ self.package_files_dict = {} ++ self.not_found = [] ++ self.todownload_size = 0 ++ self.installed_size = 0 ++ self.find_packages_run = False ++ ++ def get_download_size(self): ++ return self.todownload_size ++ ++ def get_install_size(self): ++ return self.installed_size + + def mute_stdout(self): + """ +@@ -286,6 +297,26 @@ class DebugInfoDownload(object): + def download_package(self, pkg): + pass + ++ def find_packages(self, files): ++ self.find_packages_run = True; ++ # nothing to download? ++ if not files: ++ return RETURN_FAILURE ++ ++ print(_("Initializing package manager")) ++ self.prepare() ++ ++ # This takes some time, let user know what we are doing ++ print(_("Setting up repositories")) ++ self.initialize_repositories() ++ ++ print(_("Looking for needed packages in repositories")) ++ (self.package_files_dict, ++ self.not_found, ++ self.todownload_size, ++ self.installed_size) = self.triage(files) ++ ++ + # return value will be used as exitcode. So 0 = ok, !0 - error + def download(self, files, download_exact_files=False): + """ +@@ -309,32 +340,18 @@ class DebugInfoDownload(object): + if retval != RETURN_OK: + return retval + +- print(_("Initializing package manager")) +- self.prepare() +- #if verbose == 0: +- # # this suppress yum messages about setting up repositories +- # mute_stdout() +- +- # This takes some time, let user know what we are doing +- print(_("Setting up repositories")) +- self.initialize_repositories() +- +- #if verbose == 0: +- # # re-enable the output to stdout +- # unmute_stdout() +- +- print(_("Looking for needed packages in repositories")) +- package_files_dict, not_found, todownload_size, installed_size = self.triage(files) ++ if not self.find_packages_run: ++ self.find_packages(files) + +- if verbose != 0 or len(not_found) != 0: +- print(_("Can't find packages for {0} debuginfo files").format(len(not_found))) ++ if verbose != 0 or len(self.not_found) != 0: ++ print(_("Can't find packages for {0} debuginfo files").format(len(self.not_found))) + +- if verbose != 0 or len(package_files_dict) != 0: +- print(_("Packages to download: {0}").format(len(package_files_dict))) ++ if verbose != 0 or len(self.package_files_dict) != 0: ++ print(_("Packages to download: {0}").format(len(self.package_files_dict))) + question = _( + "Downloading {0:.2f}Mb, installed size: {1:.2f}Mb. Continue?") \ +- .format(todownload_size / (1024 * 1024), +- installed_size / (1024 * 1024)) ++ .format(self.todownload_size / (1024 * 1024), ++ self.installed_size / (1024 * 1024)) + + if not self.noninteractive and not ask_yes_no(question): + print(_("Download cancelled by user")) +@@ -343,7 +360,7 @@ class DebugInfoDownload(object): + # check if there is enough free space in both tmp and cache + res = os.statvfs(self.tmpdir) + tmp_space = float(res.f_bsize * res.f_bavail) / (1024 * 1024) +- if (todownload_size / (1024 * 1024)) > tmp_space: ++ if (self.todownload_size / (1024 * 1024)) > tmp_space: + question = _("Warning: Not enough free space in tmp dir '{0}'" + " ({1:.2f}Mb left). Continue?").format( + self.tmpdir, tmp_space) +@@ -354,7 +371,7 @@ class DebugInfoDownload(object): + + res = os.statvfs(self.cachedir) + cache_space = float(res.f_bsize * res.f_bavail) / (1024 * 1024) +- if (installed_size / (1024 * 1024)) > cache_space: ++ if (self.installed_size / (1024 * 1024)) > cache_space: + question = _("Warning: Not enough free space in cache dir " + "'{0}' ({1:.2f}Mb left). Continue?").format( + self.cachedir, cache_space) +@@ -363,10 +380,10 @@ class DebugInfoDownload(object): + print(_("Download cancelled by user")) + return RETURN_CANCEL_BY_USER + +- progress_observer = DownloadProgress(len(package_files_dict)) ++ progress_observer = DownloadProgress(len(self.package_files_dict)) + self.initialize_progress(progress_observer) + +- for pkg, files in package_files_dict.items(): ++ for pkg, files in self.package_files_dict.items(): + # Download + package_full_path, err = self.download_package(pkg) + +-- +2.24.1 + diff --git a/SOURCES/0026-reportclient-Find-and-download-required-debuginfo-pa.patch b/SOURCES/0026-reportclient-Find-and-download-required-debuginfo-pa.patch new file mode 100644 index 0000000..00835d2 --- /dev/null +++ b/SOURCES/0026-reportclient-Find-and-download-required-debuginfo-pa.patch @@ -0,0 +1,77 @@ +From 23110cb7198e53c1e211ba8a41c7406b04641574 Mon Sep 17 00:00:00 2001 +From: Martin Kutlak +Date: Mon, 3 Dec 2018 13:54:34 +0100 +Subject: [PATCH] reportclient: Find and download required debuginfo packages + +The current solution finds packages for given build-ids and then +downloads them. The problem is that some debuginfo packages require +other packages and if they are not available the generated backtrace +becomes unusable. + +This commit adds a query for required packages and downloads them together +with the main packages. + +Related: rhbz#1515265 + +Signed-off-by: Martin Kutlak +--- + .../reportclient/dnfdebuginfo.py | 34 +++++++++++++------ + 1 file changed, 23 insertions(+), 11 deletions(-) + +diff --git a/src/client-python/reportclient/dnfdebuginfo.py b/src/client-python/reportclient/dnfdebuginfo.py +index 1867484f..04f98579 100644 +--- a/src/client-python/reportclient/dnfdebuginfo.py ++++ b/src/client-python/reportclient/dnfdebuginfo.py +@@ -106,26 +106,38 @@ class DNFDebugInfoDownload(DebugInfoDownload): + print(_("Error setting up repositories: '{0!s}'").format(str(ex))) + + def triage(self, files): +- q = self.base.sack.query() +- i = q.available() ++ dnf_query = self.base.sack.query() ++ dnf_available = dnf_query.available() + package_files_dict = {} + not_found = [] + todownload_size = 0 + installed_size = 0 + for debuginfo_path in files: +- packages = i.filter(file=debuginfo_path) ++ di_package_list = [] ++ packages = dnf_available.filter(file=debuginfo_path) ++ + if not packages: + log2("not found package for %s", debuginfo_path) + not_found.append(debuginfo_path) + else: +- if packages[0] in package_files_dict.keys(): +- package_files_dict[packages[0]].append(debuginfo_path) +- else: +- package_files_dict[packages[0]] = [debuginfo_path] +- todownload_size += float(packages[0].downloadsize) +- installed_size += float(packages[0].installsize) +- +- log2("found packages for %s: %s", debuginfo_path, packages[0]) ++ di_package_list.append(packages[0]) ++ if packages[0].requires: ++ package_reqs = dnf_available.filter(provides=packages[0].requires, ++ arch=packages[0].arch) ++ for pkg in package_reqs: ++ if pkg not in di_package_list: ++ di_package_list.append(pkg) ++ log2("found required package {0} for {1}".format(pkg, packages[0])) ++ ++ for pkg in di_package_list: ++ if pkg in package_files_dict.keys(): ++ package_files_dict[pkg].append(debuginfo_path) ++ else: ++ package_files_dict[pkg] = [debuginfo_path] ++ todownload_size += float(pkg.downloadsize) ++ installed_size += float(pkg.installsize) ++ ++ log2("found packages for %s: %s", debuginfo_path, pkg) + return (package_files_dict, not_found, todownload_size, installed_size) + + def download_package(self, pkg): +-- +2.24.1 + diff --git a/SOURCES/0027-reportclient-Search-for-required-packages-recursivel.patch b/SOURCES/0027-reportclient-Search-for-required-packages-recursivel.patch new file mode 100644 index 0000000..e4ee7d6 --- /dev/null +++ b/SOURCES/0027-reportclient-Search-for-required-packages-recursivel.patch @@ -0,0 +1,60 @@ +From c0d0e59df7d73feb971ba495c81f4651a8cea8a6 Mon Sep 17 00:00:00 2001 +From: Martin Kutlak +Date: Wed, 5 Dec 2018 16:52:07 +0100 +Subject: [PATCH] reportclient: Search for required packages recursively + +Adds recursive function to search for required packages of required packages +of re... + +Signed-off-by: Martin Kutlak +--- + .../reportclient/dnfdebuginfo.py | 21 +++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/src/client-python/reportclient/dnfdebuginfo.py b/src/client-python/reportclient/dnfdebuginfo.py +index 04f98579..165c12d0 100644 +--- a/src/client-python/reportclient/dnfdebuginfo.py ++++ b/src/client-python/reportclient/dnfdebuginfo.py +@@ -112,6 +112,23 @@ class DNFDebugInfoDownload(DebugInfoDownload): + not_found = [] + todownload_size = 0 + installed_size = 0 ++ ++ def required_packages(query, package, origin): ++ """ ++ Recursive function to find all required packages of required packages of ... ++ origin - should stop infinite recursion (A => B => ... => X => A) ++ """ ++ required_pkg_list = [] ++ if package.requires: ++ pkg_reqs = query.filter(provides=package.requires, arch=package.arch) ++ for p in pkg_reqs: ++ if p.name != origin.name and p not in required_pkg_list: ++ required_pkg_list.append(p) ++ required_pkg_list += required_packages(query, p, origin) ++ ++ return required_pkg_list ++ ++ + for debuginfo_path in files: + di_package_list = [] + packages = dnf_available.filter(file=debuginfo_path) +@@ -122,13 +139,13 @@ class DNFDebugInfoDownload(DebugInfoDownload): + else: + di_package_list.append(packages[0]) + if packages[0].requires: +- package_reqs = dnf_available.filter(provides=packages[0].requires, +- arch=packages[0].arch) ++ package_reqs = required_packages(dnf_available, packages[0], packages[0]) + for pkg in package_reqs: + if pkg not in di_package_list: + di_package_list.append(pkg) + log2("found required package {0} for {1}".format(pkg, packages[0])) + ++ + for pkg in di_package_list: + if pkg in package_files_dict.keys(): + package_files_dict[pkg].append(debuginfo_path) +-- +2.24.1 + diff --git a/SPECS/libreport.spec b/SPECS/libreport.spec index 4db910a..b646137 100644 --- a/SPECS/libreport.spec +++ b/SPECS/libreport.spec @@ -29,7 +29,7 @@ Summary: Generic library for reporting various problems Name: libreport Version: 2.9.5 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv2+ URL: https://abrt.readthedocs.org/ Source: https://github.com/abrt/%{name}/archive/%{version}/%{name}-%{version}.tar.gz @@ -37,7 +37,7 @@ Source: https://github.com/abrt/%{name}/archive/%{version}/%{name}-%{version}.ta Patch0001: 0001-ureport-use-python3-to-get-consumerCertDir.patch Patch0002: 0002-Remove-option-to-screencast-problems.patch Patch0003: 0003-offer-reporting-to-Bugzilla-only-for-pre-GA-Anaconda.patch -#Patch0004: 0004-replace-all-Fedora-URLs-by-corresponding-values-for-.patch +Patch0004: 0004-replace-all-Fedora-URLs-by-corresponding-values-for-.patch Patch0005: 0005-coverity-fix-def6.patch Patch0006: 0006-coverity-fix-def7.patch Patch0007: 0007-coverity-fix-def9.patch @@ -60,10 +60,10 @@ Patch0023: 0023-tests-Disable-strcpm-ing-a-freed-pointer.patch #git format-patch -N --start-number=24 Patch0024: 0024-lib-fix-a-SEGV-in-list_possible_events.patch #git format-patch -N --start-number=25 - -Patch9990: 0000-lib-Seek-beginning-of-mountinfo-file.patch -Patch9991: 0001-testsuite-Correct-string-format.patch -Patch9992: 0002-lib-Explicitly-do-not-use-DST.patch +Patch0025: 0025-report-client-Find-debuginfos-in-own-method.patch +Patch0026: 0026-reportclient-Find-and-download-required-debuginfo-pa.patch +Patch0027: 0027-reportclient-Search-for-required-packages-recursivel.patch +#git format-patch -N --start-number=28 c0d0e59d # autogen.sh is need to regenerate all the Makefile files Patch9000: 9000-Add-autogen.sh.patch @@ -850,8 +850,11 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %endif %changelog -* Tue Nov 05 2019 CentOS Sources - 2.9.5-9.el8.centos -- Apply debranding changes +* Tue Jan 21 2020 Martin Kutlak - 2.9.5-10 +- reportclient: Search for required packages recursively +- reportclient: Find and download required debuginfo packages +- report-client: Find debuginfos in own method +- Resolves: rhbz#1783897 * Fri Jul 29 2019 Martin Kutlak - 2.9.5-9 - lib: fix a SEGV in list_possible_events()