[Qa-jenkins-scm] [jenkins.debian.net] 02/02: reproducible: remote_scheduler: fix a TypeError and make more rubost

Holger Levsen holger at moszumanska.debian.org
Fri Aug 21 10:52:42 UTC 2015


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit cc3ab05984c71e85632ba32726e841b1b2027957
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Fri Aug 21 10:42:37 2015 +0000

    reproducible: remote_scheduler: fix a TypeError and make more rubost
---
 bin/reproducible_remote_scheduler.py | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/bin/reproducible_remote_scheduler.py b/bin/reproducible_remote_scheduler.py
index b259f0a..0572bb4 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 '

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list