summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_remote_scheduler.py
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-06-21 13:54:47 +0000
committerHolger Levsen <holger@layer-acht.org>2015-07-05 15:07:56 +0200
commit66a8983a5dfa1719ba824ff8ed81aefa8e58fdaa (patch)
tree60c12b255dc4b83653a1e36273a222b93c5586bf /bin/reproducible_remote_scheduler.py
parent40065dbfa83e6db51c2eda10b1299965a61f9b84 (diff)
downloadjenkins.debian.net-66a8983a5dfa1719ba824ff8ed81aefa8e58fdaa.tar.xz
reproducible: scheduler: accept an -i option to schedule all package affected by a given issue. Also allow passing 0 package to the script
Diffstat (limited to 'bin/reproducible_remote_scheduler.py')
-rwxr-xr-xbin/reproducible_remote_scheduler.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/reproducible_remote_scheduler.py b/bin/reproducible_remote_scheduler.py
index db4bce4f..580d6882 100755
--- a/bin/reproducible_remote_scheduler.py
+++ b/bin/reproducible_remote_scheduler.py
@@ -28,7 +28,9 @@ parser.add_argument('-m', '--message', default='', nargs='+',
' about the scheduling')
parser.add_argument('-s', '--suite', required=True,
help='Specify the suite to schedule in')
-parser.add_argument('packages', metavar='package', nargs='+',
+parser.add_argument('-i', '--issue', required=False,
+ help='Schedule all packages with this issue(s)')
+parser.add_argument('packages', metavar='package', nargs='*',
help='list of packages to reschedule')
scheduling_args = parser.parse_known_args()[0]
@@ -64,6 +66,7 @@ except KeyError:
suite = scheduling_args.suite
reason = ' '.join(scheduling_args.message)
+issue = scheduling_args.issue
packages = scheduling_args.packages
artifacts = scheduling_args.artifacts
notify = not scheduling_args.no_notify or scheduling_args.noisy
@@ -76,6 +79,7 @@ log.debug('Artifacts: ' + str(artifacts))
log.debug('Notify: ' + str(notify))
log.debug('Debug url: ' + str(debug_url))
log.debug('Architecture: ' + defaultarch)
+log.debug('Issue: ' + issue if issue else str(None))
log.debug('Suite: ' + suite)
log.debug('Packages: ' + ' '.join(packages))
@@ -84,6 +88,16 @@ if suite not in SUITES:
log.critical('Please chose between ' + ', '.join(SUITES))
sys.exit(1)
+if issue:
+ log.info('Querying packages with given issues in the given suite...')
+ query = 'SELECT s.name ' + \
+ 'FROM sources AS s JOIN notes AS n ON n.package_id=s.id ' + \
+ 'WHERE n.issues like "%{issue}%" and s.suite = "{suite}"'
+ results = query_db(query.format(issue=issue, suite=suite))
+ results = [x for (x,) in results]
+ log.info('Selected packages: ' + ' '.join(results))
+ packages.extend(results)
+
if len(packages) > 50 and notify:
log.critical(bcolors.RED + bcolors.BOLD)
call(['figlet', 'No.'])