import libreport-2.9.5-11.el8

This commit is contained in:
CentOS Sources 2020-07-28 05:01:02 -04:00 committed by Stepan Oksanichenko
parent 5887efb731
commit b7689f67c4
5 changed files with 341 additions and 3 deletions

View File

@ -0,0 +1,146 @@
From f4a632838a453f168037257d0c48e9b0976d6321 Mon Sep 17 00:00:00 2001
From: Matej Marusak <mmarusak@redhat.com>
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 <mmarusak@redhat.com>
---
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

View File

@ -0,0 +1,77 @@
From 23110cb7198e53c1e211ba8a41c7406b04641574 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
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 <mkutlak@redhat.com>
---
.../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

View File

@ -0,0 +1,60 @@
From c0d0e59df7d73feb971ba495c81f4651a8cea8a6 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
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 <mkutlak@redhat.com>
---
.../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

View File

@ -0,0 +1,41 @@
From 0b37412bc975d6e043c34dbff379029fd94a1758 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Wed, 14 Aug 2019 14:46:08 +0000
Subject: [PATCH] dirsize: Skip dirs in which sosreport is being generated
With these changes ABRT will skip directories in which sosreport is running
and won't delete them when MaxCrashReportSize limit is exceeded.
I had a concern about the size of the logs that sosreport collects but
there is a limit set by sosreport for how big the individual logs can
be and the default value is 25MiB.
Fixes: rhbz#1671232
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
(cherry picked from commit eef59d2358cf63338f38727c5d08be70619e4e55)
---
src/lib/dirsize.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/lib/dirsize.c b/src/lib/dirsize.c
index 6d96e71..7ee9752 100644
--- a/src/lib/dirsize.c
+++ b/src/lib/dirsize.c
@@ -91,6 +91,11 @@ double get_dirsize_find_largest_dir(
if (dot_or_dotdot(ep->d_name))
continue;
char *dname = concat_path_file(pPath, ep->d_name);
+ if (lstat(concat_path_file(dname, "sosreport.log"), &statbuf) == 0)
+ {
+ log_debug("Skipping %s': sosreport is being generated.", dname);
+ goto next;
+ }
if (lstat(dname, &statbuf) != 0)
{
goto next;
--
2.26.0

View File

@ -29,7 +29,7 @@
Summary: Generic library for reporting various problems
Name: libreport
Version: 2.9.5
Release: 9%{?dist}
Release: 11%{?dist}
License: GPLv2+
URL: https://abrt.readthedocs.org/
Source: https://github.com/abrt/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
@ -60,7 +60,12 @@ 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
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 --no-numbered --start-number=28 --topo-order 2.9.5-10.el8
Patch0028: 0028-dirsize-Skip-dirs-in-which-sosreport-is-being-genera.patch
# git format-patch --no-numbered --start-number=28 --topo-order 2.9.5-11.el8
# autogen.sh is need to regenerate all the Makefile files
Patch9000: 9000-Add-autogen.sh.patch
@ -847,7 +852,16 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%endif
%changelog
* Fri Jul 29 2019 Martin Kutlak <mkutlak@redhat.com> - 2.9.5-9
* Thu Apr 16 2020 Ernestas Kulik <ekulik@redhat.com> - 2.9.5-11
- Add patch for #1822092
* Tue Jan 21 2020 Martin Kutlak <mkutlak@redhat.com> - 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
* Mon Jul 29 2019 Martin Kutlak <mkutlak@redhat.com> - 2.9.5-9
- lib: fix a SEGV in list_possible_events()
- Resolves: rhbz#1733515