← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/fix-by-hash-pruning into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/fix-by-hash-pruning into lp:launchpad.

Commit message:
Really force Release file regeneration for archives with reapable by-hash files.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/fix-by-hash-pruning/+merge/290805

Really force Release file regeneration for archives with reapable by-hash files.

The whole release_files_needed stuff could do with a broader refactoring, but this is a minimal fix.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/fix-by-hash-pruning into lp:launchpad.
=== modified file 'lib/lp/archivepublisher/publishing.py'
--- lib/lp/archivepublisher/publishing.py	2016-04-02 00:44:01 +0000
+++ lib/lp/archivepublisher/publishing.py	2016-04-02 21:40:27 +0000
@@ -738,7 +738,7 @@
             distroseries, pocket = self.distro.getDistroSeriesAndPocket(
                 container[len(u"release:"):])
             archive_file_suites.add((distroseries, pocket))
-        self.release_files_needed.update(archive_file_suites)
+            self.release_files_needed.add((distroseries.name, pocket))
 
         for distroseries in self.distro:
             for pocket in self.archive.getPockets():

=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
--- lib/lp/archivepublisher/tests/test_publisher.py	2016-04-02 00:44:01 +0000
+++ lib/lp/archivepublisher/tests/test_publisher.py	2016-04-02 21:40:27 +0000
@@ -2490,10 +2490,6 @@
                 with open(suite_path('main', 'source', name), 'rb') as f:
                     main_contents.add(f.read())
         transaction.commit()
-        # Undo any previous determination that breezy-autotest is dirty, so
-        # that we can use that to check that future runs don't force index
-        # regeneration.
-        publisher.dirty_pockets = set()
 
         self.assertThat(
             suite_path('main', 'source', 'by-hash'),
@@ -2520,10 +2516,18 @@
             suite_path('main', 'source', 'by-hash'),
             Not(ByHashHasContents(main_contents)))
 
+        # Use a fresh Publisher instance to ensure that it doesn't have
+        # dirty-pocket state left over from the last run.
+        publisher = Publisher(
+            self.logger, self.config, self.disk_pool,
+            self.ubuntutest.main_archive)
         publisher.A2_markPocketsWithDeletionsDirty()
         publisher.C_doFTPArchive(False)
         publisher.D_writeReleaseFiles(False)
         self.assertEqual(set(), publisher.dirty_pockets)
+        self.assertContentEqual(
+            [('breezy-autotest', PackagePublishingPocket.RELEASE)],
+            publisher.release_files_needed)
         self.assertThat(
             suite_path('main', 'source', 'by-hash'),
             ByHashHasContents(main_contents))


Follow ups