[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] Only inject processed uploads into signature_history



Uploads that were 'skipped' should not be recorded in
signature_history as they will be repeocessed later.
---
 dak/process_upload.py |    7 +++++++
 daklib/checks.py      |    4 +---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/dak/process_upload.py b/dak/process_upload.py
index 1518d26..9eb23f0 100755
--- a/dak/process_upload.py
+++ b/dak/process_upload.py
@@ -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))
diff --git a/daklib/checks.py b/daklib/checks.py
index 3fb883c..4368273 100644
--- a/daklib/checks.py
+++ b/daklib/checks.py
@@ -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)
-- 
1.7.10.4


Reply to: