]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/queue.py
generate-packages-sources
[dak.git] / daklib / queue.py
index bd6560be2494378d79016eceded04693bf014dd8..3ab87246d1601f1fc5dd52912293deb155f95b38 100755 (executable)
@@ -454,7 +454,7 @@ class Upload(object):
 
         # Check the .changes is non-empty
         if not self.pkg.files:
-            self.rejects.append("%s: nothing to do (Files field is empty)." % (base_filename))
+            self.rejects.append("%s: nothing to do (Files field is empty)." % (os.path.basename(self.pkg.changes_file)))
             return False
 
         # Changes was syntactically valid even if we'll reject
@@ -1899,8 +1899,8 @@ distribution."""
                     # Make sure that our source object is up-to-date
                     session.expire(source)
 
-            # Add changelog information to the database
-            self.store_changelog()
+        # Add changelog information to the database
+        self.store_changelog()
 
         # Install the files into the pool
         for newfile, entry in self.pkg.files.items():
@@ -2686,6 +2686,15 @@ distribution."""
 
         session = DBConn().session()
 
+        # Check if upload already has a changelog entry
+        query = """SELECT changelog_id FROM changes WHERE source = :source
+                   AND version = :version AND architecture = :architecture AND changelog_id != 0"""
+        if session.execute(query, {'source': self.pkg.changes['source'], \
+                                   'version': self.pkg.changes['version'], \
+                                   'architecture': " ".join(self.pkg.changes['architecture'].keys())}).rowcount:
+            session.commit()
+            return
+
         # Add current changelog text into changelogs_text table, return created ID
         query = "INSERT INTO changelogs_text (changelog) VALUES (:changelog) RETURNING id"
         ID = session.execute(query, {'changelog': self.pkg.changes['changes']}).fetchone()[0]