]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/queue.py
Test and Improve source_exists().
[dak.git] / daklib / queue.py
index 305d4838f985990137eb41c8c8ece58cca90e80d..ab688bf2a2f575b2b9268369195d0d2d5846a4ac 100755 (executable)
@@ -171,8 +171,8 @@ def determine_new(filename, changes, files, warn=1, session = None):
             newsuite = get_suite(oldsuite.overridesuite, session)
 
             if newsuite:
-                print "WARNING: overriding suite %s to suite %s" % (
-                    suite, oldsuite.overridesuite)
+                print "INFORMATION: Using overrides from suite %s instead of suite %s" % (
+                    oldsuite.overridesuite, suite)
                 del changes["suite"][suite]
                 changes["suite"][oldsuite.overridesuite] = 1
             else:
@@ -332,7 +332,7 @@ def prod_maintainer(notes, upload):
 
 ################################################################################
 
-def edit_note(note, upload, session):
+def edit_note(note, upload, session, trainee=False):
     # Write the current data to a temporary file
     (fd, temp_filename) = utils.temp_filename()
     editor = os.environ.get("EDITOR","vi")
@@ -364,7 +364,7 @@ def edit_note(note, upload, session):
     comment.version = upload.pkg.changes["version"]
     comment.comment = newnote
     comment.author  = utils.whoami()
-    comment.trainee = bool(Options["Trainee"])
+    comment.trainee = trainee
     session.add(comment)
     session.commit()
 
@@ -795,7 +795,8 @@ class Upload(object):
                                     (source_version, f, self.pkg.changes["version"]))
         else:
             # Check in the SQL database
-            if not source_exists(source_package, source_version, self.pkg.changes["distribution"].keys(), session):
+            if not source_exists(source_package, source_version, suites = \
+                self.pkg.changes["distribution"].keys(), session = session):
                 # Check in one of the other directories
                 source_epochless_version = re_no_epoch.sub('', source_version)
                 dsc_filename = "%s_%s.dsc" % (source_package, source_epochless_version)
@@ -805,7 +806,7 @@ class Upload(object):
                     entry["new"] = 1
                 else:
                     dsc_file_exists = False
-                    for myq in ["Embargoed", "Unembargoed", "ProposedUpdates", "OldProposedUpdates", "Lenny-Volatile-Proposed-Updates"]:
+                    for myq in ["Embargoed", "Unembargoed", "ProposedUpdates", "OldProposedUpdates"]:
                         if cnf.has_key("Dir::Queue::%s" % (myq)):
                             if os.path.exists(os.path.join(cnf["Dir::Queue::" + myq], dsc_filename)):
                                 dsc_file_exists = True
@@ -1918,6 +1919,7 @@ distribution."""
 
         for dist in self.pkg.changes["distribution"].keys():
             suite = get_suite(dist)
+            if suite is None: continue
             announce_list = suite.announce
             if announce_list == "" or lists_done.has_key(announce_list):
                 continue
@@ -2056,7 +2058,7 @@ distribution."""
 
         # Copy the .changes file across for suite which need it.
         copy_changes = dict([(x.copychanges, '')
-                             for x in session.query(Suite).filter(Suite.suite_name.in_([self.pkg.changes["distribution"].keys()])).all()
+                             for x in session.query(Suite).filter(Suite.suite_name.in_(self.pkg.changes["distribution"].keys())).all()
                              if x.copychanges is not None])
 
         for dest in copy_changes.keys():
@@ -2366,7 +2368,7 @@ distribution."""
 
         # Override suite name; used for example with proposed-updates
         oldsuite = get_suite(suite, session)
-        if oldsuite.overridesuite:
+        if (not oldsuite is None) and oldsuite.overridesuite:
             suite = oldsuite.overridesuite
 
         result = get_override(package, suite, component, file_type, session)
@@ -2680,7 +2682,8 @@ distribution."""
                 source_version = entry["source version"]
                 source_package = entry["source package"]
                 if not self.pkg.changes["architecture"].has_key("source") \
-                   and not source_exists(source_package, source_version, self.pkg.changes["distribution"].keys(), session):
+                   and not source_exists(source_package, source_version, \
+                    suites = self.pkg.changes["distribution"].keys(), session = session):
                     source_epochless_version = re_no_epoch.sub('', source_version)
                     dsc_filename = "%s_%s.dsc" % (source_package, source_epochless_version)
                     found = False
@@ -2727,7 +2730,9 @@ distribution."""
                 source_version = entry["source version"]
                 source_package = entry["source package"]
                 if not self.pkg.changes["architecture"].has_key("source") \
-                   and not source_exists(source_package, source_version,  self.pkg.changes["distribution"].keys()):
+                   and not source_exists(source_package, source_version, \
+                    suites = self.pkg.changes["distribution"].keys(), \
+                    session = session):
                     self.rejects.append("no source found for %s %s (%s)." % (source_package, source_version, checkfile))
 
             # Version and file overwrite checks