Merge lp:~wgrant/launchpad/bug-707189-forgetful-copier into lp:launchpad

Proposed by William Grant
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: 12263
Proposed branch: lp:~wgrant/launchpad/bug-707189-forgetful-copier
Merge into: lp:launchpad
Diff against target: 74 lines (+34/-3)
2 files modified
lib/lp/soyuz/model/publishing.py (+3/-3)
lib/lp/soyuz/scripts/tests/test_copypackage.py (+31/-0)
To merge this branch: bzr merge lp:~wgrant/launchpad/bug-707189-forgetful-copier
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Steve Kowalik (community) code* Approve
Review via email: mp+47341@code.launchpad.net

Commit message

[r=lifeless,stevenk][ui=none][bug=707189] PublishingSet.publishBinary now correctly checks whether a binary is already published, no longer erroneously skipping some architectures.

Description of the change

PublishingSet.publishBinary takes a target DistroArchSeries and creates publications as appropriate, including expanding it to cover all enabled architectures if the binary is architecture-independent. In doing so it first checks if the binary is already published -- if so, it will not create another publication.

The refactor in r12220 broke this, such that it now checks if the *requested* architecture is already published, instead of the target architecture. This means that architectures after nominated arch-indep alphabetically (ie. lpia) will not be have arch-indep publications created.

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

So, this bit is confusing:
+ # Now make a new distroseries with only i386.
+ nobby = self.createNobby(('i386', 'hppa'))

That and the code below suggest it creates two arches.

I wouldn't mind no comment, but if there is a comment, having it not match the code breaks my brain.

review: Approve

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 2011-01-15 06:32:40 +0000
3+++ lib/lp/soyuz/model/publishing.py 2011-01-25 08:03:47 +0000
4@@ -1298,7 +1298,7 @@
5 archive = debug_archive
6
7 published_binaries = []
8- for arch in target_archs:
9+ for target_arch in target_archs:
10 # We only publish the binary if it doesn't already exist in
11 # the destination. Note that this means we don't support
12 # override changes on their own.
13@@ -1306,11 +1306,11 @@
14 name=binarypackagerelease.name, exact_match=True,
15 version=binarypackagerelease.version,
16 status=active_publishing_status, pocket=pocket,
17- distroarchseries=distroarchseries)
18+ distroarchseries=target_arch)
19 if not bool(binaries_in_destination):
20 published_binaries.append(
21 getUtility(IPublishingSet).newBinaryPublication(
22- archive, binarypackagerelease, arch, component,
23+ archive, binarypackagerelease, target_arch, component,
24 section, priority, pocket))
25 return published_binaries
26
27
28=== modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py'
29--- lib/lp/soyuz/scripts/tests/test_copypackage.py 2011-01-11 07:50:10 +0000
30+++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2011-01-25 08:03:47 +0000
31@@ -49,6 +49,7 @@
32 from lp.soyuz.interfaces.publishing import (
33 active_publishing_status,
34 IBinaryPackagePublishingHistory,
35+ IPublishingSet,
36 ISourcePackagePublishingHistory,
37 )
38 from lp.soyuz.interfaces.queue import (
39@@ -1085,6 +1086,36 @@
40 # The binary should not be published for hppa.
41 self.assertCopied(copies, nobby, ('i386',))
42
43+ def test_copies_only_new_indep_publications(self):
44+ # When copying architecture-independent binaries to a series with
45+ # existing publications in some architectures, new publications
46+ # are only created in the missing archs.
47+
48+ # Make a new architecture-specific source and binary.
49+ archive = self.factory.makeArchive(
50+ distribution=self.test_publisher.ubuntutest, virtualized=False)
51+ source = self.test_publisher.getPubSource(
52+ archive=archive, architecturehintlist='all')
53+ [bin_i386, bin_hppa] = self.test_publisher.getPubBinaries(
54+ pub_source=source)
55+
56+ # Now make a new distroseries with two archs.
57+ nobby = self.createNobby(('i386', 'hppa'))
58+
59+ target_archive = self.factory.makeArchive(
60+ distribution=self.test_publisher.ubuntutest, virtualized=False)
61+ # Manually copy the indep pub to just i386.
62+ getUtility(IPublishingSet).newBinaryPublication(
63+ target_archive, bin_i386.binarypackagerelease, nobby['i386'],
64+ bin_i386.component, bin_i386.section, bin_i386.priority,
65+ bin_i386.pocket)
66+ # Now we can copy the package with binaries.
67+ copies = self.doCopy(
68+ source, target_archive, nobby, source.pocket, True)
69+
70+ # The copy succeeds, and no i386 publication is created.
71+ self.assertCopied(copies, nobby, ('hppa',))
72+
73
74 class TestDoDelayedCopy(TestCaseWithFactory, BaseDoCopyTests):
75