diff options
author | Valerie R Young <spectranaut@riseup.net> | 2016-08-11 09:17:07 -0400 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2016-08-19 10:40:58 +0200 |
commit | b1b64d98e5971437abb3fe793f6fb58eab1ef4fd (patch) | |
tree | 4c0e66e181bf0711d69f347f2426651cfccf6937 /bin/reproducible_setup_notify.py | |
parent | da31c830940b18986d5890d1ec856475ad645fd5 (diff) | |
download | jenkins.debian.net-b1b64d98e5971437abb3fe793f6fb58eab1ef4fd.tar.xz |
reproducible debian: switch python database backend to SQLAlchemy
Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin/reproducible_setup_notify.py')
-rwxr-xr-x | bin/reproducible_setup_notify.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/bin/reproducible_setup_notify.py b/bin/reproducible_setup_notify.py index 8daee9ed..f7d4be9d 100755 --- a/bin/reproducible_setup_notify.py +++ b/bin/reproducible_setup_notify.py @@ -29,7 +29,6 @@ from reproducible_common import * from reproducible_html_packages import gen_packages_html from reproducible_html_indexes import build_page - class bcolors: BOLD = '\033[1m' UNDERLINE = '\033[4m' @@ -51,14 +50,18 @@ def _good(text): def process_pkg(package, deactivate): if deactivate: - _good('Deactovating notification for package ' + str(package)) + _good('Deactivating notification for package ' + str(package)) flag = 0 else: _good('Activating notification for package ' + str(package)) flag = 1 - rows = c.execute(('UPDATE OR FAIL sources SET notify_maintainer="{}" ' + - 'WHERE name="{}"').format(flag, package)).rowcount - conn_db.commit() + + sources_table = db_table('sources') + update_query = sources_table.update().\ + where(sources_table.c.name == package).\ + values(notify_maintainer=flag) + rows = conn_db.execute(update_query).rowcount + if rows == 0: log.error(bcolors.FAIL + str(package) + ' does not exists') sys.exit(1) @@ -86,8 +89,6 @@ if maintainer: log.info('\t' + ', '.join(pkgs)) packages.extend(pkgs) - -c = conn_db.cursor() for package in packages: process_pkg(package, local_args.deactivate) |