esc-reporting/esc-analyze.py | 14 +++++++++----- esc-reporting/esc-automate.py | 8 ++++---- esc-reporting/esc-collect.py | 14 +++++++------- esc-reporting/esc-report.py | 4 ++-- 4 files changed, 22 insertions(+), 18 deletions(-)
New commits: commit e0e308bd703b326c47556ab1027167c848a0abb9 Author: Shinnok <ad...@shinnok.com> Date: Tue Sep 5 12:09:01 2017 +0200 Backport Cloph's fixes in /usr/local/bin. Fixes issues with gerrit CLI not being able to interpret full change IDs and adds support for BCC to sent e-mails. Change-Id: I95b9c1578a01e62af7f3c767bc9d982eeaebc19c Reviewed-on: https://gerrit.libreoffice.org/41989 Reviewed-by: Michael Meeks <michael.me...@collabora.com> Tested-by: Michael Meeks <michael.me...@collabora.com> diff --git a/esc-reporting/esc-analyze.py b/esc-reporting/esc-analyze.py index e0048ce..fbe22fe 100755 --- a/esc-reporting/esc-analyze.py +++ b/esc-reporting/esc-analyze.py @@ -59,7 +59,7 @@ import re def util_errorMail(text): print(text) - sendMail = 'mail -r mentor...@libreoffice.org -s "ERROR: esc-analyze FAILED" mentor...@libreoffice.org <<EOF\n' + text + '\nPlease have a look at vm174\nEOF\n' + sendMail = 'mail -r mentor...@libreoffice.org ' + cfg['mail']['bcc'] + ' -s "ERROR: esc-analyze FAILED" mentor...@libreoffice.org <<EOF\n' + text + '\nPlease have a look at vm174\nEOF\n' os.system(sendMail) @@ -651,7 +651,10 @@ def analyze_reports(): row['status'] = 'NEW' xDate = datetime.datetime.strptime(row['updated'], '%Y-%m-%d %H:%M:%S.%f000') ownerEmail = util_check_mail(row['owner']['name'], row['owner']['email']) - entry = {'id': key, 'name': row['owner']['name'], 'email': ownerEmail, 'title': row['subject']} + # while web is happy with the unique project~branch~changeID label, commandline interface + # only accepts ambiguous changeID, doesn't help, so fullid is not really fullid, but at least + # less prone to conflicts than just changeset-number that also can easily prefix-match commit-hashes + entry = {'id': key, 'fullid': row['change_id'], 'name': row['owner']['name'], 'email': ownerEmail, 'title': row['subject']} if row['status'] != 'ABANDONED': if ownerEmail is None: ownerEmail = row['owner']['email'] @@ -680,12 +683,13 @@ def analyze_reports(): patchset = 1 txt = '' if xDate < cfg['1monthDate'] and not doBlock: + # gerrit cli sucks and doesn't accept changeset,patchrev but only uses numericID if 'A polite ping' in txt: automateList['gerrit']['to_abandon_abandon'][entry['id']] = patchset else: automateList['gerrit']['to_abandon_comment'][entry['id']] = patchset if cntReview == 0 and not statList['people'][ownerEmail]['isCommitter']: - tmpListToReview.append({'id': entry['id'], 'patchset': patchset}) + tmpListToReview.append({'id': entry['id'], 'fullid': entry['fullid'], 'patchset': patchset}) defaultEmail = util_check_mail('', cfg['automate']['gerritRewiewUserEmail']) for rowTmp in tmpListToReview: @@ -706,8 +710,8 @@ def analyze_reports(): except Exception as e: pass x = statList['people'][reviewEmail] - automateList['gerrit']['to_review'][rowTmp['id']] = {'name': statList['people'][reviewEmail]['gerrit']['reviewName'], - 'patchset': rowTmp['patchset']} + automateList['gerrit']['to_review'][rowTmp['fullid']] = {'name': statList['people'][reviewEmail]['gerrit']['reviewName'], + 'patchset': rowTmp['patchset'], 'id': rowTmp['id']} 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 10a081c..3674147 100755 --- a/esc-reporting/esc-automate.py +++ b/esc-reporting/esc-automate.py @@ -34,7 +34,7 @@ from requests.auth import HTTPDigestAuth def util_errorMail(text): print(text) - sendMail = 'mail -r mentor...@libreoffice.org -s "ERROR: esc-automate FAILED" mentor...@libreoffice.org <<EOF\n' + text + '\nPlease have a look at vm174\nEOF\n' + sendMail = 'mail -r mentor...@libreoffice.org ' + cfg['mail']['bcc'] + ' -s "ERROR: esc-automate FAILED" mentor...@libreoffice.org <<EOF\n' + text + '\nPlease have a look at vm174\nEOF\n' os.system(sendMail) @@ -88,7 +88,7 @@ def doBugzilla(id, command, isComment=False): def doGerrit(id, command): - cmd = 'ssh gerrit.libreoffice.org gerrit ' + command + ' ' + id + cmd = 'ssh gerrit.libreoffice.org gerrit ' + command + ' "' + id + '"' r = os.system(cmd) if r != 0: raise Exception('error: ' + cmd + ' failed') @@ -100,7 +100,7 @@ def doMail(mail, subject, content, attach=None): attach = '-a ' + attach + ' ' else: attach = '' - sendMail = 'mail -r mentor...@libreoffice.org -s "' + subject + '" ' + attach + mail + ' <<EOF\n' + content + '\nEOF\n' + sendMail = 'mail -r mentor...@libreoffice.org ' + cfg['mail']['bcc'] + ' -s "' + subject + '" ' + attach + mail + ' <<EOF\n' + content + '\nEOF\n' r = os.system(sendMail) if r != 0: raise Exception('mail failed') @@ -117,7 +117,7 @@ def handle_gerrit_abandon(id, patchset): def handle_gerrit_review(id, row): cmd = 'set-reviewers -a \'"' + row['name'] + '"\'' doGerrit(id, cmd) - handle_gerrit_comment(id, row['patchset'], useText='added reviewer') + handle_gerrit_comment(row['id'], row['patchset'], useText='added reviewer') diff --git a/esc-reporting/esc-collect.py b/esc-reporting/esc-collect.py index 1547a55..50fe6b7 100755 --- a/esc-reporting/esc-collect.py +++ b/esc-reporting/esc-collect.py @@ -43,7 +43,7 @@ from requests.auth import HTTPDigestAuth def util_errorMail(text): print(text) - sendMail = 'mail -r mentor...@libreoffice.org -s "ERROR: esc-collect FAILED" mentor...@libreoffice.org <<EOF\n' + text + '\nPlease have a look at vm174\nEOF\n' + sendMail = 'mail -r mentor...@libreoffice.org ' + cfg['mail']['bcc'] + ' -s "ERROR: esc-collect FAILED" mentor...@libreoffice.org <<EOF\n' + text + '\nPlease have a look at vm174\nEOF\n' os.system(sendMail) @@ -675,20 +675,20 @@ def get_git(cfg): return rawList - def get_crash(cfg): fileName = cfg['homedir'] + 'dump/crash_dump.json' rawList = {'crashtest': {}, 'crashreport': {}} print("Updating crashtest dump") dirList = util_load_url('http://dev-builds.libreoffice.org/crashtest/?C=M;O=D', useRaw=True) - inx = dirList.find('alt="[DIR]"', 0) + # find newest entry by using sort - in nginx' fancyindex first row is parent-directory + # the second ones is most recent dir that was created. Only regular entries have a title + # attribute though, so use that as a shortcut, skip + inx = dirList.find('title="', 0) if inx == -1: print("ERROR: http://dev-builds.libreoffice.org/crashtest/?C=M;O=D not showing DIR list") return - inx = dirList.find('alt="[DIR]"', inx+8) - inx = dirList.find('href="', inx) +6 - end = dirList.find('"', inx) - url = 'http://dev-builds.libreoffice.org/crashtest/' + dirList[inx:end] + end = dirList.find('"', inx+7) + url = 'http://dev-builds.libreoffice.org/crashtest/' + dirList[inx:end] + '/' for type in 'crashlog', 'exportCrash': tmp = util_load_url(url + type + '.txt', useRaw=True).split('\n') diff --git a/esc-reporting/esc-report.py b/esc-reporting/esc-report.py index 6444755..77bef95 100755 --- a/esc-reporting/esc-report.py +++ b/esc-reporting/esc-report.py @@ -44,7 +44,7 @@ import xmltodict def util_errorMail(text): print(text) - sendMail = 'mail -r mentor...@libreoffice.org -s "ERROR: esc-report FAILED" mentor...@libreoffice.org <<EOF\n' + text + '\nPlease have a look at vm174\nEOF\n' + sendMail = 'mail -r mentor...@libreoffice.org ' + cfg['mail']['bcc'] + ' -s "ERROR: esc-report FAILED" mentor...@libreoffice.org <<EOF\n' + text + '\nPlease have a look at vm174\nEOF\n' os.system(sendMail) @@ -819,7 +819,7 @@ def runReport(): attach = '-a ' + i['attach'] + ' ' else: attach = '' - r = os.system("mail -r mentor...@libreoffice.org -s '" + i['title'] + "' " + attach + i['mail'] + " < " + i['file']) + r = os.system("mail -r mentor...@libreoffice.org " + cfg['mail']['bcc'] + " -s '" + i['title'] + "' " + attach + i['mail'] + " < " + i['file']) if r != 0: util_errorMail('ERROR: mailing failed with ' + str(e)) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits