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

Proposed by William Grant
Status: Merged
Approved by: Steve Kowalik
Approved revision: no longer in the source branch.
Merged at revision: 16655
Proposed branch: lp:~wgrant/launchpad/ddeb-copy-overrides
Merge into: lp:launchpad
Diff against target: 83 lines (+29/-7)
2 files modified
lib/lp/soyuz/model/publishing.py (+17/-0)
lib/lp/soyuz/scripts/tests/test_copypackage.py (+12/-7)
To merge this branch: bzr merge lp:~wgrant/launchpad/ddeb-copy-overrides
Reviewer Review Type Date Requested Status
Steve Kowalik (community) code Approve
Review via email: mp+166188@code.launchpad.net

Commit message

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

Description of the change

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

To post a comment you must log in.
Revision history for this message
Steve Kowalik (stevenk) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/model/publishing.py'
2--- lib/lp/soyuz/model/publishing.py 2013-05-27 07:58:22 +0000
3+++ lib/lp/soyuz/model/publishing.py 2013-05-29 07:44:28 +0000
4@@ -1467,7 +1467,15 @@
5
6 if policy is not None:
7 bpn_archtag = {}
8+ ddebs = set()
9 for bpph in bpphs:
10+ # DDEBs just inherit their corresponding DEB's
11+ # overrides, so don't ask for specific ones.
12+ if (bpph.binarypackagerelease.binpackageformat
13+ == BinaryPackageFormat.DDEB):
14+ ddebs.add(bpph.binarypackagerelease)
15+ continue
16+
17 bpn_archtag[(
18 bpph.binarypackagerelease.binarypackagename,
19 bpph.distroarchseries.architecturetag)] = bpph
20@@ -1485,6 +1493,15 @@
21 new_priority = override.priority or bpph.priority
22 calculated = (new_component, new_section, new_priority)
23 with_overrides[bpph.binarypackagerelease] = calculated
24+
25+ # If there is a corresponding DDEB then give it our
26+ # overrides too. It should always be part of the copy
27+ # already.
28+ maybe_ddeb = bpph.binarypackagerelease.debug_package
29+ if maybe_ddeb is not None:
30+ assert maybe_ddeb in ddebs
31+ ddebs.remove(maybe_ddeb)
32+ with_overrides[maybe_ddeb] = calculated
33 else:
34 with_overrides = dict(
35 (bpph.binarypackagerelease, (bpph.component, bpph.section,
36
37=== modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py'
38--- lib/lp/soyuz/scripts/tests/test_copypackage.py 2013-05-24 01:16:42 +0000
39+++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2013-05-29 07:44:28 +0000
40@@ -1244,13 +1244,17 @@
41 def test_existing_publication_overrides(self):
42 # When source/binaries are copied to a destination primary archive,
43 # if that archive has existing publications, we respect their
44- # component and section when copying.
45+ # component and section when copying. This even works for ddebs
46+ # that are new in the target archive: they inherit their deb's
47+ # overrides.
48 nobby = self.createNobby(('i386', 'hppa'))
49 archive = self.factory.makeArchive(
50 distribution=self.test_publisher.ubuntutest, virtualized=False)
51+ archive.build_debug_symbols = True
52 target_archive = self.factory.makeArchive(
53 distribution=self.test_publisher.ubuntutest, virtualized=False,
54 purpose=ArchivePurpose.PRIMARY)
55+ target_archive.build_debug_symbols = True
56 existing_source = self.test_publisher.getPubSource(
57 archive=target_archive, version='1.0-1', distroseries=nobby,
58 architecturehintlist='all')
59@@ -1263,17 +1267,18 @@
60
61 source = self.test_publisher.getPubSource(
62 archive=archive, version='1.0-2', architecturehintlist='all')
63- [bin_i386, bin_hppa] = self.test_publisher.getPubBinaries(
64- pub_source=source)
65+ bins = self.test_publisher.getPubBinaries(
66+ pub_source=source, with_debug=True)
67+ [bin_i386, dbg_i386, bin_hppa, dbg_hppa] = bins
68 # The package copier will want the changes files associated with the
69 # upload.
70 transaction.commit()
71
72- [copied_source, copied_bin_i386, copied_bin_hppa] = self.doCopy(
73+ copied_pubs = self.doCopy(
74 source, target_archive, nobby, source.pocket, True)
75- self.assertEqual(copied_source.component, existing_source.component)
76- self.assertOverrides(ebin_i386.component, ebin_i386, copied_bin_i386)
77- self.assertOverrides(ebin_hppa.component, ebin_hppa, copied_bin_hppa)
78+ self.assertEqual(copied_pubs[0].component, existing_source.component)
79+ for copied_bin in copied_pubs[1:]:
80+ self.assertOverrides(ebin_i386.component, ebin_i386, copied_bin)
81
82 def _setup_archive(self, version="1.0-2", use_nobby=False, **kwargs):
83 archive = self.test_publisher.ubuntutest.main_archive