scripts/send-recipe-update-reminders: add a script to send recipe version update reminders by email
PATCH 1/1 scripts/send-recipe-update-reminders: add a script to send recipe version update reminders by email
This script will determine (via bitbake -c checkpkg world) which recipes are in need of a version update, sort them by their assigned maintainers, and send personal emails to the maintainers requesting that the recipes should be updated. Also, it will send a summary to the openembedded-core mailing list. The actual sending happens only if --send parameter is used, otherwise the script only prints the summary to standard output.
For instance, if the script were run now, I would get:
=====================
The following oe-core packages, for which you are listed as the maintainer, are in need of a version update. Please prepare and send the patches to the openembedded-core mailing list.
Package name OE-Core Upstream
============
epiphany 3.24.3 3.26.1 gtk-doc 1.25 1.26 libnl 3.2.29 3.4.0 openssl 1.0.2l 1.1.0f psmisc 22.21 23.1
=====================
I intend to run the script about twice in each development cycle, first towards the start and then towards the end of the merge window. So that reminders happen altogether maybe four times a year, which hopefully no one finds bothersome.
YP used to have a much more sophisticated system called Automated Upgrade Helper for this, but it hasn't been heard from in several months and so I quickly rolled my own cheap and cheery replacement.
--- scripts/send-recipe-update-reminders | 81 ++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 scripts/send-recipe-update-reminders
scripts/send-recipe-update-reminders new file +81 -0
@@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +import os +import argparse +import subprocess +import smtplib +from email.mime.text import MIMEText + +parser = argparse.ArgumentParser(description='Print recipes in need of version update and optionally send email reminders to maintainers to do it.') +parser.add_argument('--send', action='store_true', help='actually send the emails. SMTP server and sender name/email are taken from git config.') +args = parser.parse_args() + +try: + builddir = os.environ['BUILDDIR'] +except KeyError: + print ("BUILDDIR environment variable is not defined; did you initialize using oe-init-build-env?") + exit() + +if os.system('bitbake -c checkpkg world') != 0: + exit() +checkpkgfile = open(builddir + '/tmp/log/checkpkg.csv') + +# skip the first line as it's just headers +checkpkgfile.readline() + +pkgs_to_update_by_maintainer = {} +for i in checkpkgfile.readlines(): + fields = i.split('\t') + maintainer = fields[-2] + no_update_reason = fields[-1] + status = fields[-5] + if status == 'UPDATE' and len(no_update_reason) <= 1 and len(maintainer) > 0: + pkgs_to_update_by_maintainer.setdefault(maintainer, []) + pkgs_to_update_by_maintainer[maintainer].append(fields[:3]) + +for (maintainer, recipes) in pkgs_to_update_by_maintainer.items(): + recipes.sort() + +publicmsg = """The following oe-core packages are in need of a version update. + +{} +""".format("\n".join(["{}:\n================\n{}\n".format(maintainer, "\n".join(["{:30} {:10} {:10}".format(recipe[0], recipe[1], recipe[2]) for recipe in recipes])) for (maintainer, recipes) in pkgs_to_update_by_maintainer.items()])) + +print (publicmsg) + +if not args.send: + print ("Use --send to send email reminders about the above.") + exit() + +privatemsg = """The following oe-core packages, for which you are listed as the maintainer, are in need of a version update. +Please prepare and send the patches to the openembedded-core mailing list. + +{:30} {:10} {:10} +============ +""".format("Package name", "OE-Core", "Upstream") + + +privatemessages = {} +for (maintainer, recipes) in pkgs_to_update_by_maintainer.items(): + privatemessages[maintainer] = "{}{}".format(privatemsg, "\n".join(["{:30} {:10} {:10}".format(recipe[0], recipe[1], recipe[2]) for recipe in recipes])) + +smtpserver = subprocess.check_output('git config sendemail.smtpserver', shell=True).decode().strip() +username = subprocess.check_output('git config user.name', shell=True).decode().strip() +useremail = subprocess.check_output('git config user.email', shell=True).decode().strip() + +s = smtplib.SMTP(smtpserver) +publicemail = MIMEText(publicmsg) +publicemail['Subject'] = "OE-Core recipes in need of a version update" +publicemail['From'] = "{} <{}>".format(username, useremail) +publicemail['To'] = "[email protected]" +print ("Sending a message to oe-core list") +s.send_message(publicemail) + +for (maintainer, message) in privatemessages.items(): + privateemail = MIMEText(message) + privateemail['Subject'] = "Please update the following OE-Core recipes" + privateemail['From'] = "{} <{}>".format(username, useremail) + privateemail['To'] = maintainer + print ("Sending a message to {}".format(maintainer)) + s.send_message(privateemail) + +s.quit()
Signature · 1 line
2.14.1
✗ patchtest: failure for scripts/send-recipe-update-reminders: add a script to send recipe version update reminders by email
== Series Details ==
Series: scripts/send-recipe-update-reminders: add a script to send recipe version update reminders by email
Revision: 1
URL : https://patchwork.openembedded.org/series/9378/
State : failure
== Summary ==
Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:
* Patch scripts/send-recipe-update-reminders: add a script to send recipe version update reminders by email Issue Commit shortlog is too long [test_shortlog_length] Suggested fix Edit shortlog so that it is 90 characters or less (currently 99 characters)
If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).
---
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest Test suite: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe