[Libreoffice-commits] dev-tools.git: esc-reporting/esc-automate.py

jan Iversen jani at libreoffice.org
Sun May 14 07:40:16 UTC 2017


 esc-reporting/esc-automate.py |   47 +++++++++++++++++++++++++++---------------
 1 file changed, 31 insertions(+), 16 deletions(-)

New commits:
commit 5b776f8dabf15edaf422c3e60030814ad8dd63e5
Author: jan Iversen <jani at libreoffice.org>
Date:   Sun May 14 09:39:52 2017 +0200

    esc-report, bz 4 week cycle

diff --git a/esc-reporting/esc-automate.py b/esc-reporting/esc-automate.py
index 35294be..3b9d38f 100755
--- a/esc-reporting/esc-automate.py
+++ b/esc-reporting/esc-automate.py
@@ -52,12 +52,19 @@ def util_dump_file(fileName, rawList):
 
 
 
-def doBugzilla(id, command):
+def doBugzilla(id, command, isComment=False):
     global cfg
 
-    url = 'https://bugs.documentfoundation.org/rest/bug/' + id + '?api_key=' + cfg['bugzilla']['api-key']
+    if isComment:
+      comment = '/comment'
+    else:
+      comment = ''
+    url = 'https://bugs.documentfoundation.org/rest/bug/' + id + comment + '?api_key=' + cfg['bugzilla']['api-key']
     try:
-      r = requests.put(url, command)
+      if isComment:
+        r = requests.post(url, command)
+      else:
+        r = requests.put(url, command)
       rawData = json.loads(r.text)
       r.close()
     except Exception as e:
@@ -96,25 +103,34 @@ def handle_gerrit_review(id, email):
 
 
 
-def handle_bugzilla_comment(id, text):
-    #handle_bugzilla_comment(id, 'A polite ping, ' + cfg['automate']['bugzilla']['comment'])
+def handle_bugzilla_unassign(id, text):
+    handle_bugzilla_reset_user(id, text)
+    handle_bugzilla_reset_status(id, text)
+    handle_bugzilla_comment(id, text, isPolite=False)
     return
 
 
 
-def handle_bugzilla_unassign(id, text):
-    # handle_bugzilla_unassign(id, cfg['automate']['bugzilla']['comment'])
-    return
+def handle_bugzilla_comment(id, text, isPolite=True):
+    if isPolite:
+      polite = 'A polite ping, '+ cfg['automate']['bugzilla']['comment']
+    else:
+      polite = cfg['automate']['bugzilla']['unassign']
+    command = '{"comment" : "' + polite + '", "is_private" : false}'
+    doBugzilla(id, command, isComment=True)
 
 
 
-def handle_bugzilla_reset_user(id, text):
+def handle_bugzilla_reset_status(id, text):
+    command = '{"status": "NEW"}'
+    doBugzilla(id, command)
     return
 
 
 
-def handle_bugzilla_reset_status(id, text):
-    return
+def handle_bugzilla_reset_user(id, text):
+    command = '{"assigned_to": "libreoffice-bugs at lists.freedesktop.org"}'
+    doBugzilla(id, command)
 
 
 
@@ -150,7 +166,6 @@ def handle_mail_pdf(email, name):
 
 
 
-
 def handle_mail_miss_you(email, name):
     global cfg
 
@@ -211,10 +226,10 @@ def runAutomate():
     #JIX executeLoop(handle_gerrit_comment, 'gerrit', 'to_abandon_comment')
     #JIX executeLoop(handle_gerrit_review,  'gerrit', 'to_review')
 
-    #JIX executeLoop(handle_bugzilla_comment, 'bugzilla', 'to_unassign_comment')
-    #JIX executeLoop(handle_bugzilla_unassign, 'bugzilla', 'to_unassign_unassign')
-    #JIX executeLoop(handle_bugzilla_reset_status, 'bugzilla', 'assign_problem_status')
-    #JIX executeLoop(handle_bugzilla_reset_user, 'bugzilla', 'assign_problem_user')
+    executeLoop(handle_bugzilla_unassign, 'bugzilla', 'to_unassign_unassign')
+    executeLoop(handle_bugzilla_comment, 'bugzilla', 'to_unassign_comment')
+    executeLoop(handle_bugzilla_reset_status, 'bugzilla', 'assign_problem_status')
+    executeLoop(handle_bugzilla_reset_user, 'bugzilla', 'assign_problem_user')
     executeLoop(handle_bugzilla_cc, 'bugzilla', 'missing_cc')
     executeLoop(handle_bugzilla_ui_cc, 'bugzilla', 'missing_ui_cc')
     executeLoop(handle_mail_miss_you, 'mail', 'we_miss_you_email')


More information about the Libreoffice-commits mailing list