Blob Blame History Raw
From 93c1aeb02086cfe5dbf6f9201956a7ab5fc1f631 Mon Sep 17 00:00:00 2001
Message-Id: <93c1aeb02086cfe5dbf6f9201956a7ab5fc1f631.1324378958.git.npajkovs@redhat.com>
From: Jiri Moskovcak <jmoskovc@redhat.com>
Date: Fri, 9 Dec 2011 14:28:54 +0100
Subject: [PATCH] rhbz: add the architecture to the comment only if it differs
 from initial comment rhbz#711591

---
 src/plugins/reporter-bugzilla.c |   10 +++++++++-
 src/plugins/rhbz.c              |    2 ++
 src/plugins/rhbz.h              |    1 +
 3 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
index d057114..d27e804 100644
--- a/src/plugins/reporter-bugzilla.c
+++ b/src/plugins/reporter-bugzilla.c
@@ -394,7 +394,15 @@ int main(int argc, char **argv)
             strbuf_append_strf(full_desc, "%s\n\n", comment);
             strbuf_append_strf(full_desc, "rating: %s\n", rating_str);
             strbuf_append_strf(full_desc, "Package: %s\n", package);
-            strbuf_append_strf(full_desc, "Architecture: %s\n", arch);
+            /* attach the architecture only if it's different from the initial report */
+            if ((strcmp(bz->bi_platform, "All") != 0) &&
+                (strcmp(bz->bi_platform, "Unspecified") != 0) &&
+                (strcmp(bz->bi_platform, arch) !=0))
+                strbuf_append_strf(full_desc, "Architecture: %s\n", arch);
+            else
+            {
+                VERB3 log("not adding the arch: %s because rep_plat is %s", arch, bz->bi_platform);
+            }
             strbuf_append_strf(full_desc, "OS Release: %s\n", release);
 
             /* unused code, enable it when gui/cli will be ready
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
index 4c3c91f..704b5dc 100644
--- a/src/plugins/rhbz.c
+++ b/src/plugins/rhbz.c
@@ -352,6 +352,8 @@ struct bug_info *rhbz_bug_info(struct abrt_xmlrpc *ax, int bug_id)
                                        RHBZ_MANDATORY_MEMB | RHBZ_READ_STR);
     bz->bi_resolution = rhbz_bug_read_item("resolution", xml_bug_response,
                                            RHBZ_READ_STR);
+    bz->bi_platform = rhbz_bug_read_item("rep_platform", xml_bug_response,
+                                           RHBZ_READ_STR);
 
     if (strcmp(bz->bi_status, "CLOSED") == 0 && !bz->bi_resolution)
         error_msg_and_die(_("Bug %i is CLOSED, but it has no RESOLUTION"), bz->bi_id);
diff --git a/src/plugins/rhbz.h b/src/plugins/rhbz.h
index 141db7d..4b39dc3 100644
--- a/src/plugins/rhbz.h
+++ b/src/plugins/rhbz.h
@@ -54,6 +54,7 @@ struct bug_info {
     char *bi_resolution;
     char *bi_reporter;
     char *bi_product;
+    char *bi_platform;
 
     GList *bi_cc_list;
     GList *bi_comments;
-- 
1.7.8