]> git.decadent.org.uk Git - dak.git/commitdiff
Ensure we have a session so that we can look up srcformats
authorMark Hymers <mhy@debian.org>
Sat, 30 Jul 2011 09:34:32 +0000 (10:34 +0100)
committerMark Hymers <mhy@debian.org>
Sat, 30 Jul 2011 09:34:32 +0000 (10:34 +0100)
Signed-off-by: Mark Hymers <mhy@debian.org>
daklib/queue.py

index f912bef19aec4a97470859463e7eae627b1bf65c..e12a99715e255f335ba3c5adc43596abd7dc86a3 100755 (executable)
@@ -1180,6 +1180,9 @@ class Upload(object):
         if not self.pkg.changes["architecture"].has_key("source"):
             return True
 
+        if session is None:
+            session = DBConn().session()
+
         (status, reason) = self.load_dsc(action=action)
         if not status:
             self.rejects.append(reason)
@@ -1217,7 +1220,11 @@ class Upload(object):
 
         # Only a limited list of source formats are allowed in each suite
         for dist in self.pkg.changes["distribution"].keys():
-            allowed = [ x.format_name for x in dist.srcformats ]
+            suite = get_suite(dist, session=session)
+            if not suite:
+                self.rejects.append("%s: cannot find suite %s when checking source formats" % (dsc_filename, dist))
+                continue
+            allowed = [ x.format_name for x in suite.srcformats ]
             if self.pkg.dsc["format"] not in allowed:
                 self.rejects.append("%s: source format '%s' not allowed in %s (accepted: %s) " % (dsc_filename, self.pkg.dsc["format"], dist, ", ".join(allowed)))