← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/bpph-supersede into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/bpph-supersede into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/bpph-supersede/+merge/87875

No longer tolerate supersede() being called on superseded binary publications. This allows us to remove some probable foot-guns from the code, and also brings the source and binary supersede methods into closer alignment.
-- 
https://code.launchpad.net/~stevenk/launchpad/bpph-supersede/+merge/87875
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/bpph-supersede into lp:launchpad.
=== modified file 'lib/lp/soyuz/model/publishing.py'
--- lib/lp/soyuz/model/publishing.py	2011-12-30 06:14:56 +0000
+++ lib/lp/soyuz/model/publishing.py	2012-01-08 17:19:25 +0000
@@ -1134,18 +1134,8 @@
 
     def supersede(self, dominant=None, logger=None):
         """See `IBinaryPackagePublishingHistory`."""
-        # At this point only PUBLISHED (ancient versions) or PENDING (
-        # multiple overrides/copies) publications should be given. We
-        # tolerate SUPERSEDED architecture-independent binaries, because
-        # they are dominated automatically once the first publication is
-        # processed.
-        if self.status not in active_publishing_status:
-            assert not self.binarypackagerelease.architecturespecific, (
-                "Should not dominate unpublished architecture specific "
-                "binary %s (%s)" % (
-                self.binarypackagerelease.title,
-                self.distroarchseries.architecturetag))
-            return
+        assert self.status in active_publishing_status, (
+            "Can not dominate unpublished binary publication.")
 
         self.setSuperseded()
 

=== modified file 'lib/lp/soyuz/tests/test_publishing_models.py'
--- lib/lp/soyuz/tests/test_publishing_models.py	2011-12-30 06:14:56 +0000
+++ lib/lp/soyuz/tests/test_publishing_models.py	2012-01-08 17:19:25 +0000
@@ -175,3 +175,12 @@
             binarypackagerelease=bpr, archive=archive)
         expected_urls = self.get_urls_for_binarypackagerelease(bpr, archive)
         self.assertContentEqual(expected_urls, bpph.binaryFileUrls())
+
+    def test_cannot_supersede_superseded_binary_publication(self):
+        # Superseded binary publications cannot be superseded again.
+        bpph = self.factory.makeBinaryPackagePublishingHistory()
+        bpph.supersede()
+        self.assertRaisesWithContent(
+            AssertionError, 
+            "Can not dominate unpublished binary publication.",
+            bpph.supersede)


Follow ups