Merge lp:~stevenk/launchpad/delayed-ppa-copies-ancestryless into lp:launchpad

Proposed by Steve Kowalik
Status: Merged
Approved by: Julian Edwards
Approved revision: no longer in the source branch.
Merged at revision: 12084
Proposed branch: lp:~stevenk/launchpad/delayed-ppa-copies-ancestryless
Merge into: lp:launchpad
Diff against target: 64 lines (+34/-9)
2 files modified
lib/lp/soyuz/model/publishing.py (+15/-9)
lib/lp/soyuz/tests/test_publishing.py (+19/-0)
To merge this branch: bzr merge lp:~stevenk/launchpad/delayed-ppa-copies-ancestryless
Reviewer Review Type Date Requested Status
Julian Edwards (community) code Approve
Review via email: mp+43750@code.launchpad.net

Commit message

[r=julian-edwards][ui=none][bug=610687] Change overrideFromAncestry() to not check ancestry for PPA uploads, and assert the component is sane.

Description of the change

This branch changes overrideFromAncestry() to not even check it for PPA uploads, and assert their component is 'main' for a sanity check.

I also drove-by a comment fix that I noticed.

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

Approved on the understanding that you fix the hard-coded check for 'main' and replace it with IArchive.getComponentsForSeries()

review: Approve (code)

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 2010-12-09 11:25:48 +0000
+++ lib/lp/soyuz/model/publishing.py 2010-12-15 23:37:39 +0000
@@ -801,15 +801,21 @@
801 assert self.status == PackagePublishingStatus.PENDING, (801 assert self.status == PackagePublishingStatus.PENDING, (
802 "Cannot override published records.")802 "Cannot override published records.")
803803
804 # If there is an published ancestry, use its component, otherwise804 # If there is published ancestry, use its component, otherwise
805 # use the original upload component.805 # use the original upload component. Since PPAs only use main,
806 ancestry = self.getAncestry()806 # we don't need to check the ancestry.
807 if ancestry is not None:807 if not self.archive.is_ppa:
808 component = ancestry.component808 ancestry = self.getAncestry()
809 else:809 if ancestry is not None:
810 component = self.sourcepackagerelease.component810 component = ancestry.component
811811 else:
812 self.component = component812 component = self.sourcepackagerelease.component
813
814 self.component = component
815
816 assert self.component in (
817 self.archive.getComponentsForSeries(self.distroseries))
818
813819
814 def _proxied_urls(self, files, parent):820 def _proxied_urls(self, files, parent):
815 """Run the files passed through `ProxiedLibraryFileAlias`."""821 """Run the files passed through `ProxiedLibraryFileAlias`."""
816822
=== modified file 'lib/lp/soyuz/tests/test_publishing.py'
--- lib/lp/soyuz/tests/test_publishing.py 2010-10-06 11:46:51 +0000
+++ lib/lp/soyuz/tests/test_publishing.py 2010-12-15 23:37:39 +0000
@@ -956,6 +956,25 @@
956 self.copyAndCheck(956 self.copyAndCheck(
957 binary, binary.distroarchseries.distroseries, 'universe')957 binary, binary.distroarchseries.distroseries, 'universe')
958958
959 def test_ppa_override_no_ancestry(self):
960 # Test a PPA publication with no ancestry is 'main'
961 ppa = self.factory.makeArchive(purpose=ArchivePurpose.PPA)
962 spr = self.factory.makeSourcePackageRelease()
963 spph = self.factory.makeSourcePackagePublishingHistory(
964 sourcepackagerelease=spr, archive=ppa)
965 spph.overrideFromAncestry()
966 self.assertEquals(spph.component.name, 'main')
967
968 def test_ppa_override_with_ancestry(self):
969 # Test a PPA publication with ancestry
970 ppa = self.factory.makeArchive(purpose=ArchivePurpose.PPA)
971 spr = self.factory.makeSourcePackageRelease()
972 spph = self.factory.makeSourcePackagePublishingHistory(
973 sourcepackagerelease=spr, archive=ppa)
974 spph2 = self.factory.makeSourcePackagePublishingHistory(
975 sourcepackagerelease=spr, archive=ppa)
976 spph2.overrideFromAncestry()
977 self.assertEquals(spph2.component.name, 'main')
959978
960class BuildRecordCreationTests(TestNativePublishingBase):979class BuildRecordCreationTests(TestNativePublishingBase):
961 """Test the creation of build records."""980 """Test the creation of build records."""