Code review comment for lp:~julian-edwards/launchpad/no-disabled-arch-publications-bug-648715

Revision history for this message
Julian Edwards (julian-edwards) wrote :

I've added a new revision that also does the same check when copying packages
betweeb distroseries. Would you mind blessing that too please? Thanks.
(partial diff attached)

1=== modified file 'lib/lp/soyuz/model/publishing.py'
2--- lib/lp/soyuz/model/publishing.py 2010-08-30 15:00:23 +0000
3+++ lib/lp/soyuz/model/publishing.py 2010-09-28 14:26:27 +0000
4@@ -1234,6 +1234,10 @@
5 binarypackagerelease = binary.binarypackagerelease
6 target_component = override_component or binary.component
7
8+ # XXX 2010-09-28 Julian bug=649859
9+ # This piece of code duplicates the logic in
10+ # PackageUploadBuild.publish(), it needs to be refactored.
11+
12 if binarypackagerelease.architecturespecific:
13 # If the binary is architecture specific and the target
14 # distroseries does not include the architecture then we
15@@ -1250,7 +1254,9 @@
16 continue
17 destination_architectures = [target_architecture]
18 else:
19- destination_architectures = distroseries.architectures
20+ destination_architectures = [
21+ arch for arch in distroseries.architectures
22+ if arch.enabled]
23
24 for distroarchseries in destination_architectures:
25
26
27=== modified file 'lib/lp/soyuz/model/queue.py'
28--- lib/lp/soyuz/model/queue.py 2010-09-28 09:53:27 +0000
29+++ lib/lp/soyuz/model/queue.py 2010-09-28 14:26:14 +0000
30@@ -1447,9 +1447,15 @@
31 target_das.distroseries.distribution.name,
32 target_das.distroseries.name,
33 build_archtag))
34+
35 # Get the other enabled distroarchseries for this
36 # distroseries. If the binary is architecture independent then
37 # we need to publish it in all of those too.
38+
39+ # XXX Julian 2010-09-28 bug=649859
40+ # This logic is duplicated in
41+ # PackagePublishingSet.copyBinariesTo() and should be
42+ # refactored.
43 other_das = set(
44 arch for arch in self.packageupload.distroseries.architectures
45 if arch.enabled)
46
47=== modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py'
48--- lib/lp/soyuz/scripts/tests/test_copypackage.py 2010-08-27 11:19:54 +0000
49+++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2010-09-28 14:21:42 +0000
50@@ -977,6 +977,44 @@
51 ],
52 [copy.displayname for copy in copies])
53
54+ def test_copying_arch_indep_binaries_with_disabled_arches(self):
55+ # When copying an arch-indep binary to a new series, we must not
56+ # copy it into architectures that are disabled.
57+
58+ # Make a new arch-all source and binary in breezy-autotest:
59+ archive = self.factory.makeArchive(
60+ distribution=self.test_publisher.ubuntutest, virtualized=False)
61+ source = self.test_publisher.getPubSource(
62+ archive=archive, architecturehintlist='all')
63+ [bin_i386, bin_hppa] = self.test_publisher.getPubBinaries(
64+ pub_source=source)
65+
66+ # Now make a new distroseries with two architectures, one of
67+ # which is disabled.
68+ nobby = self.factory.makeDistroSeries(
69+ distribution=self.test_publisher.ubuntutest, name='nobby')
70+ i386_pf = self.factory.makeProcessorFamily(name='my_i386')
71+ nobby_i386 = self.factory.makeDistroArchSeries(
72+ distroseries=nobby, architecturetag='i386',
73+ processorfamily=i386_pf)
74+ hppa_pf = self.factory.makeProcessorFamily(name='my_hppa')
75+ nobby_hppa = self.factory.makeDistroArchSeries(
76+ distroseries=nobby, architecturetag='hppa',
77+ processorfamily=hppa_pf)
78+ nobby_hppa.enabled = False
79+ nobby.nominatedarchindep = nobby_i386
80+ self.test_publisher.addFakeChroots(nobby)
81+
82+ # Now we can copy the package with binaries.
83+ copies = _do_direct_copy(
84+ source, source.archive, nobby, source.pocket, True)
85+
86+ # The binary should not be published for hppa.
87+ self.assertEquals(
88+ [u'foo 666 in nobby',
89+ u'foo-bin 666 in nobby i386',],
90+ [copy.displayname for copy in copies])
91+
92
93 class DoDelayedCopyTestCase(TestCaseWithFactory):
94

« Back to merge proposal