- related to trac#763, trac#768

Signed-off-by: Jakub Filak <[email protected]>
---
 abrt.spec.in                    |  1 +
 src/plugins/Makefile.am         |  4 +++-
 src/plugins/abrt-action-ureport | 23 +++++++++++++++++++++++
 src/plugins/ccpp_event.conf     |  2 +-
 src/plugins/koops_event.conf    |  2 +-
 src/plugins/python_event.conf   |  2 +-
 6 files changed, 30 insertions(+), 4 deletions(-)
 create mode 100644 src/plugins/abrt-action-ureport

diff --git a/abrt.spec.in b/abrt.spec.in
index 678ad43..aaac4e3 100644
--- a/abrt.spec.in
+++ b/abrt.spec.in
@@ -466,6 +466,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null 
|| :
 %{_sbindir}/abrtd
 %{_sbindir}/abrt-server
 %{_libexecdir}/abrt-handle-event
+%{_libexecdir}/abrt-action-ureport
 %{_bindir}/abrt-handle-upload
 %{_bindir}/abrt-action-save-package-data
 %{_bindir}/abrt-watch-log
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index 3664584..9705b93 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -26,6 +26,8 @@ bin_PROGRAMS = \
 
 libexec_PROGRAMS = abrt-action-install-debuginfo-to-abrt-cache
 
+libexec_SCRIPTS = abrt-action-ureport
+
 #dist_pluginsconf_DATA = Python.conf
 
 eventsdir = $(EVENTS_DIR)
@@ -80,6 +82,7 @@ EXTRA_DIST = \
     abrt-action-analyze-vmcore \
     abrt-action-analyze-xorg \
     abrt-action-save-kernel-data \
+    abrt-action-ureport \
     https-utils.h \
     post_report.xml.in
 
@@ -279,7 +282,6 @@ abrt_bodhi_SOURCES = \
 
 DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
 
-
 abrt-action-perform-ccpp-analysis: abrt-action-perform-ccpp-analysis.in
        sed -e s,\@libexecdir\@,$(libexecdir),g \
         $< >$@
diff --git a/src/plugins/abrt-action-ureport b/src/plugins/abrt-action-ureport
new file mode 100644
index 0000000..796126a
--- /dev/null
+++ b/src/plugins/abrt-action-ureport
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# This script wraps reporter-ureport client and keeps number of sent
+# uReports to a server consistent with number of problem ocurrences.
+#
+# FAF server returns a BTHASH which is used as global identifier of problem.
+# reporter-ureport stores received BTHASH value in reported_to element under
+# uReport key. Therefore, if reported_to element contains uReport key,
+# reporter-ureport won't be run again.
+#
+# TODO: this implementation allows caller to report a problem only once
+
+if test -f reported_to && cat reported_to | grep -q "BTHASH"
+then
+
+    test -n "$ABRT_VERBOSE" && test $ABRT_VERBOSE -ge 1 && {
+        echo "Problem has been already reported: '`pwd`'"
+    }
+
+    exit 0
+fi
+
+reporter-ureport
diff --git a/src/plugins/ccpp_event.conf b/src/plugins/ccpp_event.conf
index a04974c..4deff99 100644
--- a/src/plugins/ccpp_event.conf
+++ b/src/plugins/ccpp_event.conf
@@ -73,7 +73,7 @@ EVENT=report_Bugzilla analyzer=CCpp duphash!=
 
 # Send micro report
 EVENT=report_uReport analyzer=CCpp
-        reporter-ureport
+        /usr/libexec/abrt-action-ureport
 
 # update ABRT database after successful report to bugzilla
 EVENT=post_report analyzer=CCpp
diff --git a/src/plugins/koops_event.conf b/src/plugins/koops_event.conf
index 070c563..4ae5cd2 100644
--- a/src/plugins/koops_event.conf
+++ b/src/plugins/koops_event.conf
@@ -23,7 +23,7 @@ EVENT=report_Bugzilla analyzer=Kerneloops
 
 # Send micro report
 EVENT=report_uReport analyzer=Kerneloops
-        reporter-ureport
+        /usr/libexec/abrt-action-ureport
 
 # Update ABRT database after successful report to bugzilla
 EVENT=post_report analyzer=Kerneloops
diff --git a/src/plugins/python_event.conf b/src/plugins/python_event.conf
index a785718..90b3a7f 100644
--- a/src/plugins/python_event.conf
+++ b/src/plugins/python_event.conf
@@ -18,7 +18,7 @@ EVENT=report_Bugzilla analyzer=Python
 
 # Send micro report
 EVENT=report_uReport analyzer=Python
-        reporter-ureport
+        /usr/libexec/abrt-action-ureport
 
 # update ABRT database after successful report to bugzilla
 EVENT=post_report analyzer=Python
-- 
1.7.11.7

Reply via email to