This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add mark_spam.py script
This is version of the script I've just installed as r239467.
Martin
>From 6385fc5c8729dcabd791c5b0cc5ba2ff64e68489 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Mon, 15 Aug 2016 11:28:35 +0200
Subject: [PATCH] Enhance mark_spam.py script
contrib/ChangeLog:
2016-08-15 Martin Liska <mliska@suse.cz>
* mark_spam.py: Add error handling and reset
another properties of attachments and bugs.
---
contrib/mark_spam.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/contrib/mark_spam.py b/contrib/mark_spam.py
index 569a03d..f206356 100755
--- a/contrib/mark_spam.py
+++ b/contrib/mark_spam.py
@@ -34,6 +34,10 @@ def mark_as_spam(id, api_key, verbose):
r = requests.get(u)
response = json.loads(r.text)
+ if 'error' in response and response['error']:
+ print(response['message'])
+ return
+
# 2) mark the bug as spam
cc_list = response['bugs'][0]['cc']
data = {
@@ -49,6 +53,7 @@ def mark_as_spam(id, api_key, verbose):
'cc': {'remove': cc_list},
'priority': 'P5',
'severity': 'trivial',
+ 'url': '',
'assigned_to': 'unassigned@gcc.gnu.org' }
r = requests.put(u, json = data)
@@ -74,7 +79,12 @@ def mark_as_spam(id, api_key, verbose):
for a in attachments:
attachment_id = a['id']
url = '%sbug/attachment/%d' % (base_url, attachment_id)
- r = requests.put(url, json = {'ids': [attachment_id], 'summary': 'spam', 'comment': 'spam', 'is_obsolete': True, 'api_key': api_key})
+ r = requests.put(url, json = {'ids': [attachment_id],
+ 'summary': 'spam',
+ 'file_name': 'spam',
+ 'content_type': 'application/x-spam',
+ 'is_obsolete': True,
+ 'api_key': api_key})
if verbose:
print(r)
print(r.text)
--
2.9.2