applet: show package, c-n: skip non-interactive

This commit is contained in:
Jakub Filak 2014-10-13 10:50:41 +02:00
parent ceaa3bf1ae
commit a355adb48f
4 changed files with 154 additions and 1 deletions

View File

@ -0,0 +1,85 @@
From 9ef1d95f9556db4fdf02b283e1602b9e63b693c8 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 9 Oct 2014 10:24:42 +0200
Subject: [PATCH 07/13] ureport: attach contact email if configured
Related to rhbz#1150389
Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/plugins/abrt-action-ureport | 35 ++++++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
diff --git a/src/plugins/abrt-action-ureport b/src/plugins/abrt-action-ureport
index 1abe7b3..df5f3d3 100755
--- a/src/plugins/abrt-action-ureport
+++ b/src/plugins/abrt-action-ureport
@@ -8,6 +8,7 @@
import sys
import os
import getopt
+import augeas
from report import dd_opendir, DD_FAIL_QUIETLY_ENOENT, run_event_state
from reportclient import set_verbosity, error_msg_and_die, error_msg, log1, log
@@ -33,12 +34,30 @@ def init_gettext():
gettext.textdomain(GETTEXT_PROGNAME)
-def spawn_and_wait(prog):
+def get_augeas(module, file_path):
+ """
+ A function for efficient configuration of Augeas.
+ Augeas modules are placed in /usr/share/augeas/lenses/dist
+ """
+
+ aug_obj = augeas.Augeas(flags=augeas.Augeas.NO_MODL_AUTOLOAD)
+ aug_obj.set("/augeas/load/{0}/lens".format(module), "{0}.lns".format(module))
+ aug_obj.set("/augeas/load/{0}/incl".format(module), file_path)
+ aug_obj.load()
+ return aug_obj
+
+
+def spawn_and_wait(prog, args=None):
+ if args is None:
+ args = [prog]
+ else:
+ args.insert(0, prog)
+
try:
- return os.spawnlp(os.P_WAIT, prog, prog)
+ return os.spawnvpe(os.P_WAIT, prog, args, os.environ)
except OSError as err:
error_msg(_("Unable to start '%s', error message was: '%s'"),
- prog, err)
+ " ".join(args), err)
return -1
def try_parse_number(dd, filename):
@@ -92,6 +111,7 @@ if __name__ == "__main__":
verbose += 1
set_verbosity(verbose)
+ os.environ["ABRT_VERBOSE"] = str(verbose)
# getcwd might fail if cwd was deleted
try:
@@ -159,6 +179,15 @@ if __name__ == "__main__":
log(_("Adding you to CC List of the existing bugzilla bug"))
run_event("watch_Bugzilla", dirname)
+ email = os.getenv("uReport_ContactEmail")
+ if not email:
+ augeas = get_augeas("libreport", "/etc/libreport/plugins/ureport.conf")
+ email = augeas.get("/files/etc/libreport/plugins/ureport.conf/ContactEmail")
+
+ if email:
+ log1("Attaching ContactEmail: " + email)
+ spawn_and_wait("reporter-ureport", ["-A", "-E"])
+
sys.exit(exitcode)
else:
error_msg_and_die(_("reporter-ureport failed with exit code %d" % exitcode))
--
2.1.0

View File

@ -0,0 +1,28 @@
From ad9e9d1609fd9e1365bf558f15c62ecb21304911 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 10 Oct 2014 11:18:51 +0200
Subject: [PATCH 08/13] applet: don't show duphash instead of component
Related to rhbz#1084031
Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/applet/applet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/applet/applet.c b/src/applet/applet.c
index 0ae8c72..90c5b0d 100644
--- a/src/applet/applet.c
+++ b/src/applet/applet.c
@@ -1331,7 +1331,7 @@ static void Crash(DBusMessage* signal)
if (duphash != NULL && duphash[0] != '\0')
problem_data_add_text_noteditable(pi->problem_data, FILENAME_DUPHASH, duphash);
if (package_name != NULL && package_name[0] != '\0')
- problem_data_add_text_noteditable(pi->problem_data, FILENAME_COMPONENT, duphash);
+ problem_data_add_text_noteditable(pi->problem_data, FILENAME_COMPONENT, package_name);
pi->foreign = foreign_problem;
show_problem_notification(pi, flags);
}
--
2.1.0

View File

@ -0,0 +1,30 @@
From ab46bc9d85331fca923853353663c0ce0edc3716 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Sat, 11 Oct 2014 00:05:07 +0200
Subject: [PATCH 10/13] console-notifications: skip non-interactive shells
Related to rhbz#1141485
Related to rhbz#1139001
Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/cli/abrt-console-notification.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/cli/abrt-console-notification.sh b/src/cli/abrt-console-notification.sh
index 38de7bb..976dfc3 100755
--- a/src/cli/abrt-console-notification.sh
+++ b/src/cli/abrt-console-notification.sh
@@ -3,6 +3,9 @@
# terminal.
tty -s || return 0
+# Skip all for noninteractive shells for the same reason as above.
+[ -z "$PS1" ] && return 0
+
# If $HOME is not set, a non human user is logging in to shell but this script
# should provide information to human users, therefore returning immediately
# without showing the notification.
--
2.1.0

View File

@ -46,7 +46,7 @@
Summary: Automatic bug detection and reporting tool
Name: abrt
Version: 2.3.0
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv2+
Group: Applications/System
URL: https://fedorahosted.org/abrt/
@ -60,6 +60,12 @@ Patch0002: 0002-Translation-updates.patch
#Patch0004: 0004-testsuite-added-test-for-ureport-with-Authentication.patch
#Patch0005: 0005-testsuite-added-test-for-ureport-authorization-throu.patch
Patch0006: 0006-console-notifications-use-return-instead-of-exit.patch
Patch0007: 0007-ureport-attach-contact-email-if-configured.patch
Patch0008: 0008-applet-don-t-show-duphash-instead-of-component.patch
#Patch0009: 0009-testsuite-console-notifications.patch
Patch0010: 0010-console-notifications-skip-non-interactive-shells.patch
#Patch0011: 0011-testsuite-run-console-notification-tests-in-screen.patch
#Patch0012: 0012-testsuite-add-console-notification-on-the-rhel7-list.patch
# '%%autosetup -S git' -> git
BuildRequires: git
@ -970,6 +976,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%config(noreplace) %{_sysconfdir}/profile.d/abrt-console-notification.sh
%changelog
* Mon Oct 13 2014 Jakub Filak <jfilak@redhat.com> - 2.3.0-3
- applet: show package instead of duphash
- console-notifications: skip non-interactive shells
* Thu Oct 09 2014 Jakub Filak <jfilak@redhat.com> - 2.3.0-2
- console-notifications: use return instead of exit