summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-08-21 10:42:37 +0000
committerHolger Levsen <holger@layer-acht.org>2015-08-21 12:52:30 +0200
commitcc3ab05984c71e85632ba32726e841b1b2027957 (patch)
treece7d356fad66e85f29b575ef7a3f4d5518fce568 /bin
parent223041d96396078fd8494f7cdcbe37ecbf032a51 (diff)
downloadjenkins.debian.net-cc3ab05984c71e85632ba32726e841b1b2027957.tar.xz
reproducible: remote_scheduler: fix a TypeError and make more rubost
Diffstat (limited to 'bin')
-rwxr-xr-xbin/reproducible_remote_scheduler.py31
1 files changed, 16 insertions, 15 deletions
diff --git a/bin/reproducible_remote_scheduler.py b/bin/reproducible_remote_scheduler.py
index b259f0a4..0572bb42 100755
--- a/bin/reproducible_remote_scheduler.py
+++ b/bin/reproducible_remote_scheduler.py
@@ -50,7 +50,7 @@ parser.add_argument('packages', metavar='package', nargs='*',
help='list of packages to reschedule')
scheduling_args = parser.parse_known_args()[0]
if scheduling_args.null:
- scheduling_args = parser.parse_known_args(sys.stdin.read().split('\0'))
+ scheduling_args = parser.parse_known_args(sys.stdin.read().split('\0'))[0]
# these are here as an hack to be able to parse the command line
from reproducible_common import *
@@ -162,27 +162,28 @@ query1 = '''SELECT id FROM sources WHERE name="{pkg}" AND suite="{suite}"
AND architecture="{arch}"'''
query2 = '''SELECT p.date_build_started
FROM sources AS s JOIN schedule as p ON p.package_id=s.id
- WHERE s.name="{pkg}"
- AND s.suite="{suite}" AND s.architecture="{arch}"'''
+ WHERE p.package_id="{id}"'''
for pkg in packages:
# test whether the package actually exists
result = query_db(query1.format(pkg=pkg, suite=suite, arch=arch))
+ # tests whether the package is already building
try:
- # tests whether the package is already building
- result2 = query_db(query2.format(pkg=pkg, suite=suite, arch=arch))
- try:
- if not result2[0][0]:
- ids.append(result[0][0])
- pkgs.append(pkg)
- else:
- log.warning(bcolors.WARN + 'The package ' + pkg + ' is ' +
- 'already building, not scheduling it.' + bcolors.ENDC)
- except IndexError:
+ result2 = query_db(query2.format(id=result[0][0]))
+ except IndexError:
+ log.error('%sThe package %s is not available in %s/%s%s',
+ bcolors.FAIL, pkg, suite, arch, bcolors.ENDC)
+ continue
+ try:
+ if not result2[0][0]:
ids.append(result[0][0])
pkgs.append(pkg)
+ else:
+ log.warning(bcolors.WARN + 'The package ' + pkg + ' is ' +
+ 'already building, not scheduling it.' + bcolors.ENDC)
except IndexError:
- log.error('%sThe package %s is not available in %s/%s%s',
- bcolors.FAIL, pkg, suite, arch, bcolors.ENDC)
+ # it's not in the schedule
+ ids.append(result[0][0])
+ pkgs.append(pkg)
blablabla = '✂…' if len(' '.join(pkgs)) > 257 else ''
packages_txt = ' packages ' if len(pkgs) > 1 else ' package '