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
=== modified file 'lib/lp/archiveuploader/nascentuploadfile.py'
--- lib/lp/archiveuploader/nascentuploadfile.py 2010-10-18 15:44:55 +0000
+++ lib/lp/archiveuploader/nascentuploadfile.py 2010-10-18 15:45:00 +0000
@@ -803,11 +803,6 @@
803 "Unable to find source package %s/%s in %s" % (803 "Unable to find source package %s/%s in %s" % (
804 self.source_name, self.source_version, distroseries.name))804 self.source_name, self.source_version, distroseries.name))
805805
806 # There can only be one matching published source package.
807 published_spphs = [
808 spph for spph in spphs
809 if spph.status == PackagePublishingStatus.PUBLISHED]
810 assert len(published_spphs) <= 1, "Duplicated ancestry"
811 return spphs[0].sourcepackagerelease806 return spphs[0].sourcepackagerelease
812807
813 def verifySourcePackageRelease(self, sourcepackagerelease):808 def verifySourcePackageRelease(self, sourcepackagerelease):
814809
=== modified file 'lib/lp/archiveuploader/tests/test_buildduploads.py'
--- lib/lp/archiveuploader/tests/test_buildduploads.py 2010-10-06 11:46:51 +0000
+++ lib/lp/archiveuploader/tests/test_buildduploads.py 2010-10-18 15:45:00 +0000
@@ -20,6 +20,7 @@
20 )20 )
21from lp.registry.interfaces.distribution import IDistributionSet21from lp.registry.interfaces.distribution import IDistributionSet
22from lp.registry.interfaces.pocket import PackagePublishingPocket22from lp.registry.interfaces.pocket import PackagePublishingPocket
23from lp.soyuz.interfaces.publishing import IPublishingSet
23from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild24from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
2425
2526
@@ -195,6 +196,13 @@
195 real_policy = self.policy196 real_policy = self.policy
196 self.policy = 'insecure'197 self.policy = 'insecure'
197 super(TestBuilddUploads, self).setUp()198 super(TestBuilddUploads, self).setUp()
199 # Publish the source package release so it can be found by
200 # NascentUploadFile.findSourcePackageRelease().
201 spr = self.source_queue.sources[0].sourcepackagerelease
202 getUtility(IPublishingSet).newSourcePublication(
203 self.distroseries.main_archive, spr,
204 self.distroseries, spr.component,
205 spr.section, PackagePublishingPocket.RELEASE)
198 self.policy = real_policy206 self.policy = real_policy
199207
200 def _publishBuildQueueItem(self, queue_item):208 def _publishBuildQueueItem(self, queue_item):
201209
=== modified file 'lib/lp/archiveuploader/tests/test_nascentuploadfile.py'
--- lib/lp/archiveuploader/tests/test_nascentuploadfile.py 2010-10-18 15:44:55 +0000
+++ lib/lp/archiveuploader/tests/test_nascentuploadfile.py 2010-10-18 15:45:00 +0000
@@ -455,32 +455,3 @@
455 uploadfile.parseControl(control)455 uploadfile.parseControl(control)
456 self.assertEquals(456 self.assertEquals(
457 spph2.sourcepackagerelease, uploadfile.findSourcePackageRelease())457 spph2.sourcepackagerelease, uploadfile.findSourcePackageRelease())
458
459 def test_findSourcePackageRelease_duplicated_ancestry(self):
460 # findSourcePackageRelease errors out if there are multiple
461 # published SourcePackageReleases, as this should never
462 # be possible.
463 das = self.factory.makeDistroArchSeries(
464 distroseries=self.policy.distroseries, architecturetag="i386")
465 build = self.factory.makeBinaryPackageBuild(
466 distroarchseries=das,
467 archive=self.policy.archive)
468 uploadfile = self.createDebBinaryUploadFile(
469 "foo_0.42_i386.deb", "main/python", "unknown", "mypkg", "0.42",
470 None)
471 spn = self.factory.makeSourcePackageName("foo")
472 spph1 = self.factory.makeSourcePackagePublishingHistory(
473 sourcepackagename=spn,
474 distroseries=self.policy.distroseries,
475 version="0.42", archive=self.policy.archive,
476 status=PackagePublishingStatus.PUBLISHED)
477 spph2 = self.factory.makeSourcePackagePublishingHistory(
478 sourcepackagename=spn,
479 distroseries=self.policy.distroseries,
480 version="0.42", archive=self.policy.archive,
481 status=PackagePublishingStatus.PUBLISHED)
482 control = self.getBaseControl()
483 control["Source"] = "foo"
484 uploadfile.parseControl(control)
485 self.assertRaises(
486 AssertionError, uploadfile.findSourcePackageRelease)