← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~xnox/launchpad/+git/launchpad-private:deathrow-patch into launchpad:master

 

Dimitri John Ledkov has proposed merging ~xnox/launchpad/+git/launchpad-private:deathrow-patch into launchpad:master.

Commit message:
archivepublisher: switch deathrow from md5 to sha256d

Switch canRemove function from using md5 sum to sha256, as is already available in the libraryfile content.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~xnox/launchpad/+git/launchpad-private/+merge/452676
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~xnox/launchpad/+git/launchpad-private:deathrow-patch into launchpad:master.
diff --git a/lib/lp/archivepublisher/deathrow.py b/lib/lp/archivepublisher/deathrow.py
index 439971e..dd4d318 100644
--- a/lib/lp/archivepublisher/deathrow.py
+++ b/lib/lp/archivepublisher/deathrow.py
@@ -160,8 +160,8 @@ class DeathRow:
 
         return (sources, binaries)
 
-    def canRemove(self, publication_class, filename, file_md5):
-        """Check if given (filename, MD5) can be removed from the pool.
+    def canRemove(self, publication_class, filename, file_sha256):
+        """Check if given (filename, SHA256) can be removed from the pool.
 
         Check the archive reference-counter implemented in:
         `SourcePackagePublishingHistory` or
@@ -199,7 +199,7 @@ class DeathRow:
             [
                 LibraryFileAlias.content == LibraryFileContent.id,
                 LibraryFileAlias.filename == filename,
-                LibraryFileContent.md5 == file_md5,
+                LibraryFileContent.sha256 == file_sha256,
             ]
         )
 
@@ -247,9 +247,9 @@ class DeathRow:
             files = pub_record.files
             for pub_file in files:
                 filename = pub_file.libraryfile.filename
-                file_md5 = pub_file.libraryfile.content.md5
+                file_sha256 = pub_file.libraryfile.content.sha256
 
-                self.logger.debug("Checking %s (%s)" % (filename, file_md5))
+                self.logger.debug("Checking %s (%s)" % (filename, file_sha256))
 
                 # Calculating the file path in pool.
                 pub_file_details = (
@@ -269,10 +269,10 @@ class DeathRow:
                     if file_path in condemned_files:
                         condemned_records.add(pub_record)
                     continue
-                considered_files.add((filename, file_md5))
+                considered_files.add((filename, file_sha256))
 
                 # Check if the removal is allowed, if not continue.
-                if not self.canRemove(publication_class, filename, file_md5):
+                if not self.canRemove(publication_class, filename, file_sha256):
                     self.logger.debug("Cannot remove.")
                     continue
 

Follow ups