← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/ddeb-copy-overrides into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/ddeb-copy-overrides into lp:launchpad.

Commit message:
Fix PublishingSet.copyBinaries to correctly override DDEBs identically to their corresponding DEBs.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1179329 in Launchpad itself: "lp.soyuz.adapters.overrides doesn't respect ddeb override rules"
  https://bugs.launchpad.net/launchpad/+bug/1179329

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/ddeb-copy-overrides/+merge/166188

Fix PublishingSet.copyBinaries to correctly override DDEBs identically to their corresponding DEBs.
-- 
https://code.launchpad.net/~wgrant/launchpad/ddeb-copy-overrides/+merge/166188
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/ddeb-copy-overrides into lp:launchpad.
=== modified file 'lib/lp/soyuz/model/publishing.py'
--- lib/lp/soyuz/model/publishing.py	2013-05-27 07:58:22 +0000
+++ lib/lp/soyuz/model/publishing.py	2013-05-29 07:44:28 +0000
@@ -1467,7 +1467,15 @@
 
         if policy is not None:
             bpn_archtag = {}
+            ddebs = set()
             for bpph in bpphs:
+                # DDEBs just inherit their corresponding DEB's
+                # overrides, so don't ask for specific ones.
+                if (bpph.binarypackagerelease.binpackageformat
+                        == BinaryPackageFormat.DDEB):
+                    ddebs.add(bpph.binarypackagerelease)
+                    continue
+
                 bpn_archtag[(
                     bpph.binarypackagerelease.binarypackagename,
                     bpph.distroarchseries.architecturetag)] = bpph
@@ -1485,6 +1493,15 @@
                 new_priority = override.priority or bpph.priority
                 calculated = (new_component, new_section, new_priority)
                 with_overrides[bpph.binarypackagerelease] = calculated
+
+                # If there is a corresponding DDEB then give it our
+                # overrides too. It should always be part of the copy
+                # already.
+                maybe_ddeb = bpph.binarypackagerelease.debug_package
+                if maybe_ddeb is not None:
+                    assert maybe_ddeb in ddebs
+                    ddebs.remove(maybe_ddeb)
+                    with_overrides[maybe_ddeb] = calculated
         else:
             with_overrides = dict(
                 (bpph.binarypackagerelease, (bpph.component, bpph.section,

=== modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py'
--- lib/lp/soyuz/scripts/tests/test_copypackage.py	2013-05-24 01:16:42 +0000
+++ lib/lp/soyuz/scripts/tests/test_copypackage.py	2013-05-29 07:44:28 +0000
@@ -1244,13 +1244,17 @@
     def test_existing_publication_overrides(self):
         # When source/binaries are copied to a destination primary archive,
         # if that archive has existing publications, we respect their
-        # component and section when copying.
+        # component and section when copying. This even works for ddebs
+        # that are new in the target archive: they inherit their deb's
+        # overrides.
         nobby = self.createNobby(('i386', 'hppa'))
         archive = self.factory.makeArchive(
             distribution=self.test_publisher.ubuntutest, virtualized=False)
+        archive.build_debug_symbols = True
         target_archive = self.factory.makeArchive(
             distribution=self.test_publisher.ubuntutest, virtualized=False,
             purpose=ArchivePurpose.PRIMARY)
+        target_archive.build_debug_symbols = True
         existing_source = self.test_publisher.getPubSource(
             archive=target_archive, version='1.0-1', distroseries=nobby,
             architecturehintlist='all')
@@ -1263,17 +1267,18 @@
 
         source = self.test_publisher.getPubSource(
             archive=archive, version='1.0-2', architecturehintlist='all')
-        [bin_i386, bin_hppa] = self.test_publisher.getPubBinaries(
-            pub_source=source)
+        bins = self.test_publisher.getPubBinaries(
+            pub_source=source, with_debug=True)
+        [bin_i386, dbg_i386, bin_hppa, dbg_hppa] = bins
         # The package copier will want the changes files associated with the
         # upload.
         transaction.commit()
 
-        [copied_source, copied_bin_i386, copied_bin_hppa] = self.doCopy(
+        copied_pubs = self.doCopy(
             source, target_archive, nobby, source.pocket, True)
-        self.assertEqual(copied_source.component, existing_source.component)
-        self.assertOverrides(ebin_i386.component, ebin_i386, copied_bin_i386)
-        self.assertOverrides(ebin_hppa.component, ebin_hppa, copied_bin_hppa)
+        self.assertEqual(copied_pubs[0].component, existing_source.component)
+        for copied_bin in copied_pubs[1:]:
+            self.assertOverrides(ebin_i386.component, ebin_i386, copied_bin)
 
     def _setup_archive(self, version="1.0-2", use_nobby=False, **kwargs):
         archive = self.test_publisher.ubuntutest.main_archive