From 0e38e75fac3b6ae71f664a28feb40b92acff1ed7 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Thu, 28 May 2015 23:02:18 +0200 Subject: reproducible: setup_notify: also allow passing a maintainer email, the script will look up packages maintained by that email in sid (using udd) and flag them --- bin/reproducible_setup_notify.py | 44 +++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/bin/reproducible_setup_notify.py b/bin/reproducible_setup_notify.py index 80ef9a63..3b79016a 100755 --- a/bin/reproducible_setup_notify.py +++ b/bin/reproducible_setup_notify.py @@ -16,11 +16,12 @@ parser = argparse.ArgumentParser( 'maintainer when the reproducibly status change', epilog='The build results will be announced on the #debian-reproducible' + ' IRC channel.') -group = parser.add_mutually_exclusive_group() parser.add_argument('-o', '--deactivate', action='store_true', help='Deactivate the notifications') -group.add_argument('-p', '--packages', default='', nargs='+', - help='list of packages for which activate notifications') +parser.add_argument('-p', '--packages', default='', nargs='+', + help='list of packages for which activate notifications') +parser.add_argument('-m', '--maintainer', default='', + help='email of a maintainer interested in his packages') local_args = parser.parse_known_args()[0] # these are here as an hack to be able to parse the command line @@ -35,19 +36,19 @@ class bcolors: FAIL = '\033[91m' + BOLD + UNDERLINE ENDC = '\033[0m' -packages = local_args.packages +packages = local_args.packages if local_args.packages else [] +maintainer = local_args.maintainer -if not packages: - log.critical(bcolors.FAIL + 'You have to specify at least a package' + - bcolors.ENDC) +if not packages and not maintainer: + log.critical(bcolors.FAIL + 'You have to specify at least a package ' + + 'or a maintainer.' + bcolors.ENDC) def _good(text): log.info(bcolors.GOOD + str(text) + bcolors.ENDC) -c = conn_db.cursor() -for package in packages: - if local_args.deactivate: +def process_pkg(package, deactivate): + if deactivate: _good('Deactovating notification for package ' + str(package)) flag = 0 else: @@ -65,3 +66,26 @@ for package in packages: log.debug(query_db(query)) +if maintainer: + global conn_udd + if not conn_udd: + conn_udd = start_udd_connection() + c = conn_udd.cursor() + query = "SELECT source FROM sources WHERE maintainer_email = '{}' " + \ + "AND release = 'sid'" + try: + c.execute(query.format(maintainer)) + pkgs = [x[0] for x in c.fetchall()] + except IndexError: + log.info('No packages maintained by ' + maintainer) + sys.exit(0) + finally: + conn_udd.close() + log.info('Packages maintained by ' + maintainer + ':') + log.info('\t' + ', '.join(pkgs)) + packages.extend(pkgs) + + +c = conn_db.cursor() +for package in packages: + process_pkg(package, local_args.deactivate) -- cgit v1.2.3-54-g00ecf