← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/delayed-ppa-copies-ancestryless into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #610687 Delayed copies do not respect PPA component override
  https://bugs.launchpad.net/bugs/610687


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.
-- 
https://code.launchpad.net/~stevenk/launchpad/delayed-ppa-copies-ancestryless/+merge/43750
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/delayed-ppa-copies-ancestryless into lp:launchpad.
=== 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 11:31:16 +0000
@@ -801,7 +801,12 @@
         assert self.status == PackagePublishingStatus.PENDING, (
             "Cannot override published records.")
 
-        # If there is an published ancestry, use its component, otherwise
+        # PPAs only have main
+        if self.archive.is_ppa:
+            assert self.component.name == 'main'
+            return
+
+        # If there is published ancestry, use its component, otherwise
         # use the original upload component.
         ancestry = self.getAncestry()
         if ancestry is not None:

=== 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 11:31:16 +0000
@@ -956,6 +956,25 @@
         self.copyAndCheck(
             binary, binary.distroarchseries.distroseries, 'universe')
 
+    def test_ppa_override_no_ancestry(self):
+        # Test a PPA publication with no ancestry is 'main'
+        ppa = self.factory.makeArchive(purpose=ArchivePurpose.PPA)
+        spr = self.factory.makeSourcePackageRelease()
+        spph = self.factory.makeSourcePackagePublishingHistory(
+            sourcepackagerelease=spr, archive=ppa)
+        spph.overrideFromAncestry()
+        self.assertEquals(spph.component.name, 'main')
+
+    def test_ppa_override_with_ancestry(self):
+        # Test a PPA publication with ancestry
+        ppa = self.factory.makeArchive(purpose=ArchivePurpose.PPA)
+        spr = self.factory.makeSourcePackageRelease()
+        spph = self.factory.makeSourcePackagePublishingHistory(
+            sourcepackagerelease=spr, archive=ppa)
+        spph2 = self.factory.makeSourcePackagePublishingHistory(
+            sourcepackagerelease=spr, archive=ppa)
+        spph2.overrideFromAncestry()
+        self.assertEquals(spph2.component.name, 'main')
 
 class BuildRecordCreationTests(TestNativePublishingBase):
     """Test the creation of build records."""