From: Mark Hymers Date: Sat, 26 Mar 2011 21:43:01 +0000 (+0000) Subject: Be more robust to missing suites X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=891685b58799d3169f70ee501c0c82e5ab434b81;p=dak.git Be more robust to missing suites Signed-off-by: Mark Hymers --- diff --git a/daklib/dbconn.py b/daklib/dbconn.py index c6612b72..482ec471 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -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) diff --git a/daklib/queue.py b/daklib/queue.py index ef781f19..42fd6245 100755 --- a/daklib/queue.py +++ b/daklib/queue.py @@ -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") ]