102 lines
4.0 KiB
Diff
102 lines
4.0 KiB
Diff
|
From 8bf23a12caac293637060b09f733f57f839a4a71 Mon Sep 17 00:00:00 2001
|
||
|
From: Nikola Pajkovsky <npajkovs@redhat.com>
|
||
|
Date: Wed, 30 Nov 2011 19:18:20 +0100
|
||
|
Subject: [PATCH 3/6] search only by duphash for selinux
|
||
|
|
||
|
selinux guy's almost always move filled bug from component selinux-policy
|
||
|
to right component.
|
||
|
|
||
|
bugzilla client is looking for duplicate bug by sending xmlrpc query
|
||
|
|
||
|
"ALL whiteboard:<hash> component:<name> [product:<product>]"
|
||
|
|
||
|
so if bug is moved from component selinux-policy to other, then query
|
||
|
returns NULL and creates a new bug.
|
||
|
|
||
|
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
|
||
|
---
|
||
|
src/plugins/reporter-bugzilla.c | 25 ++++++++++++++++++-------
|
||
|
src/plugins/rhbz.c | 21 ++++++++++++---------
|
||
|
2 files changed, 30 insertions(+), 16 deletions(-)
|
||
|
|
||
|
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
|
||
|
index 4739c2e..b6356f9 100644
|
||
|
--- a/src/plugins/reporter-bugzilla.c
|
||
|
+++ b/src/plugins/reporter-bugzilla.c
|
||
|
@@ -280,11 +280,22 @@ int main(int argc, char **argv)
|
||
|
free(version);
|
||
|
|
||
|
log(_("Checking for duplicates"));
|
||
|
- xmlrpc_value *result;
|
||
|
- if (strcmp(product, "Fedora") == 0)
|
||
|
- result = rhbz_search_duphash(client, component, product, duphash);
|
||
|
- else
|
||
|
- result = rhbz_search_duphash(client, component, NULL, duphash);
|
||
|
+
|
||
|
+ /*
|
||
|
+ selinux guy's almost always move filled bug from component selinux-policy
|
||
|
+ to right component.
|
||
|
+
|
||
|
+ bugzilla client is looking for duplicate bug by sending xmlrpc query
|
||
|
+
|
||
|
+ "ALL whiteboard:<hash> component:<name> [product:<product>]"
|
||
|
+
|
||
|
+ so if bug is moved from component selinux-policy to other, then query
|
||
|
+ returns NULL and creates a new bug.
|
||
|
+ */
|
||
|
+ const char *product_substitute = (!strcmp(product, "Fedora")) ? product : NULL;
|
||
|
+ const char *component_substitute = (!strcmp(component, "selinux-policy")) ? NULL : component;
|
||
|
+ xmlrpc_value *result = rhbz_search_duphash(client, component_substitute,
|
||
|
+ product_substitute, duphash);
|
||
|
|
||
|
xmlrpc_value *all_bugs = rhbz_get_member("bugs", result);
|
||
|
xmlrpc_DECREF(result);
|
||
|
@@ -310,8 +321,8 @@ int main(int argc, char **argv)
|
||
|
/* found something, but its a different product */
|
||
|
free_bug_info(bz);
|
||
|
|
||
|
- xmlrpc_value *result = rhbz_search_duphash(client, component,
|
||
|
- product, duphash);
|
||
|
+ xmlrpc_value *result = rhbz_search_duphash(client, component_substitute,
|
||
|
+ product_substitute, duphash);
|
||
|
xmlrpc_value *all_bugs = rhbz_get_member("bugs", result);
|
||
|
xmlrpc_DECREF(result);
|
||
|
|
||
|
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
|
||
|
index 6b71202..3662816 100644
|
||
|
--- a/src/plugins/rhbz.c
|
||
|
+++ b/src/plugins/rhbz.c
|
||
|
@@ -116,17 +116,20 @@ void rhbz_login(struct abrt_xmlrpc *ax, const char* login, const char* passwd)
|
||
|
xmlrpc_value *rhbz_search_duphash(struct abrt_xmlrpc *ax, const char *component,
|
||
|
const char *product, const char *duphash)
|
||
|
{
|
||
|
- char *query = NULL;
|
||
|
- if (!product)
|
||
|
- query = xasprintf("ALL component:\"%s\" whiteboard:\"%s\"", component, duphash);
|
||
|
- else
|
||
|
- query = xasprintf("ALL component:\"%s\" whiteboard:\"%s\" product:\"%s\"",
|
||
|
- component, duphash, product);
|
||
|
+ struct strbuf *query = strbuf_new();
|
||
|
+ strbuf_append_strf(query, "ALL whiteboard:\"%s\"", duphash);
|
||
|
+
|
||
|
+ if (product)
|
||
|
+ strbuf_append_strf(query, " product:\"%s\"", product);
|
||
|
|
||
|
- VERB3 log("search for '%s'", query);
|
||
|
+ if (component)
|
||
|
+ strbuf_append_strf(query, " component:\"%s\"", component);
|
||
|
+
|
||
|
+ VERB3 log("search for '%s'", query->buf);
|
||
|
xmlrpc_value *ret = abrt_xmlrpc_call(ax, "Bug.search", "({s:s})",
|
||
|
- "quicksearch", query);
|
||
|
- free(query);
|
||
|
+ "quicksearch", query->buf);
|
||
|
+ strbuf_free(query);
|
||
|
+
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
--
|
||
|
1.7.7.3
|
||
|
|