[Libreoffice-commits] dev-tools.git: gerritbot/send-daily-digest
gerritbot/send-daily-digest | 46 +++- 1 file changed, 33 insertions(+), 13 deletions(-) New commits: commit b5807dd80ff79305bb01dbd2a5101cef3a2a7864 Author: Mathias Michel Date: Sun Nov 24 02:19:38 2013 +0100 fdo#71911 : show the top level dir of a new change use the gerrit query to get the info since gerrit does not really create refs And then we don't have patches in the repo. (see http://gerrit-documentation.googlecode.com/svn/Documentation/2.3/user-upload.html#_gritty_details) restore mail for other repos small format on long lines Change-Id: Iccce0eb3c1a2c7e17fc6716d61917944ec05d6cf Reviewed-on: https://gerrit.libreoffice.org/6793 Reviewed-by: Björn Michaelsen Tested-by: Björn Michaelsen diff --git a/gerritbot/send-daily-digest b/gerritbot/send-daily-digest old mode 100644 new mode 100755 index 899fe2e..cf31f98 --- a/gerritbot/send-daily-digest +++ b/gerritbot/send-daily-digest @@ -26,24 +26,40 @@ def get_daily_query(status, project): def get_digest(query): digest = '' freshers = '' +do_module = [] +about = '' # we want first time contributors on new changes for core -do_fresh = query.split(':')[1].split(' ')[0] == 'core' and \ - query.split(':')[3].split(' ')[0] == 'open' and \ - query.split(':')[3].split(' ')[1] == '-age' +do_fresh = (query.split(':')[1].split(' ')[0] == 'core' and +query.split(':')[3].split(' ')[0] == 'open' and +query.split(':')[3].split(' ')[1] == '-age' ) -if do_fresh: all_users = init_freshers() +if do_fresh: +all_users = init_freshers() +do_module = ['--files', '--patch-sets'] -for line in sh.ssh(args['gerrit'], 'gerrit query --format=JSON -- \'%s\'' % query).encode('utf8').strip().split('\n'): +for line in subprocess.check_output(['ssh', args['gerrit'], 'gerrit', 'query'] + do_module + +['--format=JSON','--', "'" + query +"'"]).strip().splitlines(): change = json.loads(line) if 'url' in change.keys(): +if do_fresh: # we are in new changes +fpaths = (set([fileobj['file'] for pset in change['patchSets'] +for fileobj in pset['files']])) +fpaths.remove('/COMMIT_MSG') +# we assume gerrit replies with no leading slash +# if no subfolder, module is "build" +about = '\n about module ' + ', '.join(sorted(set([p.split('/')[0] +if '/' in p else 'build' for p in fpaths]))) + if do_fresh and change['owner']['name'].encode('utf8') not in all_users: -freshers += '+ %s\n in %s from %s\n' % (change['subject'][:73], change['url'], change['owner']['name']) +freshers += '+ %s\n in %s from %s%s\n' % (change['subject'][:73], +change['url'], change['owner']['name'], about) else: -digest += '+ %s\n in %s from %s\n' % (change['subject'][:73], change['url'], change['owner']['name']) +digest += '+ %s\n in %s from %s%s\n' % (change['subject'][:73], +change['url'], change['owner']['name'], about) if freshers != '': -digest = ' First time contributors doing great things ! \n' + freshers + \ - " End of freshness \n\n" + digest +digest = (' First time contributors doing great things ! \n' + freshers + + " End of freshness \n\n" + digest ) if digest == '': digest = 'None' return digest @@ -64,17 +80,20 @@ def init_freshers(): def get_project_body(project): none = True -body = '* Open changes on master for project %s changed in the last %d hours:\n\n' % (project, args['age']) +body = ('* Open changes on master for project %s changed in the last %d hours:\n\n' +% (project, args['age'])) dig = get_digest(get_daily_query('open', project)) if dig != 'None': none = False body += dig -body += '\n\n* Merged changes on master for project %s changed in the last %d hours:\n\n' % (project, args['age']) +body += ('\n\n* Merged changes on master for project %s changed in the last %d hours:\n\n' +% (project, args['age'])) dig = get_digest(get_daily_query('merged', project)) if dig != 'None': none = False body += dig -body += '\n\n* Abandoned changes on master for project %s changed in the last %d hours:\n\n' % (project, args['age']) +body += ('\n\n* Abandoned changes on master for project %s changed in the last %d hours:\n\n' +% (project, args['age'])) dig = get_digest(get_daily_query('abandoned', project)) if dig != 'None': none = False body += dig @@ -128,7 +147,7 @@ Note: The bot generating this m
[Libreoffice-commits] dev-tools.git: gerritbot/send-daily-digest
gerritbot/send-daily-digest |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c3e3d22a60ba817914cda68eef17e1f06bb2f76e Author: Stephan Bergmann Date: Wed Dec 4 10:02:42 2013 +0100 typography diff --git a/gerritbot/send-daily-digest b/gerritbot/send-daily-digest index cf31f98..6786db3 100755 --- a/gerritbot/send-daily-digest +++ b/gerritbot/send-daily-digest @@ -58,7 +58,7 @@ def get_digest(query): digest += '+ %s\n in %s from %s%s\n' % (change['subject'][:73], change['url'], change['owner']['name'], about) if freshers != '': -digest = (' First time contributors doing great things ! \n' + freshers + +digest = (' First time contributors doing great things! \n' + freshers + " End of freshness \n\n" + digest ) if digest == '': digest = 'None' ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] dev-tools.git: gerritbot/send-daily-digest
gerritbot/send-daily-digest |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit cfd6f05e7f8e00897652d7c48218ab0f6cedf74e Author: Bjoern Michaelsen Date: Mon Jun 24 11:36:36 2013 +0200 add french QA list to CC, also fix Reply-To address Change-Id: I43e6e804024125f17822a993f587a8422b69c1e8 Reviewed-on: https://gerrit.libreoffice.org/4471 Reviewed-by: David Ostrovsky Tested-by: David Ostrovsky diff --git a/gerritbot/send-daily-digest b/gerritbot/send-daily-digest index 8d92c84..5f8d937 100755 --- a/gerritbot/send-daily-digest +++ b/gerritbot/send-daily-digest @@ -54,9 +54,10 @@ Note: The bot generating this message can be found and improved here: msg = email.mime.text.MIMEText(body, 'plain', 'UTF-8') msg['From'] = 'ger...@libreoffice.org' msg['To'] = 'libreoffice@lists.freedesktop.org' +msg['Cc'] = 'q...@fr.libreoffice.org' msg['Date'] = email.utils.formatdate(time.mktime((now.timetuple( msg['Subject'] = 'LibreOffice Gerrit News %s' % now.date().isoformat() -msg['Reply-To'] = 'ibreoff...@lists.freedesktop.org' +msg['Reply-To'] = 'libreoffice@lists.freedesktop.org' msg['X-Mailer'] = 'LibreOfficeGerritDigestMailer 1.0' return msg @@ -65,6 +66,6 @@ if __name__ == '__main__': parser.add_argument('-g', '--gerrit', help='(i. e. logerrit or gerrit.libreoffice.org, use alias in your ~/.ssh(config with your public key)', required=True) args=vars(parser.parse_args()) server = smtplib.SMTP('localhost') -server.sendmail('ger...@libreoffice.org', 'libreoffice@lists.freedesktop.org', str(create_message(args['gerrit'], 25))) +server.sendmail('ger...@libreoffice.org', ['libreoffice@lists.freedesktop.org', 'q...@fr.libreoffice.org'], str(create_message(args['gerrit'], 25))) server.quit() # vim: set et sw=4 ts=4: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] dev-tools.git: gerritbot/send-daily-digest
gerritbot/send-daily-digest | 38 ++ 1 file changed, 34 insertions(+), 4 deletions(-) New commits: commit 251933c6163b9d323f521275907dd08f54a997ce Author: Mathias Michel Date: Wed Oct 30 01:44:27 2013 +0100 Implement fdo#70682 : first commits more visible in mail digest Limited to core repo on open submissions in gerrit Also fix the dev-tools project name for submissions Change-Id: I11ce5c01443c5b279c1a3a79a5440f7dffd2f67e Reviewed-on: https://gerrit.libreoffice.org/6481 Reviewed-by: Björn Michaelsen Tested-by: Björn Michaelsen diff --git a/gerritbot/send-daily-digest b/gerritbot/send-daily-digest old mode 100755 new mode 100644 index ea3f9b5..899fe2e --- a/gerritbot/send-daily-digest +++ b/gerritbot/send-daily-digest @@ -15,6 +15,7 @@ import email import email.mime.text import json import os +import subprocess import sh import smtplib import sys @@ -24,14 +25,42 @@ def get_daily_query(status, project): def get_digest(query): digest = '' -for line in sh.ssh(args['gerrit'], 'gerrit query --format=JSON -- \'%s\'' % query).strip().split('\n'): +freshers = '' + +# we want first time contributors on new changes for core +do_fresh = query.split(':')[1].split(' ')[0] == 'core' and \ + query.split(':')[3].split(' ')[0] == 'open' and \ + query.split(':')[3].split(' ')[1] == '-age' + +if do_fresh: all_users = init_freshers() + +for line in sh.ssh(args['gerrit'], 'gerrit query --format=JSON -- \'%s\'' % query).encode('utf8').strip().split('\n'): change = json.loads(line) if 'url' in change.keys(): -digest += '+ %s\n in %s from %s\n' % (change['subject'][:73], change['url'], change['owner']['name']) +if do_fresh and change['owner']['name'].encode('utf8') not in all_users: +freshers += '+ %s\n in %s from %s\n' % (change['subject'][:73], change['url'], change['owner']['name']) +else: +digest += '+ %s\n in %s from %s\n' % (change['subject'][:73], change['url'], change['owner']['name']) +if freshers != '': +digest = ' First time contributors doing great things ! \n' + freshers + \ + " End of freshness \n\n" + digest if digest == '': digest = 'None' return digest + +def init_freshers(): +repo_dir='/var/tmp/core.git' +if not os.path.exists(repo_dir):os.makedirs(repo_dir) +os.chdir(repo_dir) + +if not os.path.exists(os.path.join(repo_dir,'config')): + subprocess.call(['git','clone','--bare','git://gerrit.libreoffice.org/core',repo_dir]) +else: +subprocess.call(['git','fetch','origin']) +return subprocess.check_output(['git','shortlog','-s']) + + def get_project_body(project): none = True @@ -97,6 +126,7 @@ Note: The bot generating this message can be found and improved here: msg['Subject'] = 'LibreOffice Gerrit News for %s on %s' % (project, now.date().isoformat()) msg['Reply-To'] = msg_to[0] msg['X-Mailer'] = 'LibreOfficeGerritDigestMailer 1.1' + server.sendmail(msg_from, msg_to, str(msg)) server.quit() return project @@ -104,7 +134,7 @@ Note: The bot generating this message can be found and improved here: if __name__ == '__main__': parser = argparse.ArgumentParser('gerrit daily digest generator') parser.add_argument('-g', '--gerrit', help='(i. e. logerrit or gerrit.libreoffice.org, use the alias in your ~/.ssh(config with your public key)', required=True) -parser.add_argument('-r', '--repo', help='(A single project from gerrit (core, ...) or "submodules" (... of core) or "all" (core + contrib + submodules)', required=False, default='all') +parser.add_argument('-r', '--repo', help='(A single project from gerrit (core, ...) or "submodules" (... of core) or "all" (core + dev-tools + submodules)', required=False, default='all') parser.add_argument('-a', '--age', help='(A number expressed in hours.)', required=False, default=25) args=vars(parser.parse_args()) msg_from = 'ger...@libreoffice.org' @@ -114,7 +144,7 @@ if __name__ == '__main__': if args['repo'] == 'all': send_message_for_project('core') send_message_for_project('submodules') -send_message_for_project('contrib') +send_message_for_project('dev-tools') else: send_message_for_project(args['repo']) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] dev-tools.git: gerritbot/send-daily-digest
gerritbot/send-daily-digest |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit a2cb86dfa92cb8992c45c9f896cc1056a9a7 Author: Bjoern Michaelsen Date: Thu Jun 6 19:58:29 2013 +0200 self-referencing ftw diff --git a/gerritbot/send-daily-digest b/gerritbot/send-daily-digest index 90274bc..f8273c2 100755 --- a/gerritbot/send-daily-digest +++ b/gerritbot/send-daily-digest @@ -54,7 +54,10 @@ X-Mailer: LibreOfficeGerritDigestMailer 1.0 Best, -Your friendly LibreOffice Gerrit Digest Mailer''' +Your friendly LibreOffice Gerrit Digest Mailer + +Note: The bot generating this message can be found and improved here: + https://gerrit.libreoffice.org/gitweb?p=dev-tools.git;a=blob;f=gerritbot/send-daily-digest''' return message if __name__ == '__main__': ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] dev-tools.git: gerritbot/send-daily-digest
gerritbot/send-daily-digest |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 06415afc3490e359429319efd11889e0e60cbc82 Author: Bjoern Michaelsen Date: Wed Jun 12 10:14:02 2013 +0200 moar indent, also remove end-daily-digest - end-daily-digest shows up in the wrong place anyway Change-Id: I83aa2246e9683b667e8f60e8f11be11dac411f96 diff --git a/gerritbot/send-daily-digest b/gerritbot/send-daily-digest index c7847ae..278605f 100755 --- a/gerritbot/send-daily-digest +++ b/gerritbot/send-daily-digest @@ -27,7 +27,7 @@ def get_digest(gerrit, query): for line in sh.ssh(gerrit, 'gerrit query --format=JSON -- \'%s\'' % query).strip().split('\n'): change = json.loads(line) if 'url' in change.keys(): -digest += '%s\n in %s from %s\n' % (change['subject'].ljust(75)[:75], change['url'], change['owner']['name']) +digest += '%s\nin %s from %s\n' % (change['subject'].ljust(75)[:75], change['url'], change['owner']['name']) if digest == '': digest = 'None' return digest @@ -41,7 +41,7 @@ def create_message(gerrit, age): body += get_digest(gerrit, get_daily_query('merged', age)) body += '\n\n* Abandoned changes on master for project core changed in the last %d hours:\n\n' % age body += get_digest(gerrit, get_daily_query('abandoned', age)) -body += '\n\n* Open changes needing tweaks, but being untouched for more than a week:\n\end-daily-digest' +body += '\n\n* Open changes needing tweaks, but being untouched for more than a week:\n' body += get_digest(gerrit, 'project:core branch:master status:open (label:Code-Review<=-1 OR label:Verified<=-1) age:1w') body += ''' ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] dev-tools.git: gerritbot/send-daily-digest
gerritbot/send-daily-digest | 96 +--- 1 file changed, 73 insertions(+), 23 deletions(-) New commits: commit 8ef490cebaf16778f18896448fa454c158368cef Author: Mathias Michel Date: Fri Sep 13 00:22:02 2013 +0200 Gerrit mailer: generalization add support for any project add support for special satellite projects of Libreoffice do not send if empty default commandline will handle core, submodules and contrib Change-Id: I642d9ab027c5067cef0502d2f62fa2440623270f Reviewed-on: https://gerrit.libreoffice.org/5927 Reviewed-by: Björn Michaelsen Tested-by: Björn Michaelsen diff --git a/gerritbot/send-daily-digest b/gerritbot/send-daily-digest index 5f8d937..ea3f9b5 100755 --- a/gerritbot/send-daily-digest +++ b/gerritbot/send-daily-digest @@ -19,12 +19,12 @@ import sh import smtplib import sys -def get_daily_query(status, age): -return 'project:core branch:master status:%s -age:%dh' % (status, age) +def get_daily_query(status, project): +return 'project:%s branch:master status:%s -age:%dh' % (project, status, args['age']) -def get_digest(gerrit, query): +def get_digest(query): digest = '' -for line in sh.ssh(gerrit, 'gerrit query --format=JSON -- \'%s\'' % query).strip().split('\n'): +for line in sh.ssh(args['gerrit'], 'gerrit query --format=JSON -- \'%s\'' % query).strip().split('\n'): change = json.loads(line) if 'url' in change.keys(): digest += '+ %s\n in %s from %s\n' % (change['subject'][:73], change['url'], change['owner']['name']) @@ -32,17 +32,55 @@ def get_digest(gerrit, query): digest = 'None' return digest -def create_message(gerrit, age): +def get_project_body(project): +none = True + +body = '* Open changes on master for project %s changed in the last %d hours:\n\n' % (project, args['age']) +dig = get_digest(get_daily_query('open', project)) +if dig != 'None': none = False +body += dig + +body += '\n\n* Merged changes on master for project %s changed in the last %d hours:\n\n' % (project, args['age']) +dig = get_digest(get_daily_query('merged', project)) +if dig != 'None': none = False +body += dig + +body += '\n\n* Abandoned changes on master for project %s changed in the last %d hours:\n\n' % (project, args['age']) +dig = get_digest(get_daily_query('abandoned', project)) +if dig != 'None': none = False +body += dig + +body += '\n\n* Open changes needing tweaks, but being untouched for more than a week:\n\n' +dig = get_digest('project:%s branch:master status:open (label:Code-Review<=-1 OR label:Verified<=-1) age:1w' % project) +if dig != 'None': none = False +body += dig + +if none: return "" +else: return body + +def send_message_for_project(project): now = datetime.datetime.now() +nothing = 'Nothing moved in the project for the last %d hours' % args['age'] body = 'Moin!\n\n' -body += '* Open changes on master for project core changed in the last %d hours:\n\n' % age -body += get_digest(gerrit, get_daily_query('open', age)) -body += '\n\n* Merged changes on master for project core changed in the last %d hours:\n\n' % age -body += get_digest(gerrit, get_daily_query('merged', age)) -body += '\n\n* Abandoned changes on master for project core changed in the last %d hours:\n\n' % age -body += get_digest(gerrit, get_daily_query('abandoned', age)) -body += '\n\n* Open changes needing tweaks, but being untouched for more than a week:\n\n' -body += get_digest(gerrit, 'project:core branch:master status:open (label:Code-Review<=-1 OR label:Verified<=-1) age:1w') + +if project == 'submodules': +dict = get_project_body('dictionaries') +tran = get_project_body('translations') +help = get_project_body('help') + +if dict + tran + help == "": return 'Nothing' + +body += '\n\n~~ Project dictionaries ~~\n\n' +body += dict if bool(dict) else nothing +body += '\n\n~~ Project translations ~~\n\n' +body += tran if bool(tran) else nothing +body += '\n\n~~ Project help ~~\n\n' +body += help if bool(help) else nothing +else: +proj = get_project_body(project) +if proj == "": return 'Nothing' +body += proj + body += ''' Best, @@ -52,20 +90,32 @@ Your friendly LibreOffice Gerrit Digest Mailer Note: The bot generating this message can be found and improved here: https://gerrit.libreoffice.org/gitweb?p=dev-tools.git;a=blob;f=gerritbot/send-daily-digest''' msg = email.mime.text.MIMEText(body, 'plain', 'UTF-8') -msg['From'] = 'ger...@libreoffice.org' -msg['To'] = 'libreoffice@lists.freedesktop.org' -msg['Cc'] = 'q...@fr.libreoffice.org' +msg['From'] = msg_from +msg['To'] = msg_to[0] +msg['Cc'] = ', '.join(msg_to[1:]) # Works only if at least 2 item
[Libreoffice-commits] dev-tools.git: gerritbot/send-daily-digest
gerritbot/send-daily-digest |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 4242f42c2bb6434effca271fd2f83bfc6d0bb813 Author: Mathias Michel Date: Sun Jul 6 01:20:20 2014 +0200 [send-daily-digest] Fix bare repo not forwarding branch. The fetch command for the reference repository only updated the fetch index and never pushed it forward, so git shortlog afterwards always stayed back in time. Change-Id: Id03d00b17f2cafc31c3229084c4893e45e2d9023 Reviewed-on: https://gerrit.libreoffice.org/10097 Reviewed-by: Björn Michaelsen Tested-by: Björn Michaelsen diff --git a/gerritbot/send-daily-digest b/gerritbot/send-daily-digest index 79d86b8..19cb5b5 100755 --- a/gerritbot/send-daily-digest +++ b/gerritbot/send-daily-digest @@ -73,7 +73,7 @@ def init_freshers(): if not os.path.exists(os.path.join(repo_dir,'config')): subprocess.call(['git','clone','--bare','git://gerrit.libreoffice.org/core',repo_dir]) else: -subprocess.call(['git','fetch','origin']) +subprocess.call(['git','fetch','origin','master:master']) return subprocess.check_output(['git','shortlog','-s','master']) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] dev-tools.git: gerritbot/send-daily-digest
gerritbot/send-daily-digest |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 362e11ede8be6fd4b85eb6ed6bfdaf6b946f43b4 Author: Mathias Michel Date: Thu Jan 30 22:57:21 2014 +0100 Finally fix the new commiters issue in mail digest Change-Id: I0555dd87a166641e6f6cb75839274623533acfe1 Reviewed-on: https://gerrit.libreoffice.org/7752 Reviewed-by: Norbert Thiebaud Tested-by: Norbert Thiebaud diff --git a/gerritbot/send-daily-digest b/gerritbot/send-daily-digest index 6786db3..79d86b8 100755 --- a/gerritbot/send-daily-digest +++ b/gerritbot/send-daily-digest @@ -74,7 +74,7 @@ def init_freshers(): subprocess.call(['git','clone','--bare','git://gerrit.libreoffice.org/core',repo_dir]) else: subprocess.call(['git','fetch','origin']) -return subprocess.check_output(['git','shortlog','-s']) +return subprocess.check_output(['git','shortlog','-s','master']) def get_project_body(project): ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits