esc-reporting/esc-analyze.py  |   29 +++++++--
 esc-reporting/esc-automate.py |  133 ++++++++++++++++++++++++++++++++++--------
 2 files changed, 133 insertions(+), 29 deletions(-)

New commits:
commit e6279b32170c718e08b53f60c74bb733bed3643f
Author: jan Iversen <j...@libreoffice.org>
Date:   Tue May 9 17:02:20 2017 +0200

    esc-report, control part of automate and update of data

diff --git a/esc-reporting/esc-analyze.py b/esc-reporting/esc-analyze.py
index 081aaca..1aa6c61 100755
--- a/esc-reporting/esc-analyze.py
+++ b/esc-reporting/esc-analyze.py
@@ -52,6 +52,7 @@ import operator
 import datetime
 import json
 import xmltodict
+import re
 
 
 def util_load_file(fileName):
@@ -595,7 +596,7 @@ def analyze_reports():
                                             'remove_cc': []}
     statList['automateList']['mail'] = {'we_miss_you_email': [],
                                         'award_1st_email': []}
-                    
+
     for id, row in statList['people'].items():
       entry = {'name': row['name'], 'email': id, 'license': row['licenseText']}
       if row['newestCommit'] > mailedDate and row['newestCommit'] < 
cfg['3monthDate']:
@@ -607,6 +608,7 @@ def analyze_reports():
       if row['licenseText'].startswith('PENDING'):
           statList['reportList']['pending_license'].append(entry)
 
+    tmpListToReview = []
     for key,row in gerritData['patch'].items():
       if row['status'] == 'SUBMITTED' or row['status'] == 'DRAFT':
         row['status'] = 'NEW'
@@ -635,11 +637,30 @@ def analyze_reports():
         if xDate < cfg['1monthDate'] and not doBlock:
           txt = row['messages'][len(row['messages'])-1]
           if 'A polite ping' in txt:
-            
statList['automateList']['gerrit']['to_abandon_abandon'].append(entry)
+            
statList['automateList']['gerrit']['to_abandon_abandon'].append(entry['id'])
           else:
-            
statList['automateList']['gerrit']['to_abandon_comment'].append(entry)
+            
statList['automateList']['gerrit']['to_abandon_comment'].append(entry['id'])
         if cntReview == 0 and not 
statList['people'][ownerEmail]['isCommitter']:
-          statList['automateList']['gerrit']['to_review'].append(entry)
+            tmpListToReview.append(entry['id'])
+
+    for id in tmpListToReview:
+      reviewEmail = '<default>'
+      txt = gerritData['patch'][id]['subject']
+      if txt.startswith('tdf#'):
+        try:
+          row = bugzillaData['bugs'][re.findall('\d+', txt)[0]]
+          ownerEmail = util_check_mail(row['creator_detail']['name'], 
row['creator_detail']['email'])
+          if statList['people'][ownerEmail]['isCommitter']:
+            reviewEmail = ownerEmail
+          else:
+            for comment in row['comments']:
+              email = util_check_mail('', comment['creator'])
+              if not email == 'aniste...@gmail.com' and 
statList['people'][email]['isCommitter']:
+                reviewEmail = email
+                break
+        except Exception as e:
+          pass
+      statList['automateList']['gerrit']['to_review'].append({'id': id, 
'email': reviewEmail})
 
     for key, row in bugzillaData['bugs'].items():
       if not 'cc' in row:
diff --git a/esc-reporting/esc-automate.py b/esc-reporting/esc-automate.py
index e8cb77f..ca6dfce 100755
--- a/esc-reporting/esc-automate.py
+++ b/esc-reporting/esc-automate.py
@@ -50,6 +50,48 @@ def util_dump_file(fileName, rawList):
       exit(-1)
 
 
+def handle_gerrit_abandon(id, text):
+    return
+
+
+
+def handle_gerrit_comment(id, text):
+    return
+
+
+
+def handle_gerrit_review(id, email):
+    return
+
+
+
+def handle_bugzilla_comment(id, text):
+    return
+
+
+
+def handle_bugzilla_unassign(id, text):
+    return
+
+
+
+def handle_bugzilla_reset_status(id):
+    return
+
+
+
+def handle_bugzilla_cc(id, email):
+    return
+
+
+
+def handle_mail_pdf(name, email):
+    return
+
+
+
+def handle_mail_miss_you(name, email):
+    return
 
 
 
@@ -81,37 +123,78 @@ def runAutomate():
 
     autoList = util_load_data_file(cfg['homedir'] + 
'stats.json')['automateList']
 
-    # analyze test for:
-    # "A polite ping"
-
-    # gerrit non-committer patches > 4 weeks: overdue review / poking 
reminders --> "to_abandon_comment"
-    # gerrit patches > extra 4 weeks: auto-abandon if no comments / changes. 
--> "to_abandon_abandon"
-    # gerrit patches from non-committers, add reviewer --> "to_review"
-    # bugzilla: easy-hacks: un-assign those un-touched for 4 weeks to 
de-conflict --> "to_unassign_comment" "to_unassign_unassign"
-    # bugzilla extra: easy-hacks, check assign consistent --> 
"assign_problem_status" "assign_problem_user",
-    # bugzilla: checking mentoring@ is CC'd on all easy-hacks --> "missing_cc"
-    # bugzilla:checking UX team is CC'd on all UX hacks --> "missing_ui_cc"
-    # 1st patch award email auto-generate that --> "award_1st_email"
-    # "we miss you" email --> "we_miss_you_email"
+    try:
+      for id in autoList['gerrit']['to_abandon_abandon']:
+        handle_gerrit_abandon(id, "Abandoning due to lack of work, be aware it 
can anytime be reopened if you want to continue working")
+    except Exception as e:
+      print('ERROR: handle_gerrit_abandon failed with ' + str(e))
+      pass
+    try:
+      for id in autoList['gerrit']['to_abandon_comment']:
+        handle_gerrit_comment(id, "A polite ping, still working on this patch")
+    except Exception as e:
+      print('ERROR: handle_gerrit_comment failed with ' + str(e))
+      pass
+    try:
+      for row in autoList['gerrit']['to_review']:
+        handle_gerrit_review(row['id'], row['email'])
+    except Exception as e:
+      print('ERROR: handle_gerrit_review failed with ' + str(e))
+      pass
 
-    xMail = []
     try:
-      x = automate_gerrit()
-      if not x is None:
-        xMail.append(x)
-    except:
+      for id in autoList['bugzilla']['to_unassign_comment']:
+        handle_bugzilla_comment(id, "A polite ping, still working on this bug")
+    except Exception as e:
+      print('ERROR: handle_bugzilla_comment failed with ' + str(e))
       pass
     try:
-      x = automate_bugzilla()
-      if not x is None:
-        xMail.append(x)
-    except:
+      for id in autoList['bugzilla']['to_unassign_unassign']:
+        handle_bugzilla_unassign(id, "Unassigning due to lack of work, be 
aware it can anytime be assigned again if you want to continue working")
+    except Exception as e:
+      print('ERROR: handle_bugzilla_unassign failed with ' + str(e))
       pass
     try:
-      x = automate_pdf()
-      if not x is None:
-        xMail.append(x)
-    except:
+      for id in autoList['bugzilla']['assign_problem_status']:
+        handle_bugzilla_reset_status(id)
+    except Exception as e:
+      print('ERROR: handle_bugzilla_reset_status failed with ' + str(e))
+      pass
+    try:
+      for id in autoList['bugzilla']['to_unassign_unassign']:
+        handle_bugzilla_unassign(id, '')
+    except Exception as e:
+      print('ERROR: handle_bugzilla_unassign failed with ' + str(e))
+      pass
+    try:
+      for id in autoList['bugzilla']['missing_cc']:
+        handle_bugzilla_cc(id, 'mentor...@libreoffice.org')
+    except Exception as e:
+      print('ERROR: handle_bugzilla_cc failed with ' + str(e))
+      pass
+    try:
+      for id in autoList['bugzilla']['missing_ui_cc']:
+        handle_bugzilla_cc(id, 'libreoffice-ux-adv...@lists.freedesktop.org')
+    except Exception as e:
+      print('ERROR: handle_bugzilla_cc failed with ' + str(e))
+      pass
+
+    xMail = []
+    try:
+      for row in autoList['mail']['award_1st_email']:
+        x = handle_mail_pdf(row['name'], row['email'])
+        if not x is None:
+          xMail.append(x)
+    except Exception as e:
+      print('ERROR: handle_mail_pdf failed with ' + str(e))
+      pass
+    try:
+      for row in autoList['mail']['we_miss_you_email']:
+        x = handle_mail_miss_you(row['name'], row['email'])
+        if not x is None:
+          xMail.append(x)
+    except Exception as e:
+      print('ERROR: analyze_reports failed with ' + str(e))
       pass
 
     fp = open('/tmp/runAutoMail', 'w', encoding='utf-8')
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to