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

[dak/master] Do not require all attributes to match



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 | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/daklib/archive.py b/daklib/archive.py
index 44931ff..3b55b3f 100644
--- a/daklib/archive.py
+++ b/daklib/archive.py
@@ -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)
-- 
2.1.4



Reply to: