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

jan Iversen jani at libreoffice.org
Sat May 6 16:10:48 UTC 2017


 esc-reporting/esc-analyze.py |    5 +++
 esc-reporting/esc-collect.py |   30 +++++++++++++++++-
 esc-reporting/esc-report.py  |   69 +++++++++++++++++++++++++++++--------------
 3 files changed, 81 insertions(+), 23 deletions(-)

New commits:
commit d0245d697e7f821d634e9f80f46a29dfc84e99ec
Author: jan Iversen <jani at libreoffice.org>
Date:   Sat May 6 18:10:26 2017 +0200

    esc-reporting, added most pressing bugs

diff --git a/esc-reporting/esc-analyze.py b/esc-reporting/esc-analyze.py
index da7250d..2e93b6f 100755
--- a/esc-reporting/esc-analyze.py
+++ b/esc-reporting/esc-analyze.py
@@ -481,6 +481,11 @@ def analyze_esc():
       statList['escList']['QAstat']['top15_squashers'][line['who']] = line['closed']
     for line in bugzillaESCData['ESC_QA_STATS_UPDATE']['top15_reporters']:
       statList['escList']['QAstat']['top15_reporters'][line['who']] = line['reported']
+    statList['escList']['MostPressingBugs'] = {'open': {'list': {}}, 'closed': {'list': {}}}
+    for type in 'open', 'closed':
+       statList['escList']['MostPressingBugs'][type]['count'] = bugzillaESCData['MostPressingBugs'][type]['count']
+       for id in bugzillaESCData['MostPressingBugs'][type]['list']:
+           statList['escList']['MostPressingBugs'][type]['list'][id] = bugzillaData['bugs'][id]['summary']
 
     bug_fixers = {}
     for id, bug in bugzillaData['bugs'].items():
diff --git a/esc-reporting/esc-collect.py b/esc-reporting/esc-collect.py
index 347242a..4541ed3 100755
--- a/esc-reporting/esc-collect.py
+++ b/esc-reporting/esc-collect.py
@@ -59,7 +59,8 @@ def util_load_url(url, useDict=False, useRaw=False, uUser=None, uPass=None):
       if uUser is None:
         r = requests.get(url)
         if useDict:
-          rawData = xmltodict.parse(r.text)
+          x = r.text.replace('<br>', '').replace('<img.*>', '')
+          rawData = xmltodict.parse(x)
         elif useRaw:
           rawData = r.text
         else:
@@ -516,6 +517,31 @@ def get_esc_bugzilla(cfg):
         rawList['ESC_COMPONENT_UPDATE']['os'][os]['count'], \
         rawList['ESC_COMPONENT_UPDATE']['os'][os]['list'] = do_ESC_counting(bz, url)
 
+    url = '&bug_status=UNCONFIRMED' \
+          '&bug_status=NEW' \
+          '&bug_status=ASSIGNED' \
+          '&bug_status=REOPENED' \
+          '&chfield=priority' \
+          '&chfieldfrom=-8d' \
+          '&chfieldto=Now' \
+          '&chfieldvalue=highest' \
+          '&priority=highest' \
+          '&resolution=---'
+    rawList['MostPressingBugs'] = {'open': {}, 'closed': {}}
+    rawList['MostPressingBugs']['open']['count'], \
+    rawList['MostPressingBugs']['open']['list'] = do_ESC_counting(bz, url)
+    url = '&bug_status=RESOLVED' \
+          '&bug_status=VERIFIED' \
+          '&bug_status=CLOSED' \
+          '&chfield=priority' \
+          '&chfieldfrom=-8d' \
+          '&chfieldto=Now' \
+          '&chfieldvalue=highest' \
+          '&priority=highest' \
+          '&resolution=---'
+    rawList['MostPressingBugs']['closed']['count'], \
+    rawList['MostPressingBugs']['closed']['list'] = do_ESC_counting(bz, url)
+
     util_dump_file(fileName, rawList)
     return rawList
 
@@ -651,7 +677,7 @@ def runCfg(platform):
 
 
 def runBuild(cfg):
-    openhubData = get_openhub(cfg)
+    #problem openhubData = get_openhub(cfg)
     bugzillaData = get_bugzilla(cfg)
     ESCData = get_esc_bugzilla(cfg)
     gerritData = get_gerrit(cfg)
diff --git a/esc-reporting/esc-report.py b/esc-reporting/esc-report.py
index fd2d88b..e45057c 100755
--- a/esc-reporting/esc-report.py
+++ b/esc-reporting/esc-report.py
@@ -52,6 +52,18 @@ def util_load_data_file(fileName):
 
 
 
+def util_dump_file(fileName, rawList):
+    try:
+      fp = open(fileName, 'w', encoding='utf-8')
+      json.dump(rawList, fp, ensure_ascii=False, indent=4, sort_keys=True)
+      fp.close()
+    except Exception as e:
+      print('Error dump file ' + fileName + ' due to ' + str(e))
+      os.remove(fileName)
+      exit(-1)
+
+
+
 def util_check_mail(xmail):
     global statList
     mail = xmail.lower()
@@ -242,31 +254,31 @@ def report_day_mentoring():
       if cDate >= cfg['1weekDate'] or 'easyhack' in row['history'][-1]['changes'][0]['added']:
         myStatList['easyhacks_new'].append(key)
 
+
     fp = open('/tmp/esc_day_mentoring_report.txt', 'w', encoding='utf-8')
     print('Day mentoring report, generated {} based on stats.json from {}'.format(
           datetime.datetime.now().strftime("%Y-%m-%d"), statList['addDate']), file=fp)
 
-    print(">> mail award pdf, and update award.json", file=fp)
-    for row in myStatList['award_1st_email'] :
-        print('        {} {} {}'.format(row['name'],row['email'],row['license']), file=fp)
-
     util_print_line(fp, myStatList['missing_license'],    'missing license statement'  )
-    util_print_line(fp, myStatList['to_abandon'],         'gerrit to abandon',         doGerrit=True)
-    util_print_line(fp, myStatList['to_review'],          'gerrit to review',          doGerrit=True)
-    util_print_line(fp, myStatList['to_unassign'],        'easyhacks to unassign',     doBugzilla=True)
     util_print_line(fp, myStatList['needinfo'],           'easyhacks with NEEDINFO',   doBugzilla=True)
     util_print_line(fp, myStatList['easyhacks_new'],      'easyhacks new',             doBugzilla=True)
-    util_print_line(fp, myStatList['missing_cc'],         'easyhacks missing cc',      doBugzilla=True)
-    util_print_line(fp, myStatList['remove_cc'],          'easyhacks remove cc',       doBugzilla=True)
-    util_print_line(fp, myStatList['missing_ui_cc'],      'easyhacks missing ui cc',   doBugzilla=True)
-    util_print_line(fp, myStatList['assign_problem'],     'easyhacks assign problem',  doBugzilla=True)
     util_print_line(fp, myStatList['to_be_closed'],       'easyhacks to be closed',    doBugzilla=True)
     util_print_line(fp, myStatList['needsDevEval'],       'easyhacks needsDevEval',    doBugzilla=True)
     util_print_line(fp, myStatList['needsUXEval'],        'easyhacks needsUXEval',     doBugzilla=True)
-    util_print_line(fp, myStatList['we_miss_you_email'],  'we miss you email'          )
     util_print_line(fp, myStatList['too_many_comments'],  'easyhacks reduce comments', doBugzilla=True)
     util_print_line(fp, myStatList['pending_license'],    'pending license statement'  )
     fp.close()
+
+    del myStatList['missing_license']
+    del myStatList['needinfo']
+    del myStatList['easyhacks_new']
+    del myStatList['to_be_closed']
+    del myStatList['needsDevEval']
+    del myStatList['needsUXEval']
+    del myStatList['too_many_comments']
+    del myStatList['pending_license']
+
+    util_dump_file(cfg['homedir'] + 'automate.json', myStatList)
     return {'title': 'esc_mentoring, Daily work', 'mail': 'mentoring at documentfoundation.org', 'file': '/tmp/esc_day_mentoring_report.txt'}
 
 
@@ -444,6 +456,16 @@ def report_esc_prototype():
             txt += '     {:<24} - {}({:+d})\n'.format(id, row, xDiff)
     escPrototype = escPrototype.replace('$<ESC_COMPONENT_REGRESSION_ALL_UPDATE>', txt)
 
+    txt = '     open:\n'
+    for id, title in statList['escList']['MostPressingBugs']['open']['list'].items():
+        txt += '        {} "{}"\n'.format(id, title)
+    txt += '     closed:\n'
+    for id, title in statList['escList']['MostPressingBugs']['closed']['list'].items():
+        txt += '        {} "{}"\n'.format(id, title)
+
+    escPrototype = escPrototype.replace('$<ESC_MOST_PRESSING_BUGS>', txt)
+
+
     fp = open('/tmp/esc_prototype_report.txt', 'w', encoding='utf-8')
     print('ESC prototype report, generated {} based on stats.json from {}\n\n\n'.format(
           datetime.datetime.now().strftime("%Y-%m-%d"), statList['addDate']), file=fp)
commit 2c2753466ef4f286808e1069a3a09db8dd1b23e9
Author: jan Iversen <jani at libreoffice.org>
Date:   Sat May 6 15:09:19 2017 +0200

    esc-mentoring updated esc-report.py
    
    Changed bug-metrics to use .ods
    Added local git repo (bug-metrics) to collect weekly versions.

diff --git a/esc-reporting/esc-report.py b/esc-reporting/esc-report.py
index 2a6613e..fd2d88b 100755
--- a/esc-reporting/esc-report.py
+++ b/esc-reporting/esc-report.py
@@ -547,15 +547,19 @@ def gen_rowRegression(useHigh=False):
     return text + buildText + endText + '</table:table-row>\n'
 
 
-def report_flatODF():
+def report_bug_metrics():
     global statList, cfg
 
     if cfg['nowDate'].strftime('%w') != '2':
       # only generate un tuesdays
       return
 
-    filename = cfg['homedir'] + 'bug-metrics.fods'
-    fp = open(filename, encoding='utf-8')
+    filename = cfg['homedir'] + 'bug-metrics/bug-metrics.ods'
+    fileContent = '/tmp/bugs/content.xml'
+
+    os.system('rm -rf /tmp/bugs')
+    os.system('unzip -d /tmp/bugs ' + filename)
+    fp = open(fileContent, encoding='utf-8')
     text = fp.read()
     fp.close()
 
@@ -578,8 +582,7 @@ def report_flatODF():
         # no handling
         continue
       elif text[startIndex:].startswith('"HighPriority"'):
-        inx  = text.rfind('<table:table-row table:style-name="ro2" table:number-rows-repeated="39">', startIndex, endIndex)
-        text = text[:inx] + gen_rowHighPriority() + text[inx:]
+        text = text[:endIndex] + gen_rowHighPriority() + text[endIndex:]
       elif text[startIndex:].startswith('"Regressions"'):
         text = text[:endIndex] + gen_rowRegression() + text[endIndex:]
       elif text[startIndex:].startswith('"HighPrioRegressions"'):
@@ -587,9 +590,11 @@ def report_flatODF():
       else:
         raise Exception("unknown sheet in bug-metrics: " + text[startIndex:startIndex+20])
 
-    fp = open(filename, 'w', encoding='utf-8')
+    fp = open(fileContent, 'w', encoding='utf-8')
     print(text, file=fp)
     fp.close()
+    os.system('cd /tmp/bugs; zip ' + filename + ' *')
+    os.system('cd ' + cfg['homedir'] + 'bug-metrics; git add *; git commit -m \'new version ' + statList['addDate'] + '\'')
     data = 'ESC bug_metric.fods, based on stats.json from '+statList['addDate']
     return {'title': data, 'mail': 'mentoring at documentfoundation.org', 'attach': filename, 'file' : '/tmp/esc_flatODF_body'}
 
@@ -870,6 +875,9 @@ def runReport():
     gitData = util_load_data_file(cfg['homedir'] + 'dump/git_dump.json')
 
     xMail = []
+    x = report_bug_metrics()
+    if not x is None:
+      xMail.append(x)
     x = report_day_mentoring()
     if not x is None:
       xMail.append(x)
@@ -888,9 +896,6 @@ def runReport():
     x = report_esc_prototype()
     if not x is None:
       xMail.append(x)
-    x = report_flatODF()
-    if not x is None:
-      xMail.append(x)
 
     fp = open('/tmp/runMail', 'w', encoding='utf-8')
     print("#!/bin/bash", file=fp)


More information about the Libreoffice-commits mailing list