summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_setup_notify.py
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-05-28 23:02:18 +0200
committerHolger Levsen <holger@layer-acht.org>2015-05-29 16:24:59 +0200
commit0e38e75fac3b6ae71f664a28feb40b92acff1ed7 (patch)
tree06fbb7792f09f6a572b3ac3a4f188b6948530691 /bin/reproducible_setup_notify.py
parent91fe81a82a3facd23d3a59c4d43bff7dffbbca77 (diff)
downloadjenkins.debian.net-0e38e75fac3b6ae71f664a28feb40b92acff1ed7.tar.xz
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
Diffstat (limited to 'bin/reproducible_setup_notify.py')
-rwxr-xr-xbin/reproducible_setup_notify.py44
1 files 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)