]> git.decadent.org.uk Git - dak.git/commitdiff
Do not require all attributes to match
authorAnsgar Burchardt <ansgar@debian.org>
Thu, 13 Aug 2015 09:33:53 +0000 (11:33 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Thu, 13 Aug 2015 09:37:15 +0000 (11:37 +0200)
If the same source or binary package is uploaded again, the
fingerprint and changed_by might be different if some other person
signed the new .changes (or if there is no .changes). We still want to
be able to import such packages without error, retaining the
attributes already present.

daklib/archive.py

index 44931ffc0a55424866875e7210cf5522ffa3d2c1..3b55b3f79092fe55429e0bc599a0a77822b29474 100644 (file)
@@ -176,6 +176,10 @@ class ArchiveTransaction(object):
             maintainer=maintainer,
             poolfile=db_file,
             binarytype=binary.type,
+            )
+        # Other attributes that are ignored for purposes of equality with
+        # an existing source
+        rest2 = dict(
             fingerprint=fingerprint,
             )
 
@@ -188,6 +192,8 @@ class ArchiveTransaction(object):
             db_binary = DBBinary(**unique)
             for key, value in rest.iteritems():
                 setattr(db_binary, key, value)
+            for key, value in rest2.iteritems():
+                setattr(db_binary, key, value)
             session.add(db_binary)
             session.flush()
             import_metadata_into_db(db_binary, session)
@@ -301,12 +307,16 @@ class ArchiveTransaction(object):
             )
         rest = dict(
             maintainer=maintainer,
-            changedby=changed_by,
             #install_date=datetime.now().date(),
             poolfile=db_file_dsc,
-            fingerprint=fingerprint,
             dm_upload_allowed=(control.get('DM-Upload-Allowed', 'no') == 'yes'),
             )
+        # Other attributes that are ignored for purposes of equality with
+        # an existing source
+        rest2 = dict(
+            changedby=changed_by,
+            fingerprint=fingerprint,
+            )
 
         created = False
         try:
@@ -319,6 +329,8 @@ class ArchiveTransaction(object):
             db_source = DBSource(**unique)
             for key, value in rest.iteritems():
                 setattr(db_source, key, value)
+            for key, value in rest2.iteritems():
+                setattr(db_source, key, value)
             # XXX: set as default in postgres?
             db_source.install_date = datetime.now().date()
             session.add(db_source)