removed unused patches

This commit is contained in:
Jiri Moskovcak 2012-05-14 18:44:21 +02:00
parent bf66b44453
commit 6f6ace37ad
11 changed files with 0 additions and 798 deletions

View File

@ -1,90 +0,0 @@
From b26c6d5a3b9aff0933fb9abd393fd3c5f3b6cd02 Mon Sep 17 00:00:00 2001
From: Nikola Pajkovsky <npajkovs@redhat.com>
Date: Mon, 5 Dec 2011 18:48:17 +0100
Subject: [PATCH 1/6] allow to specify bodh url and fix one NULL dereferencing
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
---
src/include/internal_libreport.h | 2 +-
src/plugins/abrt-bodhi.c | 20 ++++++++++++++++----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/include/internal_libreport.h b/src/include/internal_libreport.h
index 4c50a26..c153aaa 100644
--- a/src/include/internal_libreport.h
+++ b/src/include/internal_libreport.h
@@ -715,7 +715,7 @@ struct options {
#define OPT_LIST( s, l, v, a, h) { OPTION_LIST , (s), (l), (v), (a) , (h) }
#define OPT__VERBOSE(v) OPT_BOOL('v', "verbose", (v), _("Be verbose"))
-#define OPT__DUMP_DIR(v) OPT_STRING('d', "dump-dir", (v), "DIR", _("Dump directory"))
+#define OPT__DUMP_DIR(v) OPT_STRING('d', "problem-dir", (v), "DIR", _("Problem directory"))
#define parse_opts libreport_parse_opts
unsigned parse_opts(int argc, char **argv, const struct options *opt,
diff --git a/src/plugins/abrt-bodhi.c b/src/plugins/abrt-bodhi.c
index 28aa439..3495c24 100644
--- a/src/plugins/abrt-bodhi.c
+++ b/src/plugins/abrt-bodhi.c
@@ -110,7 +110,7 @@
}
*/
-static const char *const bodhi_url = "https://admin.fedoraproject.org/updates/%s";
+static const char *bodhi_url = "https://admin.fedoraproject.org/updates/";
struct bodhi {
char *nvr;
@@ -288,10 +288,10 @@ static GHashTable *bodhi_parse_json(json_object *json, const char *release)
static GHashTable *bodhi_query_list(const char *query, const char *release)
{
- char *bodhi_url_bugs = xasprintf(bodhi_url, "list");
+ char *bodhi_url_bugs = xasprintf("%s/list", bodhi_url);
abrt_post_state_t *post_state = new_abrt_post_state(
- ABRT_POST_WANT_BODY|ABRT_POST_WANT_SSL_VERIFY);
+ ABRT_POST_WANT_BODY | ABRT_POST_WANT_SSL_VERIFY | ABRT_POST_WANT_ERROR_MSG);
const char *headers[] = {
"Accept: application/json",
@@ -301,6 +301,13 @@ static GHashTable *bodhi_query_list(const char *query, const char *release)
log(_("Searching for updates"));
abrt_post_string(post_state, bodhi_url_bugs, "application/x-www-form-urlencoded",
headers, query);
+
+ if (post_state->http_resp_code != 200)
+ {
+ char *errmsg = post_state->curl_error_msg;
+ if (errmsg && errmsg[0])
+ error_msg_and_die("%s '%s'", errmsg, bodhi_url_bugs);
+ }
free(bodhi_url_bugs);
// log("%s", post_state->body);
@@ -357,9 +364,11 @@ int main(int argc, char **argv)
/* Keep enum above and order of options below in sync! */
struct options program_options[] = {
OPT__VERBOSE(&g_verbose),
+ OPT__DUMP_DIR(&dump_dir_path),
+ OPT_GROUP(""),
OPT_STRING('b', "bugs", &bugs, "ID1[,ID2,...]" , _("List of bug ids")),
+ OPT_STRING('u', "url", &bodhi_url, "URL", _("Specify a bodhi server url")),
OPT_OPTSTRING('r', "release", &release, "RELEASE", _("Specify a release")),
- OPT__DUMP_DIR(&dump_dir_path),
OPT_END()
};
@@ -387,6 +396,9 @@ int main(int argc, char **argv)
else
{
struct dump_dir *dd = dd_opendir(dump_dir_path, DD_OPEN_READONLY);
+ if (!dd)
+ xfunc_die();
+
problem_data_t *problem_data = create_problem_data_from_dump_dir(dd);
dd_close(dd);
if (!problem_data)
--
1.7.7.3

View File

@ -1,56 +0,0 @@
From e93f6cb75fe3ad7991deff0696538c93ee04cc7a Mon Sep 17 00:00:00 2001
Message-Id: <e93f6cb75fe3ad7991deff0696538c93ee04cc7a.1324377641.git.npajkovs@redhat.com>
From: Nikola Pajkovsky <npajkovs@redhat.com>
Date: Mon, 19 Dec 2011 19:09:28 +0100
Subject: [PATCH] rhbz#768647 - python doen't have a backtrace_rating file
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
---
src/plugins/reporter-bugzilla.c | 10 ++++++++--
src/plugins/rhbz.c | 2 +-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
index d27e804..4dd9ec2 100644
--- a/src/plugins/reporter-bugzilla.c
+++ b/src/plugins/reporter-bugzilla.c
@@ -392,7 +392,10 @@ int main(int argc, char **argv)
struct strbuf *full_desc = strbuf_new();
strbuf_append_strf(full_desc, "%s\n\n", comment);
- strbuf_append_strf(full_desc, "rating: %s\n", rating_str);
+
+ /* python doesn't have rating file */
+ if (rating_str)
+ strbuf_append_strf(full_desc, "%s: %s\n", FILENAME_RATING, rating_str);
strbuf_append_strf(full_desc, "Package: %s\n", package);
/* attach the architecture only if it's different from the initial report */
if ((strcmp(bz->bi_platform, "All") != 0) &&
@@ -423,7 +426,10 @@ int main(int argc, char **argv)
}
strbuf_free(full_desc);
- unsigned rating = xatou(rating_str);
+ unsigned rating = 0;
+ /* python doesn't have rating file */
+ if (rating_str)
+ rating = xatou(rating_str);
if (!allow_comment && (bz->bi_best_bt_rating < rating))
{
char bug_id_str[sizeof(int)*3 + 2];
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
index 704b5dc..592fbae 100644
--- a/src/plugins/rhbz.c
+++ b/src/plugins/rhbz.c
@@ -115,7 +115,7 @@ static unsigned find_best_bt_rating_in_comments(GList *comments)
{
char *comment_body = (char *) l->data;
- char *start_rating_line = strstr(comment_body, "rating: ");
+ char *start_rating_line = strstr(comment_body, FILENAME_RATING": ");
if (!start_rating_line)
{
VERB3 error_msg("comment does not contain rating");
--
1.7.8

View File

@ -1,62 +0,0 @@
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

View File

@ -1,151 +0,0 @@
From 480d39f86254f6088e53b69520b7354fa992b594 Mon Sep 17 00:00:00 2001
From: Nikola Pajkovsky <npajkovs@redhat.com>
Date: Tue, 29 Nov 2011 15:25:59 +0100
Subject: [PATCH 2/6] if better backtrace is avail, then upload one
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
---
src/plugins/reporter-bugzilla.c | 17 ++++++++++-
src/plugins/rhbz.c | 62 +++++++++++++++++++++++++++++++++++----
src/plugins/rhbz.h | 1 +
3 files changed, 73 insertions(+), 7 deletions(-)
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
index 4046b24..4739c2e 100644
--- a/src/plugins/reporter-bugzilla.c
+++ b/src/plugins/reporter-bugzilla.c
@@ -377,14 +377,16 @@ int main(int argc, char **argv)
{
const char *package = get_problem_item_content_or_NULL(problem_data, FILENAME_PACKAGE);
const char *arch = get_problem_item_content_or_NULL(problem_data, FILENAME_ARCHITECTURE);
+ const char *rating_str = get_problem_item_content_or_NULL(problem_data, FILENAME_RATING);
char *full_dsc = xasprintf("Package: %s\n"
"Architecture: %s\n"
"OS Release: %s\n"
+ "rating: %s\n"
"\n"
"Comment\n"
"-----\n"
"%s\n",
- package, arch, release, comment
+ package, arch, release, rating_str, comment
);
log(_("Adding new comment to bug %d"), bz->bi_id);
/* unused code, enable it when gui/cli will be ready
@@ -394,6 +396,19 @@ int main(int argc, char **argv)
*/
rhbz_add_comment(client, bz->bi_id, full_dsc, 0);
free(full_dsc);
+
+ unsigned rating = xatou(rating_str);
+ if (bz->bi_best_bt_rating < rating)
+ {
+ char bug_id_str[sizeof(int)*3 + 2];
+ sprintf(bug_id_str, "%i", bz->bi_id);
+
+ const char *bt = get_problem_item_content_or_NULL(problem_data,
+ FILENAME_BACKTRACE);
+ log(_("Attaching better backtrace"));
+ rhbz_attach_blob(client, FILENAME_BACKTRACE, bug_id_str, bt, strlen(bt),
+ RHBZ_NOMAIL_NOTIFY);
+ }
}
}
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
index 13957b8..6b71202 100644
--- a/src/plugins/rhbz.c
+++ b/src/plugins/rhbz.c
@@ -42,14 +42,62 @@ void free_bug_info(struct bug_info *bi)
list_free_with_free(bi->bi_cc_list);
- bi->bi_status = NULL;
- bi->bi_resolution = NULL;
- bi->bi_reporter = NULL;
- bi->bi_product = NULL;
+ free(bi);
+}
- bi->bi_cc_list = NULL;
+static unsigned find_best_bt_rating_in_comments(xmlrpc_value *result_xml)
+{
+ xmlrpc_value *comments_memb = rhbz_get_member("longdescs", result_xml);
+ if (!comments_memb)
+ return 0;
- free(bi);
+ int comments_memb_size = rhbz_array_size(comments_memb);
+
+ xmlrpc_env env;
+ xmlrpc_env_init(&env);
+ int best_bt_rating = 0;
+ for (int i = 0; i < comments_memb_size; ++i)
+ {
+ xmlrpc_value* item = NULL;
+ xmlrpc_array_read_item(&env, comments_memb, i, &item);
+ if (env.fault_occurred)
+ abrt_xmlrpc_die(&env);
+
+ char *comment_body = rhbz_bug_read_item("body", item, RHBZ_READ_STR);
+ /* attachments are sometimes without comments -- skip them */
+ if (!comment_body)
+ continue;
+
+ char *start_rating_line = strstr(comment_body, "rating: ");
+ if (!start_rating_line)
+ {
+ VERB3 error_msg("comment does not contain rating");
+ continue;
+ }
+
+ start_rating_line += strlen("rating: ");
+ char *end_rating_line = strchr(start_rating_line, '\n');
+ if (!end_rating_line)
+ VERB3 error_msg("broken comment body");
+
+ char *rating_srt = xstrndup(start_rating_line, end_rating_line - start_rating_line);
+ int old_errno = errno;
+ errno = 0;
+ char *e;
+ long rating = strtoul(rating_srt, &e, 10);
+ if (errno || rating_srt == e || *e != '\0' || rating > UINT_MAX)
+ {
+ /* error / no digits / illegal trailing chars */
+ errno = old_errno;
+ continue;
+ }
+ errno = old_errno; /* Ok. So restore errno. */
+
+ if (rating > best_bt_rating)
+ best_bt_rating = rating;
+ }
+
+ return best_bt_rating;
}
void rhbz_login(struct abrt_xmlrpc *ax, const char* login, const char* passwd)
@@ -273,6 +321,8 @@ struct bug_info *rhbz_bug_info(struct abrt_xmlrpc *ax, int bug_id)
bz->bi_cc_list = rhbz_bug_cc(xml_bug_response);
+ bz->bi_best_bt_rating = find_best_bt_rating_in_comments(xml_bug_response);
+
xmlrpc_DECREF(xml_bug_response);
return bz;
diff --git a/src/plugins/rhbz.h b/src/plugins/rhbz.h
index 864f603..9878dd7 100644
--- a/src/plugins/rhbz.h
+++ b/src/plugins/rhbz.h
@@ -48,6 +48,7 @@ enum {
struct bug_info {
int bi_id;
int bi_dup_id;
+ unsigned bi_best_bt_rating;
char *bi_status;
char *bi_resolution;
--
1.7.7.3

View File

@ -1,101 +0,0 @@
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

View File

@ -1,53 +0,0 @@
From 51a3918434aec04d057bf5a0d117214c9e6d9413 Mon Sep 17 00:00:00 2001
From: Nikola Pajkovsky <npajkovs@redhat.com>
Date: Wed, 30 Nov 2011 19:57:58 +0100
Subject: [PATCH 4/6] reorganize comments for bugzilla -- message body comes
first
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
---
src/plugins/reporter-bugzilla.c | 22 ++++++++++------------
1 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
index b6356f9..e150944 100644
--- a/src/plugins/reporter-bugzilla.c
+++ b/src/plugins/reporter-bugzilla.c
@@ -389,24 +389,22 @@ int main(int argc, char **argv)
const char *package = get_problem_item_content_or_NULL(problem_data, FILENAME_PACKAGE);
const char *arch = get_problem_item_content_or_NULL(problem_data, FILENAME_ARCHITECTURE);
const char *rating_str = get_problem_item_content_or_NULL(problem_data, FILENAME_RATING);
- char *full_dsc = xasprintf("Package: %s\n"
- "Architecture: %s\n"
- "OS Release: %s\n"
- "rating: %s\n"
- "\n"
- "Comment\n"
- "-----\n"
- "%s\n",
- package, arch, release, rating_str, comment
- );
+
+ struct strbuf *full_desc = strbuf_new();
+ 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);
+ strbuf_append_strf(full_desc, "OS Release: %s\n", release);
+
log(_("Adding new comment to bug %d"), bz->bi_id);
/* unused code, enable it when gui/cli will be ready
int is_priv = is_private && string_to_bool(is_private);
const char *is_private = get_problem_item_content_or_NULL(problem_data,
"is_private");
*/
- rhbz_add_comment(client, bz->bi_id, full_dsc, 0);
- free(full_dsc);
+ rhbz_add_comment(client, bz->bi_id, full_desc->buf, 0);
+ strbuf_free(full_desc);
unsigned rating = xatou(rating_str);
if (bz->bi_best_bt_rating < rating)
--
1.7.7.3

View File

@ -1,159 +0,0 @@
From 9786e890de57260d2975a605512147779383c137 Mon Sep 17 00:00:00 2001
From: Nikola Pajkovsky <npajkovs@redhat.com>
Date: Thu, 1 Dec 2011 14:48:48 +0100
Subject: [PATCH 5/6] do not insert duplicate comment to bugzilla
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
---
src/plugins/reporter-bugzilla.c | 11 +++++--
src/plugins/rhbz.c | 60 +++++++++++++++++++++++++++++++++++----
src/plugins/rhbz.h | 3 ++
3 files changed, 65 insertions(+), 9 deletions(-)
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
index e150944..9bdadba 100644
--- a/src/plugins/reporter-bugzilla.c
+++ b/src/plugins/reporter-bugzilla.c
@@ -397,17 +397,22 @@ int main(int argc, char **argv)
strbuf_append_strf(full_desc, "Architecture: %s\n", arch);
strbuf_append_strf(full_desc, "OS Release: %s\n", release);
- log(_("Adding new comment to bug %d"), bz->bi_id);
/* unused code, enable it when gui/cli will be ready
int is_priv = is_private && string_to_bool(is_private);
const char *is_private = get_problem_item_content_or_NULL(problem_data,
"is_private");
*/
- rhbz_add_comment(client, bz->bi_id, full_desc->buf, 0);
+
+ int allow_comment = is_comment_dup(bz->bi_comments, full_desc->buf);
+ if (!allow_comment)
+ {
+ log(_("Adding new comment to bug %d"), bz->bi_id);
+ rhbz_add_comment(client, bz->bi_id, full_desc->buf, 0);
+ }
strbuf_free(full_desc);
unsigned rating = xatou(rating_str);
- if (bz->bi_best_bt_rating < rating)
+ if (!allow_comment && (bz->bi_best_bt_rating < rating))
{
char bug_id_str[sizeof(int)*3 + 2];
sprintf(bug_id_str, "%i", bz->bi_id);
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
index 3662816..4c3c91f 100644
--- a/src/plugins/rhbz.c
+++ b/src/plugins/rhbz.c
@@ -45,17 +45,17 @@ void free_bug_info(struct bug_info *bi)
free(bi);
}
-static unsigned find_best_bt_rating_in_comments(xmlrpc_value *result_xml)
+static GList *parse_comments(xmlrpc_value *result_xml)
{
+ GList *comments = NULL;
xmlrpc_value *comments_memb = rhbz_get_member("longdescs", result_xml);
if (!comments_memb)
- return 0;
+ return NULL;
int comments_memb_size = rhbz_array_size(comments_memb);
xmlrpc_env env;
xmlrpc_env_init(&env);
- int best_bt_rating = 0;
for (int i = 0; i < comments_memb_size; ++i)
{
xmlrpc_value* item = NULL;
@@ -65,8 +65,55 @@ static unsigned find_best_bt_rating_in_comments(xmlrpc_value *result_xml)
char *comment_body = rhbz_bug_read_item("body", item, RHBZ_READ_STR);
/* attachments are sometimes without comments -- skip them */
- if (!comment_body)
- continue;
+ if (comment_body)
+ comments = g_list_prepend(comments, comment_body);
+ }
+
+ return g_list_reverse(comments);
+}
+
+static char *trim_all_whitespace(const char *str)
+{
+ char *trim = xzalloc(sizeof(char) * strlen(str) + 1);
+ int i = 0;
+ while (*str)
+ {
+ if (!isspace(*str))
+ trim[i++] = *str;
+ str++;
+ }
+
+ return trim;
+}
+
+int is_comment_dup(GList *comments, const char *comment)
+{
+ for (GList *l = comments; l; l = l->next)
+ {
+ char *comment_body = (char *) l->data;
+ char *trim_comment_body = trim_all_whitespace(comment_body);
+ char *trim_comment = trim_all_whitespace(comment);
+ if (!strcmp(trim_comment_body, trim_comment))
+ {
+ free(trim_comment_body);
+ free(trim_comment);
+ return 1;
+ }
+ }
+
+ return 0;;
+}
+
+static unsigned find_best_bt_rating_in_comments(GList *comments)
+{
+ if (!comments)
+ return 0;
+
+ int best_bt_rating = 0;
+
+ for (GList *l = comments; l; l = l->next)
+ {
+ char *comment_body = (char *) l->data;
char *start_rating_line = strstr(comment_body, "rating: ");
if (!start_rating_line)
@@ -324,7 +371,8 @@ struct bug_info *rhbz_bug_info(struct abrt_xmlrpc *ax, int bug_id)
bz->bi_cc_list = rhbz_bug_cc(xml_bug_response);
- bz->bi_best_bt_rating = find_best_bt_rating_in_comments(xml_bug_response);
+ bz->bi_comments = parse_comments(xml_bug_response);
+ bz->bi_best_bt_rating = find_best_bt_rating_in_comments(bz->bi_comments);
xmlrpc_DECREF(xml_bug_response);
diff --git a/src/plugins/rhbz.h b/src/plugins/rhbz.h
index 9878dd7..141db7d 100644
--- a/src/plugins/rhbz.h
+++ b/src/plugins/rhbz.h
@@ -56,6 +56,7 @@ struct bug_info {
char *bi_product;
GList *bi_cc_list;
+ GList *bi_comments;
};
struct bug_info *new_bug_info();
@@ -94,6 +95,8 @@ int rhbz_attach_blob(struct abrt_xmlrpc *ax, const char *filename,
int rhbz_attach_fd(struct abrt_xmlrpc *ax, const char *filename,
const char *bug_id, int fd, int flags);
+int is_comment_dup(GList *comments, const char *comment);
+
GList *rhbz_bug_cc(xmlrpc_value *result_xml);
struct bug_info *rhbz_bug_info(struct abrt_xmlrpc *ax, int bug_id);
--
1.7.7.3

View File

@ -1,27 +0,0 @@
From 7e9ef41bcb10d13d550d6f983c9872d9c1fe19d5 Mon Sep 17 00:00:00 2001
From: Nikola Pajkovsky <npajkovs@redhat.com>
Date: Wed, 7 Dec 2011 14:53:04 +0100
Subject: [PATCH 6/6] if OSRelease environ is empty, load OSRelease from
problem-dir
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
---
src/plugins/reporter-bugzilla.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
index 9bdadba..001cbd9 100644
--- a/src/plugins/reporter-bugzilla.c
+++ b/src/plugins/reporter-bugzilla.c
@@ -265,7 +265,7 @@ int main(int argc, char **argv)
const char *duphash = get_problem_item_content_or_NULL(problem_data, FILENAME_DUPHASH);
//COMPAT, remove after 2.1 release
if (!duphash) duphash = get_problem_item_content_or_die(problem_data, "global_uuid");
- if (!release) /* if not overridden... */
+ if (!release || !*release) /* if not overridden or empty... */
{
release = get_problem_item_content_or_NULL(problem_data, FILENAME_OS_RELEASE);
//COMPAT, remove in abrt-2.1
--
1.7.7.3

View File

@ -1,40 +0,0 @@
From ba84c2b51b2c14a5a97a575b9019d0057bf88782 Mon Sep 17 00:00:00 2001
From: Nikola Pajkovsky <npajkovs@redhat.com>
Date: Thu, 8 Dec 2011 16:53:40 +0100
Subject: [PATCH 09/11] bodhi: sync enum with parse_opt
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
---
src/plugins/abrt-bodhi.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/plugins/abrt-bodhi.c b/src/plugins/abrt-bodhi.c
index a2c1445..5416a0a 100644
--- a/src/plugins/abrt-bodhi.c
+++ b/src/plugins/abrt-bodhi.c
@@ -110,7 +110,7 @@
}
*/
-static const char *bodhi_url = "https://admin.fedoraproject.org/updates/";
+static const char *bodhi_url = "https://admin.fedoraproject.org/updates";
struct bodhi {
char *nvr;
@@ -356,8 +356,11 @@ int main(int argc, char **argv)
abrt_init(argv);
enum {
OPT_v = 1 << 0,
- OPT_b = 1 << 1,
- OPT_r = 1 << 2,
+ OPT_d = 1 << 1,
+ OPT_g = 1 << 2,
+ OPT_b = 1 << 3,
+ OPT_u = 1 << 4,
+ OPT_r = 1 << 5,
};
const char *bugs = NULL, *release = NULL, *dump_dir_path = ".";
--
1.7.7.3

View File

@ -1,29 +0,0 @@
From 0580662e90789a45f657b017fd0ae621d8ea4f6a Mon Sep 17 00:00:00 2001
From: Nikola Pajkovsky <npajkovs@redhat.com>
Date: Thu, 8 Dec 2011 17:15:02 +0100
Subject: [PATCH 10/11] inicializing rpm more then once leads to sigsegv in
rpmReadConfigFiles
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
---
src/plugins/abrt-bodhi.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/plugins/abrt-bodhi.c b/src/plugins/abrt-bodhi.c
index 5416a0a..11c6d02 100644
--- a/src/plugins/abrt-bodhi.c
+++ b/src/plugins/abrt-bodhi.c
@@ -348,6 +348,10 @@ error:
rpmdbFreeIterator(iter);
rpmtsFree(ts);
+ rpmFreeRpmrc();
+ rpmFreeCrypto();
+ rpmFreeMacros(NULL);
+
return nvr;
}
--
1.7.7.3

View File

@ -1,30 +0,0 @@
From 02ab44ad63b5d6261bdedc12cad4022333018316 Mon Sep 17 00:00:00 2001
From: Nikola Pajkovsky <npajkovs@redhat.com>
Date: Thu, 8 Dec 2011 17:35:37 +0100
Subject: [PATCH 11/11] url takes escaped string
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
---
src/plugins/abrt-bodhi.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/src/plugins/abrt-bodhi.c b/src/plugins/abrt-bodhi.c
index 11c6d02..43a3b42 100644
--- a/src/plugins/abrt-bodhi.c
+++ b/src/plugins/abrt-bodhi.c
@@ -421,7 +421,11 @@ int main(int argc, char **argv)
}
if (argv[optind])
- query = strbuf_append_strf(query, "package=%s&", argv[optind]);
+ {
+ char *escaped = g_uri_escape_string(argv[optind], NULL, 0);
+ query = strbuf_append_strf(query, "package=%s&", escaped);
+ free(escaped);
+ }
if (query->buf[query->len - 1] == '&')
query->buf[query->len - 1] = '\0';
--
1.7.7.3