]> git.donarmstrong.com Git - dak.git/commitdiff
Only inject processed uploads into signature_history
authorAnsgar Burchardt <ansgar@debian.org>
Sun, 10 Aug 2014 16:22:01 +0000 (18:22 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Sun, 10 Aug 2014 16:30:28 +0000 (18:30 +0200)
Uploads that were 'skipped' should not be recorded in
signature_history as they will be repeocessed later.

dak/process_upload.py
daklib/checks.py

index 1518d262ad78bc42f221a1630f90804f5578ee1a..9eb23f00309c1d5d30c74bc074ef676b7239e774 100755 (executable)
@@ -463,6 +463,13 @@ def process_it(directory, changes, keyrings, session):
     with daklib.archive.ArchiveUpload(directory, changes, keyrings) as upload:
         processed = action(directory, upload)
         if processed and not Options['No-Action']:
+            session = DBConn().session()
+            history = SignatureHistory.from_signed_file(upload.changes)
+            if history.query(session) is None:
+                session.add(history)
+                session.commit()
+            session.close()
+
             unlink_if_exists(os.path.join(directory, changes.filename))
             for fn in changes.files:
                 unlink_if_exists(os.path.join(directory, fn))
index 3fb883c539270a0e9f4a8f7689af60d9302efe2c..436827372c9b9d27074b722ded838a1c1ac5de92 100644 (file)
@@ -112,13 +112,11 @@ class SignatureAndHashesCheck(Check):
     def check_replay(self, upload):
         # Use private session as we want to remember having seen the .changes
         # in all cases.
-        session = DBConn().session()
+        session = upload.session
         history = SignatureHistory.from_signed_file(upload.changes)
         r = history.query(session)
         if r is not None:
             raise Reject('Signature for changes file was already seen at {0}.\nPlease refresh the signature of the changes file if you want to upload it again.'.format(r.seen))
-        session.add(history)
-        session.commit()
         return True
 
     """Check signature of changes and dsc file (if included in upload)