← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:simplify-publisher-suite-sets into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:simplify-publisher-suite-sets into launchpad:master.

Commit message:
Simplify sets-of-suites handling in the publisher

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/410439

Rather than storing sets of tuples of (distroseries name, pocket), it's equivalent and simpler to just store sets of suite names, which are composed from the distroseries name and the pocket.  This means that we don't have to worry about details such as whether security-proxied enumeration items behave identically to unproxied items for purposes of set membership checks (in some situations they don't).  The code is also slightly shorter and easier to follow this way.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:simplify-publisher-suite-sets into launchpad:master.
diff --git a/lib/lp/archivepublisher/model/ftparchive.py b/lib/lp/archivepublisher/model/ftparchive.py
index d56b881..a5b6e32 100644
--- a/lib/lp/archivepublisher/model/ftparchive.py
+++ b/lib/lp/archivepublisher/model/ftparchive.py
@@ -232,7 +232,7 @@ class FTPArchiveHandler:
                         continue
 
                 self.publisher.release_files_needed.add(
-                    (distroseries.name, pocket))
+                    distroseries.getSuite(pocket))
 
                 for comp in components:
                     self.createEmptyPocketRequest(distroseries, pocket, comp)
@@ -768,9 +768,8 @@ class FTPArchiveHandler:
 
         Otherwise, we aim to limit our config to certain distroseries
         and pockets. By default, we will exclude release pockets for
-        released series, and in addition we exclude any pocket not
-        explicitly marked as dirty. dirty_pockets must be a nested
-        dictionary of booleans, keyed by distroseries.name then pocket.
+        released series, and in addition we exclude any suite not
+        explicitly marked as dirty.
         """
         apt_config = six.StringIO()
         apt_config.write(CONFIG_HEADER % (self._config.archiveroot,
diff --git a/lib/lp/archivepublisher/publishing.py b/lib/lp/archivepublisher/publishing.py
index 708e9de..6340738 100644
--- a/lib/lp/archivepublisher/publishing.py
+++ b/lib/lp/archivepublisher/publishing.py
@@ -1,4 +1,4 @@
-# Copyright 2009-2019 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2021 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __all__ = [
@@ -416,15 +416,16 @@ class Publisher(object):
 
         Publishers need the pool root dir and a DiskPool object.
 
-        Optionally we can pass a list of tuples, (distroseries.name, pocket),
-        which will restrict the publisher actions, only suites listed in
-        allowed_suites will be modified.
+        Optionally we can pass a list of suite names which will restrict the
+        publisher actions; only suites listed in allowed_suites will be
+        modified.
         """
         self.log = log
         self._config = config
         self.distro = archive.distribution
         self.archive = archive
-        self.allowed_suites = allowed_suites
+        self.allowed_suites = (
+            None if allowed_suites is None else set(allowed_suites))
 
         self._diskpool = diskpool
 
@@ -433,14 +434,14 @@ class Publisher(object):
         else:
             self._library = library
 
-        # Track which distroseries pockets have been dirtied by a
-        # change, and therefore need domination/apt-ftparchive work.
-        # This is a set of tuples in the form (distroseries.name, pocket)
-        self.dirty_pockets = set()
+        # Track which suites have been dirtied by a change, and therefore
+        # need domination/apt-ftparchive work.  This is a set of suite names
+        # as returned by DistroSeries.getSuite.
+        self.dirty_suites = set()
 
-        # Track which pockets need release files. This will contain more
-        # than dirty_pockets in the case of a careful index run.
-        # This is a set of tuples in the form (distroseries.name, pocket)
+        # Track which suites need release files.  This will contain more
+        # than dirty_suites in the case of a careful index run.
+        # This is a set of suite names as returned by DistroSeries.getSuite.
         self.release_files_needed = set()
 
     def setupArchiveDirs(self):
@@ -449,12 +450,12 @@ class Publisher(object):
 
     def isDirty(self, distroseries, pocket):
         """True if a publication has happened in this release and pocket."""
-        return (distroseries.name, pocket) in self.dirty_pockets
+        return distroseries.getSuite(pocket) in self.dirty_suites
 
-    def markPocketDirty(self, distroseries, pocket):
-        """Mark a pocket dirty only if it's allowed."""
+    def markSuiteDirty(self, distroseries, pocket):
+        """Mark a suite dirty only if it's allowed."""
         if self.isAllowed(distroseries, pocket):
-            self.dirty_pockets.add((distroseries.name, pocket))
+            self.dirty_suites.add(distroseries.getSuite(pocket))
 
     def isAllowed(self, distroseries, pocket):
         """Whether or not the given suite should be considered.
@@ -465,7 +466,7 @@ class Publisher(object):
         Otherwise, return False.
         """
         return (not self.allowed_suites or
-                (distroseries.name, pocket) in self.allowed_suites)
+                distroseries.getSuite(pocket) in self.allowed_suites)
 
     @property
     def subcomponents(self):
@@ -546,7 +547,7 @@ class Publisher(object):
 
         Consider records returned by getPendingSourcePublications.
         """
-        dirty_pockets = set()
+        dirty_suites = set()
         all_spphs = self.getPendingSourcePublications(is_careful)
         for (distroseries, pocket), spphs in groupby(
                 all_spphs, attrgetter("distroseries", "pocket")):
@@ -561,8 +562,8 @@ class Publisher(object):
                             distroseries.status.name))
             else:
                 self.publishSources(distroseries, pocket, spphs)
-                dirty_pockets.add((distroseries.name, pocket))
-        return dirty_pockets
+                dirty_suites.add(distroseries.getSuite(pocket))
+        return dirty_suites
 
     def getPendingBinaryPublications(self, is_careful):
         """Return the specific group of binary records to be published."""
@@ -602,7 +603,7 @@ class Publisher(object):
 
         Consider records returned by getPendingBinaryPublications.
         """
-        dirty_pockets = set()
+        dirty_suites = set()
         all_bpphs = self.getPendingBinaryPublications(is_careful)
         for (distroarchseries, pocket), bpphs in groupby(
                 all_bpphs, attrgetter("distroarchseries", "pocket")):
@@ -618,8 +619,8 @@ class Publisher(object):
                             distroseries.status.name))
             else:
                 self.publishBinaries(distroarchseries, pocket, bpphs)
-                dirty_pockets.add((distroseries.name, pocket))
-        return dirty_pockets
+                dirty_suites.add(distroseries.getSuite(pocket))
+        return dirty_suites
 
     def A_publish(self, force_publishing):
         """First step in publishing: actual package publishing.
@@ -631,9 +632,9 @@ class Publisher(object):
         """
         self.log.debug("* Step A: Publishing packages")
 
-        self.dirty_pockets.update(
+        self.dirty_suites.update(
             self.findAndPublishSources(is_careful=force_publishing))
-        self.dirty_pockets.update(
+        self.dirty_suites.update(
             self.findAndPublishBinaries(is_careful=force_publishing))
 
     def A2_markPocketsWithDeletionsDirty(self):
@@ -654,9 +655,9 @@ class Publisher(object):
                 table.dateremoved == None,
                 ]
 
-        # We need to get a set of (distroseries, pocket) tuples that have
-        # publications that are waiting to be deleted.  Each tuple is
-        # added to the dirty_pockets set.
+        # We need to get a set of suite names that have publications that
+        # are waiting to be deleted.  Each suite name is added to the
+        # dirty_suites set.
 
         # Make the source publications query.
         conditions = base_conditions(SourcePackagePublishingHistory)
@@ -688,7 +689,7 @@ class Publisher(object):
                 # stable distroseries, no matter what other bugs
                 # that precede here have dirtied it.
                 continue
-            self.markPocketDirty(distroseries, pocket)
+            self.markSuiteDirty(distroseries, pocket)
 
     def B_dominate(self, force_domination):
         """Second step in publishing: domination."""
@@ -729,7 +730,7 @@ class Publisher(object):
                         continue
                     self.checkDirtySuiteBeforePublishing(distroseries, pocket)
 
-                self.release_files_needed.add((distroseries.name, pocket))
+                self.release_files_needed.add(distroseries.getSuite(pocket))
 
                 components = self.archive.getComponentsForSeries(distroseries)
                 for component in components:
@@ -739,9 +740,9 @@ class Publisher(object):
     def D_writeReleaseFiles(self, is_careful):
         """Write out the Release files for the provided distribution.
 
-        If is_careful is specified, we include all pockets of all releases.
+        If is_careful is specified, we include all suites.
 
-        Otherwise we include only pockets flagged as true in dirty_pockets.
+        Otherwise we include only suites flagged as true in dirty_suites.
         """
         self.log.debug("* Step D: Generating Release files.")
 
@@ -750,11 +751,10 @@ class Publisher(object):
                 self.archive, container_prefix=u"release:"):
             distroseries, pocket = self.distro.getDistroSeriesAndPocket(
                 container[len(u"release:"):])
-            archive_file_suites.add((distroseries.name, pocket))
+            archive_file_suites.add(distroseries.getSuite(pocket))
 
         for distroseries in self.distro:
             for pocket in self.archive.getPockets():
-                ds_pocket = (distroseries.name, pocket)
                 suite = distroseries.getSuite(pocket)
                 suite_path = os.path.join(self._config.distsroot, suite)
                 release_path = os.path.join(suite_path, "Release")
@@ -768,9 +768,9 @@ class Publisher(object):
                     # suites.  Only force those suites that already have
                     # Release files.
                     if file_exists(release_path):
-                        self.release_files_needed.add(ds_pocket)
+                        self.release_files_needed.add(suite)
 
-                write_release = ds_pocket in self.release_files_needed
+                write_release = suite in self.release_files_needed
                 if not is_careful:
                     if not self.isDirty(distroseries, pocket):
                         self.log.debug("Skipping release files for %s/%s" %
@@ -782,7 +782,7 @@ class Publisher(object):
 
                 if write_release:
                     self._writeSuite(distroseries, pocket)
-                elif (ds_pocket in archive_file_suites and
+                elif (suite in archive_file_suites and
                       distroseries.publish_by_hash):
                     # We aren't publishing a new Release file for this
                     # suite, probably because it's immutable, but we still
diff --git a/lib/lp/archivepublisher/scripts/publishdistro.py b/lib/lp/archivepublisher/scripts/publishdistro.py
index c079484..b82f992 100644
--- a/lib/lp/archivepublisher/scripts/publishdistro.py
+++ b/lib/lp/archivepublisher/scripts/publishdistro.py
@@ -233,7 +233,7 @@ class PublishDistro(PublisherScript):
         suites = set()
         for suite in self.options.suite:
             series, pocket = self.findSuite(distribution, suite)
-            suites.add((series.name, pocket))
+            suites.add(series.getSuite(pocket))
         return suites
 
     def findExplicitlyDirtySuites(self, archive):
@@ -311,7 +311,7 @@ class PublishDistro(PublisherScript):
         """
         for distroseries, pocket in self.findExplicitlyDirtySuites(archive):
             if not cannot_modify_suite(archive, distroseries, pocket):
-                publisher.markPocketDirty(distroseries, pocket)
+                publisher.markSuiteDirty(distroseries, pocket)
         if archive.dirty_suites is not None:
             # Clear the explicit dirt indicator before we start doing
             # time-consuming publishing, which might race with an
diff --git a/lib/lp/archivepublisher/tests/test_ftparchive.py b/lib/lp/archivepublisher/tests/test_ftparchive.py
index 139392b..1c09bfb 100755
--- a/lib/lp/archivepublisher/tests/test_ftparchive.py
+++ b/lib/lp/archivepublisher/tests/test_ftparchive.py
@@ -582,7 +582,7 @@ class TestFTPArchive(TestCaseWithFactory):
         #  * a-f runs based on this config without any errors
         #  * a-f *only* creates the wanted archive indexes.
         allowed_suites = set()
-        allowed_suites.add(('hoary-test', PackagePublishingPocket.UPDATES))
+        allowed_suites.add('hoary-test-updates')
 
         publisher = Publisher(
             self._logger, self._config, self._dp,
diff --git a/lib/lp/archivepublisher/tests/test_publishdistro.py b/lib/lp/archivepublisher/tests/test_publishdistro.py
index da8f548..fb00a9f 100644
--- a/lib/lp/archivepublisher/tests/test_publishdistro.py
+++ b/lib/lp/archivepublisher/tests/test_publishdistro.py
@@ -117,11 +117,11 @@ class TestPublishDistro(TestNativePublishingBase):
         foo_path = "%s/main/f/foo/foo_666.dsc" % self.pool_dir
         self.assertEqual(open(foo_path).read().strip(), 'foo')
 
-    def testDirtyPocketProcessing(self):
-        """Test dirty pocket processing.
+    def testDirtySuiteProcessing(self):
+        """Test dirty suite processing.
 
-        Make a DELETED source to see if the dirty pocket processing
-        works for deletions.
+        Make a DELETED source to see if the dirty suite processing works for
+        deletions.
         """
         pub_source_id = self.getPubSource(filecontent=b'foo').id
         self.layer.txn.commit()
@@ -717,14 +717,13 @@ class TestPublishDistroMethods(TestCaseWithFactory):
         script = self.makeScript(distro)
         self.assertContentEqual([], script.findAllowedSuites(distro))
 
-    def test_findAllowedSuites_finds_series_and_pocket(self):
-        # findAllowedSuites looks up the requested suites.
+    def test_findAllowedSuites_finds_single(self):
+        # findAllowedSuites looks up the requested suite.
         series = self.factory.makeDistroSeries()
         suite = "%s-updates" % series.name
         script = self.makeScript(series.distribution, ['--suite', suite])
         self.assertContentEqual(
-            [(series.name, PackagePublishingPocket.UPDATES)],
-            script.findAllowedSuites(series.distribution))
+            [suite], script.findAllowedSuites(series.distribution))
 
     def test_findAllowedSuites_finds_multiple(self):
         # Multiple suites may be requested; findAllowedSuites looks them
@@ -733,10 +732,7 @@ class TestPublishDistroMethods(TestCaseWithFactory):
         script = self.makeScript(series.distribution, [
             '--suite', '%s-updates' % series.name,
             '--suite', series.name])
-        expected_suites = [
-            (series.name, PackagePublishingPocket.UPDATES),
-            (series.name, PackagePublishingPocket.RELEASE),
-            ]
+        expected_suites = ['%s-updates' % series.name, series.name]
         self.assertContentEqual(
             expected_suites, script.findAllowedSuites(series.distribution))
 
diff --git a/lib/lp/archivepublisher/tests/test_publisher.py b/lib/lp/archivepublisher/tests/test_publisher.py
index 247fef3..977b626 100644
--- a/lib/lp/archivepublisher/tests/test_publisher.py
+++ b/lib/lp/archivepublisher/tests/test_publisher.py
@@ -1,4 +1,4 @@
-# Copyright 2009-2020 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2021 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for publisher class."""
@@ -720,11 +720,6 @@ class TestByHashes(TestCaseWithFactory):
 class TestPublisher(TestPublisherBase):
     """Testing `Publisher` behaviour."""
 
-    def assertDirtyPocketsContents(self, expected, dirty_pockets):
-        contents = [(str(dr_name), pocket.name) for dr_name, pocket in
-                    dirty_pockets]
-        self.assertEqual(expected, contents)
-
     def assertReleaseContentsMatch(self, release, filename, contents):
         for hash_name, hash_func in (
             ('md5sum', hashlib.md5),
@@ -766,8 +761,7 @@ class TestPublisher(TestPublisherBase):
         self.layer.txn.commit()
 
         pub_source.sync()
-        self.assertDirtyPocketsContents(
-            [('breezy-autotest', 'RELEASE')], publisher.dirty_pockets)
+        self.assertEqual({'breezy-autotest'}, publisher.dirty_suites)
         self.assertEqual(PackagePublishingStatus.PUBLISHED, pub_source.status)
 
         # file got published
@@ -972,8 +966,7 @@ class TestPublisher(TestPublisherBase):
         publisher.A_publish(force_publishing=False)
 
         # The pocket was dirtied:
-        self.assertDirtyPocketsContents(
-            [('breezy-autotest', 'RELEASE')], publisher.dirty_pockets)
+        self.assertEqual({'breezy-autotest'}, publisher.dirty_suites)
         # The file was published:
         foo_path = "%s/main/f/foo/foo_666.dsc" % pub_config.poolroot
         with open(foo_path) as foo_file:
@@ -993,8 +986,7 @@ class TestPublisher(TestPublisherBase):
         """
         publisher = Publisher(
             self.logger, self.config, self.disk_pool,
-            self.ubuntutest.main_archive,
-            allowed_suites=[('hoary-test', PackagePublishingPocket.RELEASE)])
+            self.ubuntutest.main_archive, allowed_suites=['hoary-test'])
 
         pub_source = self.getPubSource(filecontent=b'foo')
         pub_source2 = self.getPubSource(
@@ -1006,8 +998,7 @@ class TestPublisher(TestPublisherBase):
 
         pub_source.sync()
         pub_source2.sync()
-        self.assertDirtyPocketsContents(
-            [('hoary-test', 'RELEASE')], publisher.dirty_pockets)
+        self.assertEqual({'hoary-test'}, publisher.dirty_suites)
         self.assertEqual(
             PackagePublishingStatus.PUBLISHED, pub_source2.status)
         self.assertEqual(PackagePublishingStatus.PENDING, pub_source.status)
@@ -1020,8 +1011,7 @@ class TestPublisher(TestPublisherBase):
         publisher = Publisher(
             self.logger, self.config, self.disk_pool,
             self.ubuntutest.main_archive,
-            allowed_suites=[('breezy-autotest',
-                             PackagePublishingPocket.UPDATES)])
+            allowed_suites=['breezy-autotest-updates'])
 
         self.ubuntutest['breezy-autotest'].status = (
             SeriesStatus.CURRENT)
@@ -1039,8 +1029,7 @@ class TestPublisher(TestPublisherBase):
 
         pub_source.sync()
         pub_source2.sync()
-        self.assertDirtyPocketsContents(
-            [('breezy-autotest', 'UPDATES')], publisher.dirty_pockets)
+        self.assertEqual({'breezy-autotest-updates'}, publisher.dirty_suites)
         self.assertEqual(PackagePublishingStatus.PUBLISHED, pub_source.status)
         self.assertEqual(PackagePublishingStatus.PENDING, pub_source2.status)
 
@@ -1059,7 +1048,7 @@ class TestPublisher(TestPublisherBase):
         # no pockets will be *dirtied*.
         publisher.A_publish(False)
 
-        self.assertDirtyPocketsContents([], publisher.dirty_pockets)
+        self.assertEqual(set(), publisher.dirty_suites)
         # nothing got published
         foo_path = "%s/main/f/foo/foo_666.dsc" % self.pool_dir
         self.assertEqual(False, os.path.exists(foo_path))
@@ -1087,8 +1076,7 @@ class TestPublisher(TestPublisherBase):
         # then we will have a corresponding dirty_pocket entry.
         publisher.A_publish(True)
 
-        self.assertDirtyPocketsContents(
-            [('breezy-autotest', 'RELEASE')], publisher.dirty_pockets)
+        self.assertEqual({'breezy-autotest'}, publisher.dirty_suites)
         # file got published
         foo_path = "%s/main/f/foo/foo_666.dsc" % self.pool_dir
         with open(foo_path) as foo_file:
@@ -1115,7 +1103,7 @@ class TestPublisher(TestPublisherBase):
         publisher.A_publish(False)
         self.layer.txn.commit()
 
-        self.assertDirtyPocketsContents([], publisher.dirty_pockets)
+        self.assertEqual(set(), publisher.dirty_suites)
         self.assertEqual(PackagePublishingStatus.PENDING, pub_source.status)
 
         # nothing got published
@@ -1146,8 +1134,7 @@ class TestPublisher(TestPublisherBase):
         self.layer.txn.commit()
 
         pub_source.sync()
-        self.assertDirtyPocketsContents(
-            [('breezy-autotest', 'RELEASE')], publisher.dirty_pockets)
+        self.assertEqual({'breezy-autotest'}, publisher.dirty_suites)
         self.assertEqual(PackagePublishingStatus.PUBLISHED, pub_source.status)
 
         # nothing got published
@@ -1224,8 +1211,7 @@ class TestPublisher(TestPublisherBase):
         helper function: 'getPublisher'
         """
         # Stub parameters.
-        allowed_suites = [
-            ('breezy-autotest', PackagePublishingPocket.RELEASE)]
+        allowed_suites = ['breezy-autotest']
 
         distro_publisher = getPublisher(
             self.ubuntutest.main_archive, allowed_suites, self.logger)
@@ -1236,9 +1222,7 @@ class TestPublisher(TestPublisherBase):
         self.assertEqual(
             '/var/tmp/archive/ubuntutest/dists',
             distro_publisher._config.distsroot)
-        self.assertEqual(
-            [('breezy-autotest', PackagePublishingPocket.RELEASE)],
-            distro_publisher.allowed_suites)
+        self.assertEqual({'breezy-autotest'}, distro_publisher.allowed_suites)
 
         # Check that the partner archive is built in a different directory
         # to the primary archive.
@@ -1263,9 +1247,7 @@ class TestPublisher(TestPublisherBase):
         self.assertEqual(
             '/var/tmp/ppa.test/cprov/ppa/ubuntutest/dists',
             archive_publisher._config.distsroot)
-        self.assertEqual(
-            [('breezy-autotest', PackagePublishingPocket.RELEASE)],
-            archive_publisher.allowed_suites)
+        self.assertEqual({'breezy-autotest'}, archive_publisher.allowed_suites)
 
     def testPendingArchive(self):
         """Check Pending Archive Lookup.
@@ -1537,9 +1519,8 @@ class TestPublisher(TestPublisherBase):
             index_contents)
 
         # We always regenerate all Releases file for a given suite.
-        self.assertTrue(
-            ('breezy-autotest', PackagePublishingPocket.RELEASE) in
-            archive_publisher.release_files_needed)
+        self.assertIn(
+            'breezy-autotest', archive_publisher.release_files_needed)
 
         # Confirm that i18n files are not created
         i18n_path = os.path.join(archive_publisher._config.distsroot,
@@ -1686,9 +1667,8 @@ class TestPublisher(TestPublisherBase):
             index_contents)
 
         # We always regenerate all Releases file for a given suite.
-        self.assertTrue(
-            ('breezy-autotest', PackagePublishingPocket.RELEASE) in
-            archive_publisher.release_files_needed)
+        self.assertIn(
+            'breezy-autotest', archive_publisher.release_files_needed)
 
         # Various compressed Translation-en files are written; ensure that
         # they are the same after decompression.
@@ -1762,11 +1742,6 @@ class TestPublisher(TestPublisherBase):
             self._checkCompressedFiles(
                 archive_publisher, uncompressed_file_path, ['.xz'])
 
-    def checkDirtyPockets(self, publisher, expected):
-        """Check dirty_pockets contents of a given publisher."""
-        sorted_dirty_pockets = sorted(list(publisher.dirty_pockets))
-        self.assertEqual(expected, sorted_dirty_pockets)
-
     def testDirtyingPocketsWithDeletedPackages(self):
         """Test that dirtying pockets with deleted packages works.
 
@@ -1779,7 +1754,7 @@ class TestPublisher(TestPublisherBase):
             self.ubuntutest.main_archive, allowed_suites, self.logger)
 
         publisher.A2_markPocketsWithDeletionsDirty()
-        self.checkDirtyPockets(publisher, expected=[])
+        self.assertEqual(set(), publisher.dirty_suites)
 
         # Make a published source, a deleted source in the release
         # pocket, a source that's been removed from disk and one that's
@@ -1811,27 +1786,27 @@ class TestPublisher(TestPublisherBase):
         # Run the deletion detection.
         publisher.A2_markPocketsWithDeletionsDirty()
 
-        # Only the pockets with pending deletions are marked as dirty.
-        expected_dirty_pockets = [
-            ('breezy-autotest', PackagePublishingPocket.RELEASE),
-            ('breezy-autotest', PackagePublishingPocket.SECURITY),
-            ('breezy-autotest', PackagePublishingPocket.BACKPORTS),
-            ]
-        self.checkDirtyPockets(publisher, expected=expected_dirty_pockets)
+        # Only the suites with pending deletions are marked as dirty.
+        expected_dirty_suites = {
+            'breezy-autotest',
+            'breezy-autotest-security',
+            'breezy-autotest-backports',
+            }
+        self.assertEqual(expected_dirty_suites, publisher.dirty_suites)
 
         # If the distroseries is CURRENT, then the release pocket is not
         # marked as dirty.
         self.ubuntutest['breezy-autotest'].status = (
             SeriesStatus.CURRENT)
 
-        publisher.dirty_pockets = set()
+        publisher.dirty_suites = set()
         publisher.A2_markPocketsWithDeletionsDirty()
 
-        expected_dirty_pockets = [
-            ('breezy-autotest', PackagePublishingPocket.SECURITY),
-            ('breezy-autotest', PackagePublishingPocket.BACKPORTS),
-            ]
-        self.checkDirtyPockets(publisher, expected=expected_dirty_pockets)
+        expected_dirty_suites = {
+            'breezy-autotest-security',
+            'breezy-autotest-backports',
+            }
+        self.assertEqual(expected_dirty_suites, publisher.dirty_suites)
 
     def testDeletionDetectionRespectsAllowedSuites(self):
         """Check if the deletion detection mechanism respects allowed_suites.
@@ -1845,14 +1820,14 @@ class TestPublisher(TestPublisherBase):
         specified suites should be marked as dirty.
         """
         allowed_suites = [
-            ('breezy-autotest', PackagePublishingPocket.SECURITY),
-            ('breezy-autotest', PackagePublishingPocket.UPDATES),
+            'breezy-autotest-security',
+            'breezy-autotest-updates',
             ]
         publisher = getPublisher(
             self.ubuntutest.main_archive, allowed_suites, self.logger)
 
         publisher.A2_markPocketsWithDeletionsDirty()
-        self.checkDirtyPockets(publisher, expected=[])
+        self.assertEqual(set(), publisher.dirty_suites)
 
         # Create pending deletions in RELEASE, BACKPORTS, SECURITY and
         # UPDATES pockets.
@@ -1873,9 +1848,8 @@ class TestPublisher(TestPublisherBase):
             status=PackagePublishingStatus.DELETED)[0]
 
         publisher.A2_markPocketsWithDeletionsDirty()
-        # Only the pockets with pending deletions in the allowed suites
-        # are marked as dirty.
-        self.checkDirtyPockets(publisher, expected=allowed_suites)
+        # Only the suites with pending deletions are marked as dirty.
+        self.assertEqual(set(allowed_suites), publisher.dirty_suites)
 
     def testReleaseFile(self):
         """Test release file writing.
@@ -1892,9 +1866,7 @@ class TestPublisher(TestPublisherBase):
         publisher.A_publish(False)
         publisher.C_doFTPArchive(False)
 
-        self.assertIn(
-            ('breezy-autotest', PackagePublishingPocket.RELEASE),
-            publisher.release_files_needed)
+        self.assertIn('breezy-autotest', publisher.release_files_needed)
 
         publisher.D_writeReleaseFiles(False)
 
@@ -2140,7 +2112,7 @@ class TestPublisher(TestPublisherBase):
         os.makedirs(os.path.dirname(contents_path))
         with gzip.GzipFile(contents_path, 'wb'):
             pass
-        publisher.markPocketDirty(
+        publisher.markSuiteDirty(
             self.ubuntutest.getSeries('breezy-autotest'),
             PackagePublishingPocket.RELEASE)
 
@@ -2170,7 +2142,7 @@ class TestPublisher(TestPublisherBase):
         for name in dep11_names:
             with gzip.GzipFile(os.path.join(dep11_path, name), 'wb') as f:
                 f.write(six.ensure_binary(name))
-        publisher.markPocketDirty(
+        publisher.markSuiteDirty(
             self.ubuntutest.getSeries('breezy-autotest'),
             PackagePublishingPocket.RELEASE)
 
@@ -2200,7 +2172,7 @@ class TestPublisher(TestPublisherBase):
         for name in cnf_names:
             with lzma.LZMAFile(os.path.join(cnf_path, name), 'wb') as f:
                 f.write(six.ensure_binary(name))
-        publisher.markPocketDirty(
+        publisher.markSuiteDirty(
             self.ubuntutest.getSeries('breezy-autotest'),
             PackagePublishingPocket.RELEASE)
 
@@ -2460,8 +2432,7 @@ class TestArchiveIndices(TestPublisherBase):
         that those in 'absent' are not.
         """
 
-        self.assertTrue(
-            (series.name, pocket) in publisher.release_files_needed)
+        self.assertIn(series.getSuite(pocket), publisher.release_files_needed)
 
         arch_template = os.path.join(
             publisher._config.distsroot, series.getSuite(pocket), '%s/%s')
@@ -2774,7 +2745,7 @@ class TestUpdateByHash(TestPublisherBase):
         # Create the first file.
         with open_for_writing(suite_path('Contents-i386'), 'w') as f:
             f.write('A Contents file\n')
-        publisher.markPocketDirty(
+        publisher.markSuiteDirty(
             self.breezy_autotest, PackagePublishingPocket.RELEASE)
         self.runSteps(publisher, step_a=True, step_c=True, step_d=True)
         flush_database_caches()
@@ -2880,7 +2851,7 @@ class TestUpdateByHash(TestPublisherBase):
         self.setUpMockTime()
 
         # Publish empty index files.
-        publisher.markPocketDirty(
+        publisher.markSuiteDirty(
             self.breezy_autotest, PackagePublishingPocket.RELEASE)
         self.runSteps(publisher, step_a=True, step_c=True, step_d=True)
         suite_path = partial(
@@ -2988,7 +2959,7 @@ class TestUpdateByHash(TestPublisherBase):
             self.ubuntutest.main_archive)
         self.runSteps(publisher, step_a2=True, step_c=True, step_d=True)
         transaction.commit()
-        self.assertEqual(set(), publisher.dirty_pockets)
+        self.assertEqual(set(), publisher.dirty_suites)
         # The condemned index files are removed, and no new Release file is
         # generated.
         expected_suite_files = (
@@ -3021,7 +2992,7 @@ class TestUpdateByHash(TestPublisherBase):
             self.ubuntutest.main_archive)
         self.runSteps(publisher, step_a2=True, step_c=True, step_d=True)
         transaction.commit()
-        self.assertEqual(set(), publisher.dirty_pockets)
+        self.assertEqual(set(), publisher.dirty_suites)
         self.assertEqual(release_mtime, os.stat(release_path).st_mtime)
         # The condemned index files are removed, and no new Release file is
         # generated.

Follow ups