Merge lp:~julian-edwards/launchpad/ppa-components-bug-662088 into lp:launchpad

Proposed by Julian Edwards
Status: Merged
Approved by: Julian Edwards
Approved revision: no longer in the source branch.
Merged at revision: 12015
Proposed branch: lp:~julian-edwards/launchpad/ppa-components-bug-662088
Merge into: lp:launchpad
Diff against target: 108 lines (+20/-10)
3 files modified
lib/lp/archivepublisher/tests/test_publisher.py (+9/-9)
lib/lp/soyuz/model/archive.py (+2/-0)
lib/lp/soyuz/tests/test_archive.py (+9/-1)
To merge this branch: bzr merge lp:~julian-edwards/launchpad/ppa-components-bug-662088
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) code Approve
Julian Edwards (community) code Approve
Review via email: mp+42518@code.launchpad.net

Commit message

Make sure that we only publish the "main" component for PPA indexes. Currently it processes all components unnecessarily which wastes a lot of time.

Description of the change

The PPA publisher currently publishes indexes for all components we know about. PPAs only have "main" and this change makes sure we only publish main.

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) :
review: Approve (code)
Revision history for this message
Jelmer Vernooij (jelmer) :
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/archivepublisher/tests/test_publisher.py'
2--- lib/lp/archivepublisher/tests/test_publisher.py 2010-11-09 08:26:37 +0000
3+++ lib/lp/archivepublisher/tests/test_publisher.py 2010-12-02 17:41:38 +0000
4@@ -886,19 +886,19 @@
5 self.assertTrue(md5_header in release_contents)
6 md5_header_index = release_contents.index(md5_header)
7
8- plain_sources_md5_line = release_contents[md5_header_index + 15]
9+ plain_sources_md5_line = release_contents[md5_header_index + 16]
10 self.assertEqual(
11 plain_sources_md5_line,
12 (' 7d9b0817f5ff4a1d3f53f97bcc9c7658 '
13 '229 main/source/Sources'))
14- release_md5_line = release_contents[md5_header_index + 17]
15+ release_md5_line = release_contents[md5_header_index + 15]
16 self.assertEqual(
17 release_md5_line,
18 (' eadc1fbb1a878a2ee6dc66d7cd8d46dc '
19 '130 main/source/Release'))
20 # We can't probe checksums of compressed files because they contain
21 # timestamps, their checksum varies with time.
22- bz2_sources_md5_line = release_contents[md5_header_index + 16]
23+ bz2_sources_md5_line = release_contents[md5_header_index + 17]
24 self.assertTrue('main/source/Sources.bz2' in bz2_sources_md5_line)
25 gz_sources_md5_line = release_contents[md5_header_index + 18]
26 self.assertTrue('main/source/Sources.gz' in gz_sources_md5_line)
27@@ -907,18 +907,18 @@
28 self.assertTrue(sha1_header in release_contents)
29 sha1_header_index = release_contents.index(sha1_header)
30
31- plain_sources_sha1_line = release_contents[sha1_header_index + 15]
32+ plain_sources_sha1_line = release_contents[sha1_header_index + 16]
33 self.assertEqual(
34 plain_sources_sha1_line,
35 (' a2da1a8407fc4e2373266e56ccc7afadf8e08a3a '
36 '229 main/source/Sources'))
37- release_sha1_line = release_contents[sha1_header_index + 17]
38+ release_sha1_line = release_contents[sha1_header_index + 15]
39 self.assertEqual(
40 release_sha1_line,
41 (' 1a8d788a6d2d30e0cab002ab82e9f2921f7a2a61 '
42 '130 main/source/Release'))
43 # See above.
44- bz2_sources_sha1_line = release_contents[sha1_header_index + 16]
45+ bz2_sources_sha1_line = release_contents[sha1_header_index + 17]
46 self.assertTrue('main/source/Sources.bz2' in bz2_sources_sha1_line)
47 gz_sources_sha1_line = release_contents[sha1_header_index + 18]
48 self.assertTrue('main/source/Sources.gz' in gz_sources_sha1_line)
49@@ -927,18 +927,18 @@
50 self.assertTrue(sha256_header in release_contents)
51 sha256_header_index = release_contents.index(sha256_header)
52
53- plain_sources_sha256_line = release_contents[sha256_header_index + 15]
54+ plain_sources_sha256_line = release_contents[sha256_header_index + 16]
55 self.assertEqual(
56 plain_sources_sha256_line,
57 (' 979d959ead8ddc29e4347a64058a372d30df58a51a4615b43fb7499'
58 '8a9e07c78 229 main/source/Sources'))
59- release_sha256_line = release_contents[sha256_header_index + 17]
60+ release_sha256_line = release_contents[sha256_header_index + 15]
61 self.assertEqual(
62 release_sha256_line,
63 (' 795a3f17d485cc1983f588c53fb8c163599ed191be9741e61ca411f'
64 '1e2c505aa 130 main/source/Release'))
65 # See above.
66- bz2_sources_sha256_line = release_contents[sha256_header_index + 16]
67+ bz2_sources_sha256_line = release_contents[sha256_header_index + 17]
68 self.assertTrue('main/source/Sources.bz2' in bz2_sources_sha256_line)
69 gz_sources_sha256_line = release_contents[sha256_header_index + 18]
70 self.assertTrue('main/source/Sources.gz' in gz_sources_sha256_line)
71
72=== modified file 'lib/lp/soyuz/model/archive.py'
73--- lib/lp/soyuz/model/archive.py 2010-11-02 21:44:42 +0000
74+++ lib/lp/soyuz/model/archive.py 2010-12-02 17:41:38 +0000
75@@ -843,6 +843,8 @@
76 def getComponentsForSeries(self, distroseries):
77 if self.is_partner:
78 return [getUtility(IComponentSet)['partner']]
79+ elif self.is_ppa:
80+ return [getUtility(IComponentSet)['main']]
81 else:
82 return distroseries.components
83
84
85=== modified file 'lib/lp/soyuz/tests/test_archive.py'
86--- lib/lp/soyuz/tests/test_archive.py 2010-11-02 21:44:42 +0000
87+++ lib/lp/soyuz/tests/test_archive.py 2010-12-02 17:41:38 +0000
88@@ -1463,7 +1463,7 @@
89
90 def test_series_components_for_primary_archive(self):
91 # The primary archive uses the series' defined components.
92- archive = self.factory.makeArchive()
93+ archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY)
94 self.assertEquals(
95 0, archive.getComponentsForSeries(self.series).count())
96
97@@ -1482,3 +1482,11 @@
98 self.assertEquals(
99 [partner_comp],
100 list(archive.getComponentsForSeries(self.series)))
101+
102+ def test_component_for_ppas(self):
103+ # PPAs only use 'main'.
104+ archive = self.factory.makeArchive(purpose=ArchivePurpose.PPA)
105+ ComponentSelection(distroseries=self.series, component=self.comp1)
106+ main_comp = getUtility(IComponentSet)['main']
107+ self.assertEquals(
108+ [main_comp], list(archive.getComponentsForSeries(self.series)))