Disable bug reporting, if libreport is not available

Resolves: RHEL-52902

Signed-off-by: Michal Srb <michal@redhat.com>
This commit is contained in:
Michal Srb 2024-08-22 12:25:46 +02:00
parent 95c5458163
commit e7e41bb997
2 changed files with 72 additions and 1 deletions

View File

@ -0,0 +1,62 @@
From e72f22bac65ed67849d8df28b7119c76df077c67 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Thu, 22 Aug 2024 12:14:53 +0200
Subject: [PATCH] Disable bug reporting, if libreport is not available
libreport doesn't support JIRA, so it won't be in RHEL.
Resolves: RHEL-52902
Signed-off-by: Michal Srb <michal@redhat.com>
---
src/setroubleshoot/browser.py | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/setroubleshoot/browser.py b/src/setroubleshoot/browser.py
index c98b075..33272db 100644
--- a/src/setroubleshoot/browser.py
+++ b/src/setroubleshoot/browser.py
@@ -64,10 +64,17 @@ from setroubleshoot.util import *
from setroubleshoot.html_util import html_to_text
import re
import dbus
-import report
-import report.io
-import report.io.GTKIO
-import report.accountmanager
+
+has_libreport = False
+try:
+ import report
+ import report.io
+ import report.io.GTKIO
+ import report.accountmanager
+ has_libreport = True
+except ImportError:
+ # Bug reporting won't be available
+ pass
from gi.repository import Gio
@@ -278,7 +285,8 @@ class BrowserApplet:
self.make_treeview()
self.troubleshoot_visible = False
self.current_alert = -1
- self.accounts = report.accountmanager.AccountManager()
+ if has_libreport:
+ self.accounts = report.accountmanager.AccountManager()
def get_current_alert(self):
try:
@@ -541,7 +549,7 @@ class BrowserApplet:
report_button.connect("clicked", self.fix_bug, alert.local_id, plugin.analysis_id)
vbox.add(report_button)
- elif plugin.report_bug:
+ elif plugin.report_bug and has_libreport:
report_button = Gtk.Button()
report_button.set_label(_("Report\nBug"))
report_button.show()
--
2.46.0

View File

@ -1,10 +1,12 @@
# Disable automatic compilation of Python files in extra directories
%global _python_bytecompile_extra 0
%bcond libreport %{undefined rhel}
Summary: Helps troubleshoot SELinux problems
Name: setroubleshoot
Version: 3.3.33
Release: 3.1%{?dist}
Release: 4.1%{?dist}
License: GPL-2.0-or-later
URL: https://gitlab.com/setroubleshoot/setroubleshoot
Source0: https://gitlab.com/setroubleshoot/setroubleshoot/-/archive/%{version}/setroubleshoot-%{version}.tar.gz
@ -14,6 +16,7 @@ Source2: %{name}.sysusers
# i=1; for j in 00*patch; do printf "Patch%04d: %s\n" $i $j; i=$((i+1));done
Patch0001: 0001-gitlab-ci-fix-Fedora-and-Debian-build-requirements.patch
Patch0002: 0002-data-update-app-icon.patch
Patch0003: 0003-disable-bug-reporting-if-libreport-is-not-available.patch
BuildRequires: gcc
BuildRequires: make
BuildRequires: libcap-ng-devel
@ -26,7 +29,9 @@ BuildRequires: systemd-rpm-macros
BuildRequires: git-core
Requires: %{name}-server = %{version}-%{release}
Requires: gtk3, libnotify
%if %{with libreport}
Requires: libreport-gtk >= 2.2.1-2, python3-libreport
%endif
Requires: python3-gobject, python3-dasbus
Requires(post): desktop-file-utils
Requires(post): dbus
@ -194,6 +199,10 @@ to user preference. The same tools can be run on existing log files.
%doc AUTHORS COPYING ChangeLog DBUS.md NEWS README TODO
%changelog
* Wed Aug 21 2024 Michal Srb <michal@redhat.com> - 3.3.33-4.1
- Disable bug reporting, if libreport is not available
- Resolves: RHEL-52902
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 3.3.33-3.1
- Bump release for June 2024 mass rebuild