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

Proposed by Steve Kowalik
Status: Work in progress
Proposed branch: lp:~stevenk/launchpad/bpph-supersede
Merge into: lp:launchpad
Diff against target: 50 lines (+20/-11)
2 files modified
lib/lp/soyuz/model/publishing.py (+11/-11)
lib/lp/soyuz/tests/test_publishing_models.py (+9/-0)
To merge this branch: bzr merge lp:~stevenk/launchpad/bpph-supersede
Reviewer Review Type Date Requested Status
Deryck Hodge (community) Abstain
Review via email: mp+87875@code.launchpad.net

Description of the change

No longer tolerate supersede() being called on unpublished binary arch-dep 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.

To post a comment you must log in.
lp:~stevenk/launchpad/bpph-supersede updated
14656. By Steve Kowalik

One assert is not enough, since we need to tolerate SUPERSEDED arch-indep publications.

Revision history for this message
Deryck Hodge (deryck) wrote :

As we chatted here in person, I'm not sure about the condition check you do, but I don't understand what you're trying to do here well enough to feel confident voting yay or nay. Do you mind getting someone else to look at it?

review: Abstain

Unmerged revisions

14656. By Steve Kowalik

One assert is not enough, since we need to tolerate SUPERSEDED arch-indep publications.

14655. By Steve Kowalik

No longer tolerate superseded arch-indep binary publications in IBPPH.supersede()

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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-09 14:24:32 +0000
@@ -1134,18 +1134,18 @@
11341134
1135 def supersede(self, dominant=None, logger=None):1135 def supersede(self, dominant=None, logger=None):
1136 """See `IBinaryPackagePublishingHistory`."""1136 """See `IBinaryPackagePublishingHistory`."""
1137 # At this point only PUBLISHED (ancient versions) or PENDING (1137 # If the binary publication is not published, we allow SUPERSEDED
1138 # multiple overrides/copies) publications should be given. We1138 # arch-indep publications only.
1139 # tolerate SUPERSEDED architecture-independent binaries, because
1140 # they are dominated automatically once the first publication is
1141 # processed.
1142 if self.status not in active_publishing_status:1139 if self.status not in active_publishing_status:
1143 assert not self.binarypackagerelease.architecturespecific, (1140 if self.binarypackagerelease.architecturespecific:
1144 "Should not dominate unpublished architecture specific "1141 assert self.status in active_publishing_status + (
1145 "binary %s (%s)" % (1142 PackagePublishingStatus.SUPERSEDED,), (
1146 self.binarypackagerelease.title,1143 "Should not dominate unpublished architecture specific "
1147 self.distroarchseries.architecturetag))1144 "binary %s (%s)" % (
1148 return1145 self.binarypackagerelease.title,
1146 self.distroarchseries.architecturetag))
1147 else:
1148 assert "Can not dominate unpublished binary publication."
11491149
1150 self.setSuperseded()1150 self.setSuperseded()
11511151
11521152
=== 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-09 14:24:32 +0000
@@ -175,3 +175,12 @@
175 binarypackagerelease=bpr, archive=archive)175 binarypackagerelease=bpr, archive=archive)
176 expected_urls = self.get_urls_for_binarypackagerelease(bpr, archive)176 expected_urls = self.get_urls_for_binarypackagerelease(bpr, archive)
177 self.assertContentEqual(expected_urls, bpph.binaryFileUrls())177 self.assertContentEqual(expected_urls, bpph.binaryFileUrls())
178
179 def test_cannot_supersede_superseded_binary_publication(self):
180 # Superseded binary publications cannot be superseded again.
181 bpph = self.factory.makeBinaryPackagePublishingHistory()
182 bpph.supersede()
183 self.assertRaisesWithContent(
184 AssertionError,
185 "Can not dominate unpublished binary publication.",
186 bpph.supersede)