reporter-bugzilla should have an option forcing the reporter to create a
summary text from the reason field instead of magicall creation of a
summary text according to used analyzer.

Signed-off-by: Jakub Filak <[email protected]>
---
 src/plugins/bugzilla_event.conf |    2 +-
 src/plugins/reporter-bugzilla.c |   21 ++++++++++++++-------
 src/plugins/rhbz.c              |    4 ++--
 src/plugins/rhbz.h              |    3 ++-
 4 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/plugins/bugzilla_event.conf b/src/plugins/bugzilla_event.conf
index 109c581..dd3fdec 100644
--- a/src/plugins/bugzilla_event.conf
+++ b/src/plugins/bugzilla_event.conf
@@ -1 +1 @@
-EVENT=report_Bugzilla analyzer=libreport reporter-bugzilla -b
+EVENT=report_Bugzilla analyzer=libreport reporter-bugzilla -b -p
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
index bb59ac7..af500b4 100644
--- a/src/plugins/reporter-bugzilla.c
+++ b/src/plugins/reporter-bugzilla.c
@@ -61,7 +61,7 @@ int main(int argc, char **argv)
     /* Can't keep these strings/structs static: _() doesn't support that */
     const char *program_usage_string = _(
         "\n"
-        "& [-vbf] [-c CONFFILE] -d DIR\n"
+        "& [-vbfp] [-c CONFFILE] -d DIR\n"
         "or:\n"
         "& [-v] [-c CONFFILE] [-d DIR] -t[ID] FILE...\n"
         "\n"
@@ -72,7 +72,9 @@ int main(int argc, char **argv)
         "\n"
         "If such bug is not found, then a new bug is created. Elements of 
DIR\n"
         "are stored in the bug as part of bug description or as attachments,\n"
-        "depending on their type and size.\n"
+        "depending on their type and size. Option -p forces reporter to 
create\n"
+        "bug summary without special decorations which are usually used for\n"
+        "filtering of bugs.\n"
         "\n"
         "Otherwise, if such bug is found and it is marked as CLOSED 
DUPLICATE,\n"
         "the tool follows the chain of duplicates until it finds a 
non-DUPLICATE bug.\n"
@@ -101,6 +103,8 @@ int main(int argc, char **argv)
         OPT_t = 1 << 3,
         OPT_b = 1 << 4,
         OPT_f = 1 << 5,
+        OPT_h = 1 << 6,
+        OPT_p = 1 << 7,
     };
 
     char *ticket_no = NULL, *abrt_hash = NULL;
@@ -113,6 +117,7 @@ int main(int argc, char **argv)
         OPT_BOOL(     'b', NULL, NULL,                   _("When creating bug, 
attach binary files too")),
         OPT_BOOL(     'f', NULL, NULL,                   _("Force reporting 
even if this problem is already reported")),
         OPT_STRING(   'h', "duphash", &abrt_hash, "DUPHASH", _("Find BUG-ID 
according to DUPHASH")),
+        OPT_BOOL(     'p', "plain-summary", NULL,        _("When creating bug, 
create summary without decorations")),
         OPT_END()
     };
     unsigned opts = parse_opts(argc, argv, program_options, 
program_usage_string);
@@ -338,17 +343,19 @@ int main(int argc, char **argv)
 
         if (all_bugs_size == 0)
         {
+            int flags = RHBZ_NOMAIL_NOTIFY;
+            if (opts & OPT_b)
+                flags |= RHBZ_ATTACH_BINARY_FILES;
+            if (opts & OPT_p)
+                flags |= RHBZ_PLAIN_SUMMARY;
+
             /* Create new bug */
             log(_("Creating a new bug"));
-            int bug_id = rhbz_new_bug(client, problem_data, rhbz.b_release);
+            int bug_id = rhbz_new_bug(client, problem_data, rhbz.b_release, 
flags);
 
             log(_("Adding attachments to bug %i"), bug_id);
             char bug_id_str[sizeof(int)*3 + 2];
             snprintf(bug_id_str, sizeof(bug_id_str), "%i", bug_id);
-
-            int flags = RHBZ_NOMAIL_NOTIFY;
-            if (opts & OPT_b)
-                flags |= RHBZ_ATTACH_BINARY_FILES;
             rhbz_attach_files(client, bug_id_str, problem_data, flags);
 
             bz = new_bug_info();
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
index 579655b..5df943d 100644
--- a/src/plugins/rhbz.c
+++ b/src/plugins/rhbz.c
@@ -596,7 +596,7 @@ char *rhbz_get_backtrace_info(problem_data_t *problem_data, 
size_t max_text_size
 
 /* suppress mail notify by {s:i} (nomail:1) (driven by flag) */
 int rhbz_new_bug(struct abrt_xmlrpc *ax, problem_data_t *problem_data,
-                 const char *release)
+                 const char *release, int flags)
 {
     func_entry();
 
@@ -628,7 +628,7 @@ int rhbz_new_bug(struct abrt_xmlrpc *ax, problem_data_t 
*problem_data,
                                                                 
FILENAME_TAINTED_SHORT);
 
     struct strbuf *buf_summary = strbuf_new();
-    if (analyzer && strcmp(analyzer, "libreport") == 0)
+    if (flags & RHBZ_PLAIN_SUMMARY)
     {
         strbuf_append_str(buf_summary, reason);
     }
diff --git a/src/plugins/rhbz.h b/src/plugins/rhbz.h
index 84e0ba0..6b398f2 100644
--- a/src/plugins/rhbz.h
+++ b/src/plugins/rhbz.h
@@ -39,6 +39,7 @@ enum {
     RHBZ_NOMAIL_NOTIFY  = (1 << 3),
     RHBZ_PRIVATE        = (1 << 4),
     RHBZ_ATTACH_BINARY_FILES = (1 << 5),
+    RHBZ_PLAIN_SUMMARY  = (1 << 6),
 };
 
 #define IS_MANDATORY(flags) ((flags) & RHBZ_MANDATORY_MEMB)
@@ -102,7 +103,7 @@ int rhbz_array_size(xmlrpc_value *xml);
 int rhbz_bug_id(xmlrpc_value *xml, size_t ver);
 
 int rhbz_new_bug(struct abrt_xmlrpc *ax, problem_data_t *problem_data,
-                 const char *release);
+                 const char *release, int flags);
 
 int rhbz_attach_big_files(struct abrt_xmlrpc *ax, const char *bug_id,
                      problem_data_t *problem_data, int flags);
-- 
1.7.10.2

Reply via email to