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

Shinnok admin at shinnok.com
Sat Dec 16 18:12:02 UTC 2017


 esc-reporting/esc-analyze.py |   26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

New commits:
commit f1660f3eba03df1f3ce70b04eca32787748d564e
Author: Shinnok <admin at shinnok.com>
Date:   Sat Dec 16 12:53:39 2017 +0100

    Skip we-miss-you mails to company/org entities.
    
    By cross-referencing with domain-map before deciding whether
    to send or not.
    
    Change-Id: I89bb75be3b6a206253882b106d96544b3b669ec9
    Reviewed-on: https://gerrit.libreoffice.org/46595
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/esc-reporting/esc-analyze.py b/esc-reporting/esc-analyze.py
index 5dc41df..f3de599 100755
--- a/esc-reporting/esc-analyze.py
+++ b/esc-reporting/esc-analyze.py
@@ -71,10 +71,13 @@ def util_errorMail(text):
     os.system(sendMail)
 
 
-def util_load_file(fileName):
+def util_load_file(fileName, isJson=True):
     try:
       fp = open(fileName, encoding='utf-8')
-      rawData = json.load(fp)
+      if(isJson):
+        rawData = json.load(fp)
+      else:
+        rawData = fp.readlines()
       fp.close()
     except Exception as e:
       print('Error load file ' + fileName + ' due to ' + str(e))
@@ -592,6 +595,20 @@ def analyze_esc():
     statList['data']['esc']['crashreport'] = crashData['crashreport']['versions']
 
 
+def util_is_company_license(email):
+    domainMap = util_load_file(cfg['homedir'] + 'gitdm-config/domain-map', False)
+    for line in domainMap:
+      line = line[:-1]
+      if line.startswith('#') or line.startswith(' ') or len(line) == 0:
+        continue
+      domain = line
+      if '\t' in domain:
+        domain = line[:line.index('\t')]
+      else:
+        domain = line[:line.index(' ')]
+      if email.endswith(domain):
+        return True
+    return False
 
 def analyze_reports():
     global cfg, statList, openhubData, bugzillaData, gerritData, gitData, automateData
@@ -624,7 +641,10 @@ def analyze_reports():
 
     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'] and id not in automateData['reminder']:
+      if row['newestCommit'] > mailedDate\
+      and row['newestCommit'] < cfg['3monthDate']\
+      and id not in automateData['reminder']\
+      and not util_is_company_license(entry['email']):
         automateList['mail']['we_miss_you_email'][entry['email']] = entry['name']
         automateData['reminder'][id] = automateNow
       x = row['commits']['1month']['owner']


More information about the Libreoffice-commits mailing list