]> err.no Git - dak/commitdiff
Be more robust to missing suites
authorMark Hymers <mhy@debian.org>
Sat, 26 Mar 2011 21:43:01 +0000 (21:43 +0000)
committerMark Hymers <mhy@debian.org>
Sat, 26 Mar 2011 21:43:09 +0000 (21:43 +0000)
Signed-off-by: Mark Hymers <mhy@debian.org>
daklib/dbconn.py
daklib/queue.py

index c6612b72519235bd06df3fd6eeb663b93b8a8308..482ec471bf64db2391ed833266fd766192d5aa01 100755 (executable)
@@ -3147,7 +3147,9 @@ __all__.append('VersionCheck')
 def get_version_checks(suite_name, check = None, session = None):
     suite = get_suite(suite_name, session)
     if not suite:
-        return None
+        # Make sure that what we return is iterable so that list comprehensions
+        # involving this don't cause a traceback
+        return []
     q = session.query(VersionCheck).filter_by(suite=suite)
     if check:
         q = q.filter_by(check=check)
index ef781f19e6c24fcdad659349e6669f6d231b0596..42fd62453e6e2babe1027a046182dcd6f433b698 100755 (executable)
@@ -2547,6 +2547,12 @@ distribution."""
 
         # Check versions for each target suite
         for target_suite in self.pkg.changes["distribution"].keys():
+            # Check we can find the target suite
+            ts = get_suite(target_suite)
+            if ts is None:
+                self.rejects.append("Cannot find target suite %s to perform version checks" % target_suite)
+                continue
+
             must_be_newer_than = [ vc.reference.suite_name for vc in get_version_checks(target_suite, "MustBeNewerThan") ]
             must_be_older_than = [ vc.reference.suite_name for vc in get_version_checks(target_suite, "MustBeOlderThan") ]