From 46d8661dcb6a88d37b6aa67131c7e33d8d8d77ce Mon Sep 17 00:00:00 2001 From: Martin Kutlak Date: Jan 07 2019 08:57:37 +0000 Subject: Replace nomail flag with minor_update Send Bugzilla updates as minor_update. Signed-off-by: Martin Kutlak --- diff --git a/0001-rhbz-Replace-nomail-flag-with-minor_update.patch b/0001-rhbz-Replace-nomail-flag-with-minor_update.patch new file mode 100644 index 0000000..6ab8dce --- /dev/null +++ b/0001-rhbz-Replace-nomail-flag-with-minor_update.patch @@ -0,0 +1,232 @@ +From 569bf0e3fed698e93b8e098bf6a0bb2f773aed6a Mon Sep 17 00:00:00 2001 +From: Martin Kutlak +Date: Fri, 4 Jan 2019 12:26:28 +0100 +Subject: [PATCH] rhbz: Replace nomail flag with minor_update + +In Bugzilla v5.0 nomail flag is replaced with minor_update. [1] +Because we still use the old nomail flag emails are being sent for every added attachment/comment. + +Related: rhbz#1660157 +Closes: abrt/abrt#1346 + +See also: +- https://partner-bugzilla.redhat.com/docs/en/html/integrating/api/Bugzilla/WebService/Bug.html?highlight=minor_update + +[1] https://bugzilla.redhat.com/show_bug.cgi?id=1655829 + +Signed-off-by: Martin Kutlak +--- + src/plugins/reporter-bugzilla.c | 12 +++++----- + src/plugins/rhbz.c | 41 ++++++++++++++++++--------------- + src/plugins/rhbz.h | 4 ++-- + 3 files changed, 30 insertions(+), 27 deletions(-) + +diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c +index d4d03f8e..c12e00d1 100644 +--- a/src/plugins/reporter-bugzilla.c ++++ b/src/plugins/reporter-bugzilla.c +@@ -35,7 +35,7 @@ int attach_text_item(struct abrt_xmlrpc *ax, const char *bug_id, + log_debug("attaching '%s' as text", item_name); + int r = rhbz_attach_blob(ax, bug_id, + item_name, item->content, strlen(item->content), +- RHBZ_NOMAIL_NOTIFY ++ RHBZ_MINOR_UPDATE + ); + return (r == 0); + } +@@ -63,7 +63,7 @@ int attach_file_item(struct abrt_xmlrpc *ax, const char *bug_id, + return 0; + } + log_debug("attaching '%s' as file", item_name); +- int flag = RHBZ_NOMAIL_NOTIFY; ++ int flag = RHBZ_MINOR_UPDATE; + if (!(item->flags & CD_FLAG_BIGTXT)) + flag |= RHBZ_BINARY_ATTACHMENT; + int r = rhbz_attach_fd(ax, bug_id, item_name, fd, flag); +@@ -793,7 +793,7 @@ int main(int argc, char **argv) + if (reported_to && reported_to->url) + { + log_warning(_("Adding External URL to bug %i"), new_id); +- rhbz_set_url(client, new_id, reported_to->url, RHBZ_NOMAIL_NOTIFY); ++ rhbz_set_url(client, new_id, reported_to->url, RHBZ_MINOR_UPDATE); + free_report_result(reported_to); + } + } +@@ -821,7 +821,7 @@ int main(int argc, char **argv) + if (existing_id >= 0) + { + log_warning(_("Closing bug %i as duplicate of bug %i"), new_id, existing_id); +- rhbz_close_as_duplicate(client, new_id, existing_id, RHBZ_NOMAIL_NOTIFY); ++ rhbz_close_as_duplicate(client, new_id, existing_id, RHBZ_MINOR_UPDATE); + } + + goto log_out; +@@ -876,7 +876,7 @@ int main(int argc, char **argv) + && !g_list_find_custom(bz->bi_cc_list, rhbz.b_login, (GCompareFunc)g_strcmp0) + ) { + log_warning(_("Adding %s to CC list"), rhbz.b_login); +- rhbz_mail_to_cc(client, bz->bi_id, rhbz.b_login, RHBZ_NOMAIL_NOTIFY); ++ rhbz_mail_to_cc(client, bz->bi_id, rhbz.b_login, RHBZ_MINOR_UPDATE); + } + + /* Add comment and bt */ +@@ -911,7 +911,7 @@ int main(int argc, char **argv) + sprintf(bug_id_str, "%i", bz->bi_id); + log_warning(_("Attaching better backtrace")); + rhbz_attach_blob(client, bug_id_str, FILENAME_BACKTRACE, bt, strlen(bt), +- RHBZ_NOMAIL_NOTIFY); ++ RHBZ_MINOR_UPDATE); + } + } + else +diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c +index 680527d7..cb6505ea 100644 +--- a/src/plugins/rhbz.c ++++ b/src/plugins/rhbz.c +@@ -605,7 +605,7 @@ int rhbz_new_bug(struct abrt_xmlrpc *ax, + return new_bug_id; + } + +-/* suppress mail notify by {s:i} (nomail:1) (driven by flag) */ ++/* suppress mail notify by {s:i} (minor_update:1) (driven by flag) */ + int rhbz_attach_blob(struct abrt_xmlrpc *ax, const char *bug_id, + const char *filename, const char *data, int data_len, int flags) + { +@@ -620,7 +620,7 @@ int rhbz_attach_blob(struct abrt_xmlrpc *ax, const char *bug_id, + + char *fn = xasprintf("File: %s", filename); + xmlrpc_value* result; +- int nomail_notify = !!IS_NOMAIL_NOTIFY(flags); ++ int minor_update = !!IS_MINOR_UPDATE(flags); + + /* http://www.bugzilla.org/docs/4.2/en/html/api/Bugzilla/WebService/Bug.html#add_attachment + * +@@ -640,10 +640,11 @@ int rhbz_attach_blob(struct abrt_xmlrpc *ax, const char *bug_id, + */ + "data", data, (size_t)data_len, + +- /* Undocumented argument but it works with Red Hat Bugzilla version 4.2.4-7 +- * and version 4.4.rc1.b02 ++ /* If set to true, this is considered a minor update and no mail is sent to users who do not want ++ * minor update emails. If current user is not in the minor_update_group, this parameter is simply ++ * ignored. + */ +- "nomail", nomail_notify ++ "minor_update", minor_update + ); + + free(fn); +@@ -737,25 +738,25 @@ struct bug_info *rhbz_find_origin_bug_closed_duplicate(struct abrt_xmlrpc *ax, + return bi_tmp; + } + +-/* suppress mail notify by {s:i} (nomail:1) */ ++/* suppress mail notify by {s:i} (minor_update:1) */ + void rhbz_mail_to_cc(struct abrt_xmlrpc *ax, int bug_id, const char *mail, int flags) + { + func_entry(); + + xmlrpc_value *result; +- int nomail_notify = !!IS_NOMAIL_NOTIFY(flags); ++ int minor_update = !!IS_MINOR_UPDATE(flags); + #if 0 /* Obsolete API */ + result = abrt_xmlrpc_call(ax, "Bug.update", "({s:i,s:{s:(s),s:i}})", + "ids", bug_id, + "updates", "add_cc", mail, +- "nomail", nomail_notify ++ "minor_update", minor_update + ); + #endif + /* Bugzilla 4.0+ uses this API: */ + result = abrt_xmlrpc_call(ax, "Bug.update", "{s:i,s:{s:(s),s:i}}", + "ids", bug_id, + "cc", "add", mail, +- "nomail", nomail_notify ++ "minor_update", minor_update + ); + if (result) + xmlrpc_DECREF(result); +@@ -786,12 +787,12 @@ void rhbz_add_comment(struct abrt_xmlrpc *ax, int bug_id, const char *comment, + func_entry(); + + int private = !!IS_PRIVATE(flags); +- int nomail_notify = !!IS_NOMAIL_NOTIFY(flags); ++ int minor_update = !!IS_MINOR_UPDATE(flags); + + xmlrpc_value *result; + result = abrt_xmlrpc_call(ax, "Bug.add_comment", "{s:i,s:s,s:b,s:i}", + "id", bug_id, "comment", comment, +- "private", private, "nomail", nomail_notify); ++ "private", private, "minor_update", minor_update); + + if (result) + xmlrpc_DECREF(result); +@@ -801,15 +802,16 @@ void rhbz_set_url(struct abrt_xmlrpc *ax, int bug_id, const char *url, int flags + { + func_entry(); + +- const int nomail_notify = !!IS_NOMAIL_NOTIFY(flags); ++ const int minor_update = !!IS_MINOR_UPDATE(flags); + xmlrpc_value *result = abrt_xmlrpc_call(ax, "Bug.update", "{s:i,s:s,s:i}", + "ids", bug_id, + "url", url, + +- /* Undocumented argument but it works with Red Hat Bugzilla version 4.2.4-7 +- * and version 4.4.rc1.b02 ++ /* If set to true, this is considered a minor update and no mail is sent to users who do not want ++ * minor update emails. If current user is not in the minor_update_group, this parameter is simply ++ * ignored. + */ +- "nomail", nomail_notify ++ "minor_update", minor_update + ); + + if (result) +@@ -822,17 +824,18 @@ void rhbz_close_as_duplicate(struct abrt_xmlrpc *ax, int bug_id, + { + func_entry(); + +- const int nomail_notify = !!IS_NOMAIL_NOTIFY(flags); ++ const int minor_update = !!IS_MINOR_UPDATE(flags); + xmlrpc_value *result = abrt_xmlrpc_call(ax, "Bug.update", "{s:i,s:s,s:s,s:i,s:i}", + "ids", bug_id, + "status", "CLOSED", + "resolution", "DUPLICATE", + "dupe_of", duplicate_bug, + +- /* Undocumented argument but it works with Red Hat Bugzilla version 4.2.4-7 +- * and version 4.4.rc1.b02 ++ /* If set to true, this is considered a minor update and no mail is sent to users who do not want ++ * minor update emails. If current user is not in the minor_update_group, this parameter is simply ++ * ignored. + */ +- "nomail", nomail_notify ++ "minor_update", minor_update + ); + + if (result) +diff --git a/src/plugins/rhbz.h b/src/plugins/rhbz.h +index 86632a35..3990eda0 100644 +--- a/src/plugins/rhbz.h ++++ b/src/plugins/rhbz.h +@@ -36,7 +36,7 @@ enum { + RHBZ_MANDATORY_MEMB = (1 << 0), + RHBZ_READ_STR = (1 << 1), + RHBZ_READ_INT = (1 << 2), +- RHBZ_NOMAIL_NOTIFY = (1 << 3), ++ RHBZ_MINOR_UPDATE = (1 << 3), + RHBZ_PRIVATE = (1 << 4), + RHBZ_BINARY_ATTACHMENT = (1 << 5), + }; +@@ -44,7 +44,7 @@ enum { + #define IS_MANDATORY(flags) ((flags) & RHBZ_MANDATORY_MEMB) + #define IS_READ_STR(flags) ((flags) & RHBZ_READ_STR) + #define IS_READ_INT(flags) ((flags) & RHBZ_READ_INT) +-#define IS_NOMAIL_NOTIFY(flags) ((flags) & RHBZ_NOMAIL_NOTIFY) ++#define IS_MINOR_UPDATE(flags) ((flags) & RHBZ_MINOR_UPDATE) + #define IS_PRIVATE(flags) ((flags) & RHBZ_PRIVATE) + + struct bug_info { +-- +2.17.2 + diff --git a/libreport.spec b/libreport.spec index 782d6fe..503714f 100644 --- a/libreport.spec +++ b/libreport.spec @@ -29,12 +29,15 @@ Summary: Generic library for reporting various problems Name: libreport Version: 2.9.7 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: https://abrt.readthedocs.org/ Source: https://github.com/abrt/%{name}/archive/%{version}/%{name}-%{version}.tar.gz +Patch0001: 0001-rhbz-Replace-nomail-flag-with-minor_update.patch + + BuildRequires: %{dbus_devel} BuildRequires: gtk3-devel BuildRequires: curl-devel @@ -821,6 +824,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %endif %changelog +* Mon Jan 07 2019 Martin Kutlak 2.9.7-2 +- rhbz: Replace nomail flag with minor_update + * Fri Dec 07 2018 Matej Marusak 2.9.7-1 - reportclient: Search for required packages recursively - event_config: Modify unusable backtrace message