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
1=== modified file 'lib/lp/soyuz/model/publishing.py'
2--- lib/lp/soyuz/model/publishing.py 2011-12-30 06:14:56 +0000
3+++ lib/lp/soyuz/model/publishing.py 2012-01-09 14:24:32 +0000
4@@ -1134,18 +1134,18 @@
5
6 def supersede(self, dominant=None, logger=None):
7 """See `IBinaryPackagePublishingHistory`."""
8- # At this point only PUBLISHED (ancient versions) or PENDING (
9- # multiple overrides/copies) publications should be given. We
10- # tolerate SUPERSEDED architecture-independent binaries, because
11- # they are dominated automatically once the first publication is
12- # processed.
13+ # If the binary publication is not published, we allow SUPERSEDED
14+ # arch-indep publications only.
15 if self.status not in active_publishing_status:
16- assert not self.binarypackagerelease.architecturespecific, (
17- "Should not dominate unpublished architecture specific "
18- "binary %s (%s)" % (
19- self.binarypackagerelease.title,
20- self.distroarchseries.architecturetag))
21- return
22+ if self.binarypackagerelease.architecturespecific:
23+ assert self.status in active_publishing_status + (
24+ PackagePublishingStatus.SUPERSEDED,), (
25+ "Should not dominate unpublished architecture specific "
26+ "binary %s (%s)" % (
27+ self.binarypackagerelease.title,
28+ self.distroarchseries.architecturetag))
29+ else:
30+ assert "Can not dominate unpublished binary publication."
31
32 self.setSuperseded()
33
34
35=== modified file 'lib/lp/soyuz/tests/test_publishing_models.py'
36--- lib/lp/soyuz/tests/test_publishing_models.py 2011-12-30 06:14:56 +0000
37+++ lib/lp/soyuz/tests/test_publishing_models.py 2012-01-09 14:24:32 +0000
38@@ -175,3 +175,12 @@
39 binarypackagerelease=bpr, archive=archive)
40 expected_urls = self.get_urls_for_binarypackagerelease(bpr, archive)
41 self.assertContentEqual(expected_urls, bpph.binaryFileUrls())
42+
43+ def test_cannot_supersede_superseded_binary_publication(self):
44+ # Superseded binary publications cannot be superseded again.
45+ bpph = self.factory.makeBinaryPackagePublishingHistory()
46+ bpph.supersede()
47+ self.assertRaisesWithContent(
48+ AssertionError,
49+ "Can not dominate unpublished binary publication.",
50+ bpph.supersede)