Gentoo Archives: gentoo-commits

From: Pacho Ramos <pacho@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-admin/abrt/, app-admin/abrt/files/
Date: Sat, 06 Nov 2021 08:05:29
Message-Id: 1636185902.e4f951e4f7f7e2e158ef2b3617a64a60b06fadbf.pacho@gentoo
1 commit: e4f951e4f7f7e2e158ef2b3617a64a60b06fadbf
2 Author: Pacho Ramos <pacho <AT> gentoo <DOT> org>
3 AuthorDate: Sat Nov 6 08:05:02 2021 +0000
4 Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org>
5 CommitDate: Sat Nov 6 08:05:02 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4f951e4
7
8 app-admin/abrt: Fix running with glib-2.70
9
10 Also do lazy python imports to avoid performance issues
11
12 Closes: https://bugs.gentoo.org/821199
13 Thanks-to: Leho Kraav (:macmaN @lkraav)
14 Thanks-to: Sam James
15 Package-Manager: Portage-3.0.28, Repoman-3.0.3
16 Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>
17
18 app-admin/abrt/abrt-2.14.6-r1.ebuild | 134 +++++++++++++++++++++
19 app-admin/abrt/files/abrt-2.14.6-glib270.patch | 32 +++++
20 .../abrt/files/abrt-2.14.6-lazy-imports.patch | 57 +++++++++
21 3 files changed, 223 insertions(+)
22
23 diff --git a/app-admin/abrt/abrt-2.14.6-r1.ebuild b/app-admin/abrt/abrt-2.14.6-r1.ebuild
24 new file mode 100644
25 index 00000000000..c5c616459b4
26 --- /dev/null
27 +++ b/app-admin/abrt/abrt-2.14.6-r1.ebuild
28 @@ -0,0 +1,134 @@
29 +# Copyright 1999-2021 Gentoo Authors
30 +# Distributed under the terms of the GNU General Public License v2
31 +
32 +EAPI=7
33 +PYTHON_COMPAT=( python3_{8..9} )
34 +
35 +inherit autotools python-single-r1 tmpfiles xdg
36 +
37 +DESCRIPTION="Automatic bug detection and reporting tool"
38 +HOMEPAGE="https://github.com/abrt/abrt/wiki/ABRT-Project https://github.com/abrt/abrt"
39 +SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
40 +
41 +LICENSE="GPL-2"
42 +SLOT="0"
43 +KEYWORDS="~amd64 ~x86"
44 +
45 +IUSE="selinux test"
46 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
47 +
48 +RESTRICT="!test? ( test )"
49 +
50 +DEPEND="${PYTHON_DEPS}
51 + >=dev-libs/glib-2.56:2
52 + >=dev-libs/libreport-2.13.0:=[gtk,python]
53 + dev-libs/libxml2:2
54 + >=gnome-base/gsettings-desktop-schemas-3.15.1
55 + net-libs/libsoup:2.4
56 + sys-apps/dbus
57 + sys-apps/systemd:0=
58 + sys-auth/polkit
59 + sys-libs/libcap
60 + sys-fs/inotify-tools
61 + x11-libs/gtk+:3
62 +"
63 +RDEPEND="${DEPEND}
64 + acct-user/abrt
65 + acct-group/abrt
66 + app-arch/cpio
67 + app-arch/rpm[python,${PYTHON_SINGLE_USEDEP}]
68 + dev-libs/elfutils
69 + dev-libs/json-c:0=
70 + sys-apps/util-linux
71 + >=sys-devel/gdb-7
72 + $(python_gen_cond_dep '
73 + dev-libs/satyr[${PYTHON_USEDEP}]
74 + dev-python/argcomplete[${PYTHON_USEDEP}]
75 + dev-python/argh[${PYTHON_USEDEP}]
76 + dev-python/humanize[${PYTHON_USEDEP}]
77 + ')
78 +"
79 +BDEPEND="
80 + $(python_gen_cond_dep 'dev-python/python-systemd[${PYTHON_USEDEP}]')
81 + test? (
82 + $(python_gen_cond_dep 'dev-python/pytest[${PYTHON_USEDEP}]')
83 + )
84 + app-text/asciidoc
85 + app-text/xmlto
86 + >=dev-util/intltool-0.35.0
87 + virtual/pkgconfig
88 + >=sys-devel/gettext-0.17
89 +"
90 +
91 +PATCHES=(
92 + # https://github.com/abrt/abrt/commit/a6297858575780b9ed3d14cc42983348924d6048
93 + "${FILESDIR}/${P}-glib270.patch"
94 +
95 + # https://github.com/abrt/abrt/pull/1580
96 + "${FILESDIR}/${P}-lazy-imports.patch"
97 +)
98 +
99 +pkg_setup() {
100 + python-single-r1_pkg_setup
101 +}
102 +
103 +src_prepare() {
104 + python_fix_shebang .
105 + default
106 +
107 + # Install under proper directory
108 + sed -i -e 's:dbusabrtdocdir = ${datadir}/doc/abrt-dbus-${VERSION}/html:dbusabrtdocdir = ${datadir}/doc/${PF}/html:' doc/problems-service/Makefile.am || die
109 +
110 + # Ensure this works for systems with and without /usr merge
111 + sed -i -e "s:/usr/bin/bash:$(which bash):" init-scripts/abrtd.service || die
112 +
113 + # Fix hardcoded "pytest-3"
114 + sed -i -e "s:pytest-3:pytest:" \
115 + configure.ac src/python-problem/tests/Makefile.am src/cli/test || die
116 +
117 + # pyhook test is sensitive to the format of python's error messages, and
118 + # fails with certain python versions
119 + sed -e '/pyhook.at/ d' \
120 + -i tests/Makefile.* tests/testsuite.at || die "sed remove pyhook tests failed"
121 + ./gen-version || die # Needed to be run before autoreconf
122 + eautoreconf
123 +}
124 +
125 +src_configure() {
126 + myeconfargs=(
127 + --libdir="${EPREFIX}/usr/$(get_libdir)"
128 + --localstatedir="${EPREFIX}/var"
129 + --without-bodhi
130 + # package breaks due to not finding libreport-web with bodhi plugin enabled
131 + --without-rpm
132 + $(usex selinux "" "--without-selinux")
133 + --with-python3
134 + --without-pythondoc
135 + # package breaks due to no sphinx-build-3
136 + $(use_with test pythontests)
137 + )
138 +
139 + econf "${myeconfargs[@]}"
140 +}
141 +
142 +src_install() {
143 + default
144 + python_optimize
145 +
146 + # /var/spool/abrt is created by dev-libs/libreport
147 + diropts -m 700 -o abrt -g abrt
148 + keepdir /var/spool/abrt-upload
149 +
150 + find "${D}" -name '*.la' -delete || die
151 +
152 + newinitd "${FILESDIR}/${PN}-2.0.12-r1-init" abrt
153 + newconfd "${FILESDIR}/${PN}-2.0.12-r1-conf" abrt
154 +
155 + # Drop empy dirs, handled by tmpfiles
156 + rm -r "${ED}"/var/run/ || die
157 +}
158 +
159 +pkg_postinst() {
160 + xdg_pkg_postinst
161 + tmpfiles_process abrt.conf
162 +}
163
164 diff --git a/app-admin/abrt/files/abrt-2.14.6-glib270.patch b/app-admin/abrt/files/abrt-2.14.6-glib270.patch
165 new file mode 100644
166 index 00000000000..673a31e0a21
167 --- /dev/null
168 +++ b/app-admin/abrt/files/abrt-2.14.6-glib270.patch
169 @@ -0,0 +1,32 @@
170 +From a6297858575780b9ed3d14cc42983348924d6048 Mon Sep 17 00:00:00 2001
171 +From: Michal Srb <michal@××××××.com>
172 +Date: Tue, 5 Oct 2021 15:53:48 +0200
173 +Subject: [PATCH] abrt-dbus: do not try to free session data twice
174 +
175 +We free session data in on_g_signal() function, which is also
176 +invoked when client disappears. Therefore, we don't need to register the
177 +same free function in g_bus_watch_name_on_connection().
178 +
179 +glib2 2.69.2 changed (fixed?) how/when g_bus_watch_name_on_connection()
180 +calls the provided free function and it uncovered this problem in abrt-dbus.
181 +
182 +See rhbz#1997315 for more details.
183 +
184 +Signed-off-by: Michal Srb <michal@××××××.com>
185 +---
186 + src/dbus/abrt_problems2_service.c | 2 +-
187 + 2 files changed, 2 insertions(+), 1 deletion(-)
188 +
189 +diff --git a/src/dbus/abrt_problems2_service.c b/src/dbus/abrt_problems2_service.c
190 +index 8d543f443..004c7aeb2 100644
191 +--- a/src/dbus/abrt_problems2_service.c
192 ++++ b/src/dbus/abrt_problems2_service.c
193 +@@ -571,7 +571,7 @@ static AbrtP2Object *session_object_register(AbrtP2Service *service,
194 + obj->owner_watcher_id = g_bus_watch_name_on_connection(connection, caller,
195 + G_BUS_NAME_WATCHER_FLAGS_NONE,
196 + NULL, abrt_p2_service_on_session_owner_vanished,
197 +- obj, (GDestroyNotify)abrt_p2_object_destroy);
198 ++ obj, NULL);
199 +
200 + return obj;
201 + }
202
203 diff --git a/app-admin/abrt/files/abrt-2.14.6-lazy-imports.patch b/app-admin/abrt/files/abrt-2.14.6-lazy-imports.patch
204 new file mode 100644
205 index 00000000000..5c892a8ecab
206 --- /dev/null
207 +++ b/app-admin/abrt/files/abrt-2.14.6-lazy-imports.patch
208 @@ -0,0 +1,57 @@
209 +From 4755f2171aa50a72d8ec03260c8cbc602263a6c0 Mon Sep 17 00:00:00 2001
210 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@×××××××.cz>
211 +Date: Fri, 24 Sep 2021 17:48:07 +0200
212 +Subject: [PATCH] Use lazy imports in abrt_exception_handler3
213 +
214 +The abrt_exception_handler3 module is always imported when Python starts,
215 +but all the modules imported from it (except sys) are only used during crashes.
216 +
217 +Especially the systemd.journal import is really expensive.
218 +
219 +Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2007664
220 +---
221 + src/hooks/abrt_exception_handler3.py.in | 9 +++++++--
222 + 1 file changed, 7 insertions(+), 2 deletions(-)
223 +
224 +diff --git a/src/hooks/abrt_exception_handler3.py.in b/src/hooks/abrt_exception_handler3.py.in
225 +index 89e2474b..0bc548e0 100644
226 +--- a/src/hooks/abrt_exception_handler3.py.in
227 ++++ b/src/hooks/abrt_exception_handler3.py.in
228 +@@ -20,13 +20,15 @@
229 + Module for the ABRT exception handling hook
230 + """
231 +
232 ++# Avoid importing anything but sys here, use lazy imports.
233 ++# This file is imported on every Python startup,
234 ++# all unused imports only increase the startup time and memory usage.
235 + import sys
236 +-import os
237 +
238 +-from systemd import journal
239 +
240 + def syslog(msg):
241 + """Log message to system logger (journal)"""
242 ++ from systemd import journal
243 +
244 + journal.send(msg)
245 +
246 +@@ -68,6 +70,8 @@ def send(data):
247 +
248 +
249 + def write_dump(tb_text, tb):
250 ++ import os
251 ++
252 + if sys.argv[0][0] == "/":
253 + executable = os.path.abspath(sys.argv[0])
254 + else:
255 +@@ -118,6 +122,7 @@ def handle_exception(etype, value, tb):
256 + sys.excepthook = sys.__excepthook__ # pylint: disable-msg=E1101
257 +
258 + import errno
259 ++ import os
260 +
261 + # Ignore Ctrl-C
262 + # SystemExit rhbz#636913 -> this exception is not an error
263 +--
264 +2.31.1
265 +