Merge lp:~jelmer/launchpad/135610-duplicated-ancestry-2 into lp:launchpad

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merged at revision: 11746
Proposed branch: lp:~jelmer/launchpad/135610-duplicated-ancestry-2
Merge into: lp:launchpad
Prerequisite: lp:~jelmer/launchpad/135610-duplicated-ancestry
Diff against target: 78 lines (+8/-34)
3 files modified
lib/lp/archiveuploader/nascentuploadfile.py (+0/-5)
lib/lp/archiveuploader/tests/test_buildduploads.py (+8/-0)
lib/lp/archiveuploader/tests/test_nascentuploadfile.py (+0/-29)
To merge this branch: bzr merge lp:~jelmer/launchpad/135610-duplicated-ancestry-2
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+38521@code.launchpad.net

Commit message

Allow extra PENDING source package publishing history entries in NascentUploadFile.findSourcePackageRelease.

Description of the change

William pointed out that the assertion I added in my branch can fail in some situations that aren't actually a problem.

When publishing new records the publisher will actually set the new record the PUBLISHED before it sets the old record to SUPERSEDED. Because of this we've decided to simply skip the assertion.

To post a comment you must log in.
Revision history for this message
Abel Deuring (adeuring) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/archiveuploader/nascentuploadfile.py'
2--- lib/lp/archiveuploader/nascentuploadfile.py 2010-10-18 15:44:55 +0000
3+++ lib/lp/archiveuploader/nascentuploadfile.py 2010-10-18 15:45:00 +0000
4@@ -803,11 +803,6 @@
5 "Unable to find source package %s/%s in %s" % (
6 self.source_name, self.source_version, distroseries.name))
7
8- # There can only be one matching published source package.
9- published_spphs = [
10- spph for spph in spphs
11- if spph.status == PackagePublishingStatus.PUBLISHED]
12- assert len(published_spphs) <= 1, "Duplicated ancestry"
13 return spphs[0].sourcepackagerelease
14
15 def verifySourcePackageRelease(self, sourcepackagerelease):
16
17=== modified file 'lib/lp/archiveuploader/tests/test_buildduploads.py'
18--- lib/lp/archiveuploader/tests/test_buildduploads.py 2010-10-06 11:46:51 +0000
19+++ lib/lp/archiveuploader/tests/test_buildduploads.py 2010-10-18 15:45:00 +0000
20@@ -20,6 +20,7 @@
21 )
22 from lp.registry.interfaces.distribution import IDistributionSet
23 from lp.registry.interfaces.pocket import PackagePublishingPocket
24+from lp.soyuz.interfaces.publishing import IPublishingSet
25 from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
26
27
28@@ -195,6 +196,13 @@
29 real_policy = self.policy
30 self.policy = 'insecure'
31 super(TestBuilddUploads, self).setUp()
32+ # Publish the source package release so it can be found by
33+ # NascentUploadFile.findSourcePackageRelease().
34+ spr = self.source_queue.sources[0].sourcepackagerelease
35+ getUtility(IPublishingSet).newSourcePublication(
36+ self.distroseries.main_archive, spr,
37+ self.distroseries, spr.component,
38+ spr.section, PackagePublishingPocket.RELEASE)
39 self.policy = real_policy
40
41 def _publishBuildQueueItem(self, queue_item):
42
43=== modified file 'lib/lp/archiveuploader/tests/test_nascentuploadfile.py'
44--- lib/lp/archiveuploader/tests/test_nascentuploadfile.py 2010-10-18 15:44:55 +0000
45+++ lib/lp/archiveuploader/tests/test_nascentuploadfile.py 2010-10-18 15:45:00 +0000
46@@ -455,32 +455,3 @@
47 uploadfile.parseControl(control)
48 self.assertEquals(
49 spph2.sourcepackagerelease, uploadfile.findSourcePackageRelease())
50-
51- def test_findSourcePackageRelease_duplicated_ancestry(self):
52- # findSourcePackageRelease errors out if there are multiple
53- # published SourcePackageReleases, as this should never
54- # be possible.
55- das = self.factory.makeDistroArchSeries(
56- distroseries=self.policy.distroseries, architecturetag="i386")
57- build = self.factory.makeBinaryPackageBuild(
58- distroarchseries=das,
59- archive=self.policy.archive)
60- uploadfile = self.createDebBinaryUploadFile(
61- "foo_0.42_i386.deb", "main/python", "unknown", "mypkg", "0.42",
62- None)
63- spn = self.factory.makeSourcePackageName("foo")
64- spph1 = self.factory.makeSourcePackagePublishingHistory(
65- sourcepackagename=spn,
66- distroseries=self.policy.distroseries,
67- version="0.42", archive=self.policy.archive,
68- status=PackagePublishingStatus.PUBLISHED)
69- spph2 = self.factory.makeSourcePackagePublishingHistory(
70- sourcepackagename=spn,
71- distroseries=self.policy.distroseries,
72- version="0.42", archive=self.policy.archive,
73- status=PackagePublishingStatus.PUBLISHED)
74- control = self.getBaseControl()
75- control["Source"] = "foo"
76- uploadfile.parseControl(control)
77- self.assertRaises(
78- AssertionError, uploadfile.findSourcePackageRelease)