← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/override-love-for-ddebs into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/override-love-for-ddebs into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #604427 in Launchpad itself: "Overrides of a DEB must override the corresponding DDEB too"
  https://bugs.launchpad.net/launchpad/+bug/604427

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/override-love-for-ddebs/+merge/162453

IBinaryPackagePublishingHistory.changeOverride() will now also look for corresponding debug publications and also override them.
-- 
https://code.launchpad.net/~stevenk/launchpad/override-love-for-ddebs/+merge/162453
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/override-love-for-ddebs into lp:launchpad.
=== modified file 'lib/lp/soyuz/model/publishing.py'
--- lib/lp/soyuz/model/publishing.py	2013-05-03 00:07:30 +0000
+++ lib/lp/soyuz/model/publishing.py	2013-05-03 19:26:40 +0000
@@ -1243,6 +1243,23 @@
                 "Cannot change overrides in suite '%s'" %
                 self.distroseries.getSuite(self.pocket))
 
+        # Search for related debug publications, and override them too.
+        debugs = getUtility(IPublishingSet).findCorrespondingDDEBPublications(
+            [self])
+        # We expect only one, but we will override all of them.
+        for debug in debugs:
+            BinaryPackagePublishingHistory(
+                binarypackagename=debug.binarypackagename,
+                binarypackagerelease=debug.binarypackagerelease,
+                distroarchseries=debug.distroarchseries,
+                status=PackagePublishingStatus.PENDING,
+                datecreated=UTC_NOW,
+                component=new_component,
+                section=new_section,
+                priority=new_priority,
+                archive=debug.archive,
+                phased_update_percentage=new_phased_update_percentage)
+
         # Append the modified package publishing entry
         return BinaryPackagePublishingHistory(
             binarypackagename=bpr.binarypackagename,

=== modified file 'lib/lp/soyuz/tests/test_publishing.py'
--- lib/lp/soyuz/tests/test_publishing.py	2013-05-02 23:34:50 +0000
+++ lib/lp/soyuz/tests/test_publishing.py	2013-05-03 19:26:40 +0000
@@ -1250,6 +1250,23 @@
         self.assertEqual(
             debug_non_match_bpph.status, PackagePublishingStatus.PENDING)
 
+    def test_changeOverride_also_overrides_debug_package(self):
+        bpph = self.factory.makeBinaryPackagePublishingHistory(
+            pocket=PackagePublishingPocket.RELEASE)
+        bpr = removeSecurityProxy(bpph.binarypackagerelease)
+        debug_bpph = self.factory.makeBinaryPackagePublishingHistory(
+            pocket=PackagePublishingPocket.RELEASE,
+            binpackageformat=BinaryPackageFormat.DDEB,
+            archive=bpph.archive, section_name=bpph.section,
+            distroarchseries=bpph.distroarchseries)
+        bpr.debug_package = debug_bpph.binarypackagerelease
+        new_section = self.factory.makeSection()
+        new_bpph = bpph.changeOverride(new_section=new_section)
+        publishing_set = getUtility(IPublishingSet)
+        [new_debug_bpph] = publishing_set.findCorrespondingDDEBPublications(
+            [new_bpph])
+        self.assertEqual(new_debug_bpph.section, new_section)
+
 
 class TestSourceDomination(TestNativePublishingBase):
     """Test SourcePackagePublishingHistory.supersede() operates correctly."""