Merge lp:~wgrant/launchpad/get-out-of-here-p-a-s into lp:launchpad
- get-out-of-here-p-a-s
- Merge into devel
Proposed by
William Grant
Status: | Merged |
---|---|
Approved by: | Henning Eggers |
Approved revision: | no longer in the source branch. |
Merged at revision: | not available |
Proposed branch: | lp:~wgrant/launchpad/get-out-of-here-p-a-s |
Merge into: | lp:launchpad |
Diff against target: |
304 lines (+104/-100) 6 files modified
lib/lp/buildmaster/master.py (+1/-95) lib/lp/soyuz/doc/package-arch-specific.txt (+2/-3) lib/lp/soyuz/model/publishing.py (+1/-1) lib/lp/soyuz/model/queue.py (+1/-1) lib/lp/soyuz/pas.py (+94/-0) lib/lp/soyuz/tests/test_doc.py (+5/-0) |
To merge this branch: | bzr merge lp:~wgrant/launchpad/get-out-of-here-p-a-s |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Julian Edwards (community) | Approve | ||
Henning Eggers (community) | code | Approve | |
Review via email: mp+21312@code.launchpad.net |
Commit message
Move P-a-s from lp.buildmaster to lp.soyuz. Landed by henninge.
Description of the change
This branch just moves the Packages-
To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote : | # |
Looks ok, but I think pas.py should come out of model/ and into soyuz/
Cheers
Revision history for this message
Julian Edwards (julian-edwards) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/lp/buildmaster/master.py' | |||
2 | --- lib/lp/buildmaster/master.py 2010-03-08 12:53:59 +0000 | |||
3 | +++ lib/lp/buildmaster/master.py 2010-03-15 10:39:26 +0000 | |||
4 | @@ -14,7 +14,6 @@ | |||
5 | 14 | 14 | ||
6 | 15 | 15 | ||
7 | 16 | import logging | 16 | import logging |
8 | 17 | import operator | ||
9 | 18 | 17 | ||
10 | 19 | from zope.component import getUtility | 18 | from zope.component import getUtility |
11 | 20 | 19 | ||
12 | @@ -24,102 +23,9 @@ | |||
13 | 24 | from lp.archivepublisher.utils import process_in_batches | 23 | from lp.archivepublisher.utils import process_in_batches |
14 | 25 | from lp.buildmaster.interfaces.buildbase import BuildStatus | 24 | from lp.buildmaster.interfaces.buildbase import BuildStatus |
15 | 26 | from lp.buildmaster.interfaces.buildqueue import IBuildQueueSet | 25 | from lp.buildmaster.interfaces.buildqueue import IBuildQueueSet |
16 | 27 | from lp.buildmaster.pas import BuildDaemonPackagesArchSpecific | ||
17 | 28 | from lp.buildmaster.buildergroup import BuilderGroup | 26 | from lp.buildmaster.buildergroup import BuilderGroup |
18 | 29 | from lp.soyuz.interfaces.archive import ArchivePurpose | ||
19 | 30 | from lp.soyuz.interfaces.build import IBuildSet | 27 | from lp.soyuz.interfaces.build import IBuildSet |
112 | 31 | 28 | from lp.soyuz.pas import BuildDaemonPackagesArchSpecific | |
21 | 32 | |||
22 | 33 | def determineArchitecturesToBuild(pubrec, legal_archseries, | ||
23 | 34 | distroseries, pas_verify=None): | ||
24 | 35 | """Return a list of architectures for which this publication should build. | ||
25 | 36 | |||
26 | 37 | This function answers the question: given a publication, what | ||
27 | 38 | architectures should we build it for? It takes a set of legal | ||
28 | 39 | distroarchseries and the distribution series for which we are | ||
29 | 40 | building, and optionally a BuildDaemonPackagesArchSpecific | ||
30 | 41 | (informally known as 'P-a-s') instance. | ||
31 | 42 | |||
32 | 43 | The P-a-s component contains a list of forbidden architectures for | ||
33 | 44 | each source package, which should be respected regardless of which | ||
34 | 45 | architectures have been requested in the source package metadata, | ||
35 | 46 | for instance: | ||
36 | 47 | |||
37 | 48 | * 'aboot' should only build on powerpc | ||
38 | 49 | * 'mozilla-firefox' should not build on sparc | ||
39 | 50 | |||
40 | 51 | This black/white list is an optimization to suppress temporarily | ||
41 | 52 | known-failures build attempts and thus saving build-farm time. | ||
42 | 53 | |||
43 | 54 | For PPA publications we only consider architectures supported by PPA | ||
44 | 55 | subsystem (`DistroArchSeries`.supports_virtualized flag) and P-a-s is turned | ||
45 | 56 | off to give the users the chance to test their fixes for upstream | ||
46 | 57 | problems. | ||
47 | 58 | |||
48 | 59 | :param: pubrec: `ISourcePackagePublishingHistory` representing the | ||
49 | 60 | source publication. | ||
50 | 61 | :param: legal_archseries: a list of all initialized `DistroArchSeries` | ||
51 | 62 | to be considered. | ||
52 | 63 | :param: distroseries: the context `DistroSeries`. | ||
53 | 64 | :param: pas_verify: optional P-a-s verifier object/component. | ||
54 | 65 | :return: a list of `DistroArchSeries` for which the source publication in | ||
55 | 66 | question should be built. | ||
56 | 67 | """ | ||
57 | 68 | hint_string = pubrec.sourcepackagerelease.architecturehintlist | ||
58 | 69 | |||
59 | 70 | assert hint_string, 'Missing arch_hint_list' | ||
60 | 71 | |||
61 | 72 | # Ignore P-a-s for PPA publications. | ||
62 | 73 | if pubrec.archive.purpose == ArchivePurpose.PPA: | ||
63 | 74 | pas_verify = None | ||
64 | 75 | |||
65 | 76 | # The 'PPA supported' flag only applies to virtualized archives | ||
66 | 77 | if pubrec.archive.require_virtualized: | ||
67 | 78 | legal_archseries = [ | ||
68 | 79 | arch for arch in legal_archseries if arch.supports_virtualized] | ||
69 | 80 | # Cope with no virtualization support at all. It usually happens when | ||
70 | 81 | # a distroseries is created and initialized, by default no | ||
71 | 82 | # architecture supports its. Distro-team might take some time to | ||
72 | 83 | # decide which architecture will be allowed for PPAs and queue-builder | ||
73 | 84 | # will continue to work meanwhile. | ||
74 | 85 | if not legal_archseries: | ||
75 | 86 | return [] | ||
76 | 87 | |||
77 | 88 | legal_arch_tags = set(arch.architecturetag for arch in legal_archseries) | ||
78 | 89 | |||
79 | 90 | if hint_string == 'any': | ||
80 | 91 | package_tags = legal_arch_tags | ||
81 | 92 | elif hint_string == 'all': | ||
82 | 93 | nominated_arch = distroseries.nominatedarchindep | ||
83 | 94 | legal_archseries_ids = [arch.id for arch in legal_archseries] | ||
84 | 95 | assert nominated_arch.id in legal_archseries_ids, ( | ||
85 | 96 | 'nominatedarchindep is not present in legal_archseries: %s' % | ||
86 | 97 | ' '.join(legal_arch_tags)) | ||
87 | 98 | package_tags = set([nominated_arch.architecturetag]) | ||
88 | 99 | else: | ||
89 | 100 | my_archs = hint_string.split() | ||
90 | 101 | # Allow any-foo or linux-foo to mean foo. See bug 73761. | ||
91 | 102 | my_archs = [arch.replace("any-", "") for arch in my_archs] | ||
92 | 103 | my_archs = [arch.replace("linux-", "") for arch in my_archs] | ||
93 | 104 | my_archs = set(my_archs) | ||
94 | 105 | package_tags = my_archs.intersection(legal_arch_tags) | ||
95 | 106 | |||
96 | 107 | if pas_verify: | ||
97 | 108 | build_tags = set() | ||
98 | 109 | for tag in package_tags: | ||
99 | 110 | sourcepackage_name = pubrec.sourcepackagerelease.name | ||
100 | 111 | if sourcepackage_name in pas_verify.permit: | ||
101 | 112 | permitted = pas_verify.permit[sourcepackage_name] | ||
102 | 113 | if tag not in permitted: | ||
103 | 114 | continue | ||
104 | 115 | build_tags.add(tag) | ||
105 | 116 | else: | ||
106 | 117 | build_tags = package_tags | ||
107 | 118 | |||
108 | 119 | sorted_archseries = sorted(legal_archseries, | ||
109 | 120 | key=operator.attrgetter('architecturetag')) | ||
110 | 121 | return [arch for arch in sorted_archseries | ||
111 | 122 | if arch.architecturetag in build_tags] | ||
113 | 123 | 29 | ||
114 | 124 | 30 | ||
115 | 125 | class BuilddMaster: | 31 | class BuilddMaster: |
116 | 126 | 32 | ||
117 | === renamed file 'lib/lp/buildmaster/tests/package-arch-specific.txt' => 'lib/lp/soyuz/doc/package-arch-specific.txt' | |||
118 | --- lib/lp/buildmaster/tests/package-arch-specific.txt 2009-05-14 09:28:47 +0000 | |||
119 | +++ lib/lp/soyuz/doc/package-arch-specific.txt 2010-03-15 10:39:26 +0000 | |||
120 | @@ -95,8 +95,8 @@ | |||
121 | 95 | See if the code which determines archs to build does the right thing for | 95 | See if the code which determines archs to build does the right thing for |
122 | 96 | each of these options: | 96 | each of these options: |
123 | 97 | 97 | ||
126 | 98 | >>> from lp.buildmaster.master import ( | 98 | >>> from lp.soyuz.pas import ( |
127 | 99 | ... determineArchitecturesToBuild) | 99 | ... BuildDaemonPackagesArchSpecific, determineArchitecturesToBuild) |
128 | 100 | 100 | ||
129 | 101 | >>> def print_build_architectures(pub, pas_verify=None): | 101 | >>> def print_build_architectures(pub, pas_verify=None): |
130 | 102 | ... allowed_architectures = determineArchitecturesToBuild( | 102 | ... allowed_architectures = determineArchitecturesToBuild( |
131 | @@ -182,7 +182,6 @@ | |||
132 | 182 | >>> import os | 182 | >>> import os |
133 | 183 | >>> import tempfile | 183 | >>> import tempfile |
134 | 184 | >>> import shutil | 184 | >>> import shutil |
135 | 185 | >>> from lp.buildmaster.pas import BuildDaemonPackagesArchSpecific | ||
136 | 186 | 185 | ||
137 | 187 | >>> def getPASVerifier(pas_string): | 186 | >>> def getPASVerifier(pas_string): |
138 | 188 | ... """Build and return a PAS verifier based on the string provided.""" | 187 | ... """Build and return a PAS verifier based on the string provided.""" |
139 | 189 | 188 | ||
140 | === modified file 'lib/lp/soyuz/model/publishing.py' | |||
141 | --- lib/lp/soyuz/model/publishing.py 2010-03-06 04:57:40 +0000 | |||
142 | +++ lib/lp/soyuz/model/publishing.py 2010-03-15 10:39:26 +0000 | |||
143 | @@ -41,7 +41,6 @@ | |||
144 | 41 | IStoreSelector, MAIN_STORE, DEFAULT_FLAVOR) | 41 | IStoreSelector, MAIN_STORE, DEFAULT_FLAVOR) |
145 | 42 | from canonical.launchpad.webapp.interfaces import NotFoundError | 42 | from canonical.launchpad.webapp.interfaces import NotFoundError |
146 | 43 | from lp.buildmaster.interfaces.buildbase import BuildStatus | 43 | from lp.buildmaster.interfaces.buildbase import BuildStatus |
147 | 44 | from lp.buildmaster.master import determineArchitecturesToBuild | ||
148 | 45 | from lp.registry.interfaces.person import validate_public_person | 44 | from lp.registry.interfaces.person import validate_public_person |
149 | 46 | from lp.registry.interfaces.pocket import PackagePublishingPocket | 45 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
150 | 47 | from lp.soyuz.model.binarypackagename import BinaryPackageName | 46 | from lp.soyuz.model.binarypackagename import BinaryPackageName |
151 | @@ -62,6 +61,7 @@ | |||
152 | 62 | PackagePublishingPriority, PackagePublishingStatus, | 61 | PackagePublishingPriority, PackagePublishingStatus, |
153 | 63 | PoolFileOverwriteError) | 62 | PoolFileOverwriteError) |
154 | 64 | from lp.soyuz.interfaces.queue import PackageUploadStatus | 63 | from lp.soyuz.interfaces.queue import PackageUploadStatus |
155 | 64 | from lp.soyuz.pas import determineArchitecturesToBuild | ||
156 | 65 | from lp.soyuz.scripts.changeoverride import ArchiveOverriderError | 65 | from lp.soyuz.scripts.changeoverride import ArchiveOverriderError |
157 | 66 | 66 | ||
158 | 67 | 67 | ||
159 | 68 | 68 | ||
160 | === modified file 'lib/lp/soyuz/model/queue.py' | |||
161 | --- lib/lp/soyuz/model/queue.py 2010-03-12 16:52:21 +0000 | |||
162 | +++ lib/lp/soyuz/model/queue.py 2010-03-15 10:39:26 +0000 | |||
163 | @@ -35,7 +35,6 @@ | |||
164 | 35 | from lp.archiveuploader.changesfile import ChangesFile | 35 | from lp.archiveuploader.changesfile import ChangesFile |
165 | 36 | from lp.archiveuploader.tagfiles import parse_tagfile_lines | 36 | from lp.archiveuploader.tagfiles import parse_tagfile_lines |
166 | 37 | from lp.archiveuploader.utils import safe_fix_maintainer | 37 | from lp.archiveuploader.utils import safe_fix_maintainer |
167 | 38 | from lp.buildmaster.pas import BuildDaemonPackagesArchSpecific | ||
168 | 39 | from canonical.cachedproperty import cachedproperty | 38 | from canonical.cachedproperty import cachedproperty |
169 | 40 | from canonical.config import config | 39 | from canonical.config import config |
170 | 41 | from canonical.database.constants import UTC_NOW | 40 | from canonical.database.constants import UTC_NOW |
171 | @@ -60,6 +59,7 @@ | |||
172 | 60 | NonBuildableSourceUploadError, QueueBuildAcceptError, | 59 | NonBuildableSourceUploadError, QueueBuildAcceptError, |
173 | 61 | QueueInconsistentStateError, QueueSourceAcceptError, | 60 | QueueInconsistentStateError, QueueSourceAcceptError, |
174 | 62 | QueueStateWriteProtectedError) | 61 | QueueStateWriteProtectedError) |
175 | 62 | from lp.soyuz.pas import BuildDaemonPackagesArchSpecific | ||
176 | 63 | from canonical.launchpad.mail import ( | 63 | from canonical.launchpad.mail import ( |
177 | 64 | format_address, signed_message_from_string, sendmail) | 64 | format_address, signed_message_from_string, sendmail) |
178 | 65 | from lp.soyuz.scripts.processaccepted import ( | 65 | from lp.soyuz.scripts.processaccepted import ( |
179 | 66 | 66 | ||
180 | === renamed file 'lib/lp/buildmaster/pas.py' => 'lib/lp/soyuz/pas.py' | |||
181 | --- lib/lp/buildmaster/pas.py 2009-06-25 00:46:29 +0000 | |||
182 | +++ lib/lp/soyuz/pas.py 2010-03-15 10:39:26 +0000 | |||
183 | @@ -2,9 +2,12 @@ | |||
184 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
185 | 3 | 3 | ||
186 | 4 | import os | 4 | import os |
187 | 5 | import operator | ||
188 | 5 | 6 | ||
189 | 6 | from sqlobject import SQLObjectNotFound | 7 | from sqlobject import SQLObjectNotFound |
190 | 7 | 8 | ||
191 | 9 | from lp.soyuz.interfaces.archive import ArchivePurpose | ||
192 | 10 | |||
193 | 8 | class BuildDaemonPackagesArchSpecific: | 11 | class BuildDaemonPackagesArchSpecific: |
194 | 9 | """Parse and implement "PackagesArchSpecific".""" | 12 | """Parse and implement "PackagesArchSpecific".""" |
195 | 10 | 13 | ||
196 | @@ -106,3 +109,94 @@ | |||
197 | 106 | 109 | ||
198 | 107 | return source_name, arch_tags | 110 | return source_name, arch_tags |
199 | 108 | 111 | ||
200 | 112 | |||
201 | 113 | def determineArchitecturesToBuild(pubrec, legal_archseries, | ||
202 | 114 | distroseries, pas_verify=None): | ||
203 | 115 | """Return a list of architectures for which this publication should build. | ||
204 | 116 | |||
205 | 117 | This function answers the question: given a publication, what | ||
206 | 118 | architectures should we build it for? It takes a set of legal | ||
207 | 119 | distroarchseries and the distribution series for which we are | ||
208 | 120 | building, and optionally a BuildDaemonPackagesArchSpecific | ||
209 | 121 | (informally known as 'P-a-s') instance. | ||
210 | 122 | |||
211 | 123 | The P-a-s component contains a list of forbidden architectures for | ||
212 | 124 | each source package, which should be respected regardless of which | ||
213 | 125 | architectures have been requested in the source package metadata, | ||
214 | 126 | for instance: | ||
215 | 127 | |||
216 | 128 | * 'aboot' should only build on powerpc | ||
217 | 129 | * 'mozilla-firefox' should not build on sparc | ||
218 | 130 | |||
219 | 131 | This black/white list is an optimization to suppress temporarily | ||
220 | 132 | known-failures build attempts and thus saving build-farm time. | ||
221 | 133 | |||
222 | 134 | For PPA publications we only consider architectures supported by PPA | ||
223 | 135 | subsystem (`DistroArchSeries`.supports_virtualized flag) and P-a-s is turned | ||
224 | 136 | off to give the users the chance to test their fixes for upstream | ||
225 | 137 | problems. | ||
226 | 138 | |||
227 | 139 | :param: pubrec: `ISourcePackagePublishingHistory` representing the | ||
228 | 140 | source publication. | ||
229 | 141 | :param: legal_archseries: a list of all initialized `DistroArchSeries` | ||
230 | 142 | to be considered. | ||
231 | 143 | :param: distroseries: the context `DistroSeries`. | ||
232 | 144 | :param: pas_verify: optional P-a-s verifier object/component. | ||
233 | 145 | :return: a list of `DistroArchSeries` for which the source publication in | ||
234 | 146 | question should be built. | ||
235 | 147 | """ | ||
236 | 148 | hint_string = pubrec.sourcepackagerelease.architecturehintlist | ||
237 | 149 | |||
238 | 150 | assert hint_string, 'Missing arch_hint_list' | ||
239 | 151 | |||
240 | 152 | # Ignore P-a-s for PPA publications. | ||
241 | 153 | if pubrec.archive.purpose == ArchivePurpose.PPA: | ||
242 | 154 | pas_verify = None | ||
243 | 155 | |||
244 | 156 | # The 'PPA supported' flag only applies to virtualized archives | ||
245 | 157 | if pubrec.archive.require_virtualized: | ||
246 | 158 | legal_archseries = [ | ||
247 | 159 | arch for arch in legal_archseries if arch.supports_virtualized] | ||
248 | 160 | # Cope with no virtualization support at all. It usually happens when | ||
249 | 161 | # a distroseries is created and initialized, by default no | ||
250 | 162 | # architecture supports its. Distro-team might take some time to | ||
251 | 163 | # decide which architecture will be allowed for PPAs and queue-builder | ||
252 | 164 | # will continue to work meanwhile. | ||
253 | 165 | if not legal_archseries: | ||
254 | 166 | return [] | ||
255 | 167 | |||
256 | 168 | legal_arch_tags = set(arch.architecturetag for arch in legal_archseries) | ||
257 | 169 | |||
258 | 170 | if hint_string == 'any': | ||
259 | 171 | package_tags = legal_arch_tags | ||
260 | 172 | elif hint_string == 'all': | ||
261 | 173 | nominated_arch = distroseries.nominatedarchindep | ||
262 | 174 | legal_archseries_ids = [arch.id for arch in legal_archseries] | ||
263 | 175 | assert nominated_arch.id in legal_archseries_ids, ( | ||
264 | 176 | 'nominatedarchindep is not present in legal_archseries: %s' % | ||
265 | 177 | ' '.join(legal_arch_tags)) | ||
266 | 178 | package_tags = set([nominated_arch.architecturetag]) | ||
267 | 179 | else: | ||
268 | 180 | my_archs = hint_string.split() | ||
269 | 181 | # Allow any-foo or linux-foo to mean foo. See bug 73761. | ||
270 | 182 | my_archs = [arch.replace("any-", "") for arch in my_archs] | ||
271 | 183 | my_archs = [arch.replace("linux-", "") for arch in my_archs] | ||
272 | 184 | my_archs = set(my_archs) | ||
273 | 185 | package_tags = my_archs.intersection(legal_arch_tags) | ||
274 | 186 | |||
275 | 187 | if pas_verify: | ||
276 | 188 | build_tags = set() | ||
277 | 189 | for tag in package_tags: | ||
278 | 190 | sourcepackage_name = pubrec.sourcepackagerelease.name | ||
279 | 191 | if sourcepackage_name in pas_verify.permit: | ||
280 | 192 | permitted = pas_verify.permit[sourcepackage_name] | ||
281 | 193 | if tag not in permitted: | ||
282 | 194 | continue | ||
283 | 195 | build_tags.add(tag) | ||
284 | 196 | else: | ||
285 | 197 | build_tags = package_tags | ||
286 | 198 | |||
287 | 199 | sorted_archseries = sorted(legal_archseries, | ||
288 | 200 | key=operator.attrgetter('architecturetag')) | ||
289 | 201 | return [arch for arch in sorted_archseries | ||
290 | 202 | if arch.architecturetag in build_tags] | ||
291 | 109 | 203 | ||
292 | === modified file 'lib/lp/soyuz/tests/test_doc.py' | |||
293 | --- lib/lp/soyuz/tests/test_doc.py 2009-06-30 16:56:07 +0000 | |||
294 | +++ lib/lp/soyuz/tests/test_doc.py 2010-03-15 10:39:26 +0000 | |||
295 | @@ -200,6 +200,11 @@ | |||
296 | 200 | setUp=builddmasterSetUp, | 200 | setUp=builddmasterSetUp, |
297 | 201 | layer=LaunchpadZopelessLayer, | 201 | layer=LaunchpadZopelessLayer, |
298 | 202 | ), | 202 | ), |
299 | 203 | 'package-arch-specific.txt': LayeredDocFileSuite( | ||
300 | 204 | '../doc/package-arch-specific.txt', | ||
301 | 205 | setUp=builddmasterSetUp, | ||
302 | 206 | layer=LaunchpadZopelessLayer, | ||
303 | 207 | ), | ||
304 | 203 | } | 208 | } |
305 | 204 | 209 | ||
306 | 205 | 210 |
Thanks. ;-)