Merge lp:~jelmer/launchpad/bug471148-ui into lp:launchpad/db-devel
- bug471148-ui
- Merge into db-devel
Status: | Merged |
---|---|
Approved by: | Jelmer Vernooij |
Approved revision: | no longer in the source branch. |
Merge reported by: | Jelmer Vernooij |
Merged at revision: | not available |
Proposed branch: | lp:~jelmer/launchpad/bug471148-ui |
Merge into: | lp:launchpad/db-devel |
Diff against target: |
328 lines (+145/-14) (has conflicts) 9 files modified
database/schema/patch-2207-35-0.sql (+1/-1) database/schema/security.cfg (+2/-2) lib/lp/soyuz/browser/archive.py (+3/-2) lib/lp/soyuz/configure.zcml (+4/-0) lib/lp/soyuz/interfaces/archive.py (+3/-0) lib/lp/soyuz/model/archive.py (+35/-0) lib/lp/soyuz/tests/test_archive.py (+53/-0) lib/lp/soyuz/tests/test_processor.py (+2/-0) lib/lp/soyuz/tests/test_publishing.py (+42/-9) Text conflict in lib/lp/soyuz/configure.zcml |
To merge this branch: | bzr merge lp:~jelmer/launchpad/bug471148-ui |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Nelson (community) | ui | Approve | |
Abel Deuring (community) | code | Approve | |
Review via email: mp+20208@code.launchpad.net |
Commit message
Add a button in the archive admin form to allow or disallow builds on ARM.
Description of the change
Jelmer Vernooij (jelmer) wrote : | # |
Abel Deuring (adeuring) wrote : | # |
(14:46:44) adeuring: jelmer: could you add doc strings to _get_arm_
(14:47:36) adeuring: jelmer: sorry... i mean _set_arm_
(14:47:54) jelmer: adeuring: ok
(14:48:34) abentley [~<email address hidden>] hat den Raum betreten.
(14:49:15) adeuring: jelmer: there is an "elif" in set_arms_
(14:51:04) adeuring: jelmer: and (sorry about all these nitpick for one method...): The comment "a link is required but it is present" is a bit enigmatic, at least for me. What about sonething like "Arms builds are already enabled"?
(14:51:41) jelmer: adeuring: Sure, that's more sensible indeed.
Michael Nelson (michael.nelson) wrote : | # |
So just an update of the label text for now (other tiny improvements possible and outlined below, but can be made later).
16:43 < jelmer> noodles: Could you perhaps do a quick UI review?
16:44 < noodles> yeah, I'm just trying to get the 7th branch in my pipe through too.
16:44 < jelmer> We've just added a checkbox
16:44 < noodles> Sure.
16:44 < jelmer> http://
16:44 < edbot> Bug 471148 is private
16:44 < jelmer> I'm uploading a screenshot
16:44 < noodles> Great.
16:45 < noodles> Have you got an MP ready? (You can make it a "work in progress" one).
16:46 < jelmer> https:/
16:46 < edbot> Bug 471148 is private
16:46 < jelmer> abel has already reviewed the code
16:50 < noodles> jelmer: you guys are aware of the conflict right?
16:51 < noodles> oh, it's not in the diff...
16:51 < noodles> ah, yes it is :)
16:52 < noodles> Just a conflict with bigjools' configure changes from yesterday.
16:52 < jelmer> ah
16:52 < jelmer> I'll have a look
16:52 < jelmer> thanks
16:53 < bigjools> noodles: where are you seeing a conflict notified?
16:53 < noodles> bigjools: on jelmer's MP
16:53 < bigjools> oh - lol :)
16:53 < bigjools> thought it was db_lp
16:58 < jelmer> noodles: Muharem is uploading the screenshot, my launchpad instance is b0rked for some reason
16:59 < noodles> jelmer: I've merged it locally, so I'll run it here.
16:59 < noodles> But the screenshot will still be handy.
17:00 < al-maisan> noodles: here you go: https:/
17:00 < edbot> Bug 471148 is private
17:00 < noodles> Ta
17:03 < bigjools> fixed, thanks :)
17:04 < noodles> al-maisan, jelmer, wording-wise, I think "Allow ARM builds for this archive" (note: without a period) would be more consistent?
17:05 < al-maisan> hm .. hm .. OK
17:06 < noodles> If you've got other thoughts, just shout them out, I'm just comparing to the other checkboxes on that form (and looking for other examples).
17:07 * jelmer fix0rs
17:07 < noodles> And oh, would you mind cleaning up the capitalization on that form, there's lots of Headline Case for all the labels, that should be
17:07 < noodles> eg
17:07 < noodles> Require Virtualized Builder, Buildd Secret etc.
17:08 < noodles> (they probably have never been updated since we had the UIwording guidelines).
17:09 < noodles> But I'll understand if you don't want to risk test breakages etc. this late on Fri. afternoon.
17:09 < bigjools> hehe jelmer changed his gravatar again :)
17:09 < jelmer> bigjools: I just uploaded a bunch of images and gravatar makes it very easy to switch :-)
17:09 < bigjools> you need a floaty head!
17:09 < jelmer> noodles: Yeah, it'd be nice if we could just land this for now
17:09 < noodles> so ui=me just with the updated label for your checkbox.
17:09 < noodles> Yep.
17:10 < jelmer> noodles: I've made the wording change on the checkbox label
17:10 < noodles> Great.
17:10 < jelmer> noodles: Thanks!
17:10 < noodles> NP.
Preview Diff
1 | === renamed file 'database/schema/patch-9999-24-0.sql' => 'database/schema/patch-2207-35-0.sql' | |||
2 | --- database/schema/patch-9999-24-0.sql 2010-02-26 15:19:18 +0000 | |||
3 | +++ database/schema/patch-2207-35-0.sql 2010-02-26 15:19:22 +0000 | |||
4 | @@ -5,4 +5,4 @@ | |||
5 | 5 | 5 | ||
6 | 6 | ALTER TABLE processorfamily ADD COLUMN restricted boolean DEFAULT FALSE NOT NULL; | 6 | ALTER TABLE processorfamily ADD COLUMN restricted boolean DEFAULT FALSE NOT NULL; |
7 | 7 | 7 | ||
9 | 8 | INSERT INTO LaunchpadDatabaseRevision VALUES (9999, 24, 0); | 8 | INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 35, 0); |
10 | 9 | 9 | ||
11 | === modified file 'database/schema/security.cfg' | |||
12 | --- database/schema/security.cfg 2010-02-22 12:44:29 +0000 | |||
13 | +++ database/schema/security.cfg 2010-02-26 15:19:22 +0000 | |||
14 | @@ -125,7 +125,7 @@ | |||
15 | 125 | public.archive = SELECT, INSERT, UPDATE | 125 | public.archive = SELECT, INSERT, UPDATE |
16 | 126 | public.archiveauthtoken = SELECT, INSERT, UPDATE | 126 | public.archiveauthtoken = SELECT, INSERT, UPDATE |
17 | 127 | public.archivesubscriber = SELECT, INSERT, UPDATE | 127 | public.archivesubscriber = SELECT, INSERT, UPDATE |
19 | 128 | public.archivearch = SELECT, INSERT, UPDATE | 128 | public.archivearch = SELECT, INSERT, UPDATE, DELETE |
20 | 129 | public.archivedependency = SELECT, INSERT, DELETE | 129 | public.archivedependency = SELECT, INSERT, DELETE |
21 | 130 | public.archivepermission = SELECT, INSERT, UPDATE, DELETE | 130 | public.archivepermission = SELECT, INSERT, UPDATE, DELETE |
22 | 131 | public.authtoken = SELECT, INSERT, UPDATE, DELETE | 131 | public.authtoken = SELECT, INSERT, UPDATE, DELETE |
23 | @@ -916,7 +916,7 @@ | |||
24 | 916 | # certain processes, such as the librarian tables. This group is deprecated - | 916 | # certain processes, such as the librarian tables. This group is deprecated - |
25 | 917 | # access should be explicitly granted to users. | 917 | # access should be explicitly granted to users. |
26 | 918 | public.archive = SELECT, INSERT, UPDATE | 918 | public.archive = SELECT, INSERT, UPDATE |
28 | 919 | public.archivearch = SELECT, INSERT, UPDATE | 919 | public.archivearch = SELECT, INSERT, UPDATE, DELETE |
29 | 920 | public.binarypackagerelease = SELECT, INSERT, UPDATE | 920 | public.binarypackagerelease = SELECT, INSERT, UPDATE |
30 | 921 | public.binarypackagefile = SELECT, INSERT, UPDATE | 921 | public.binarypackagefile = SELECT, INSERT, UPDATE |
31 | 922 | public.binarypackagefilepublishing = SELECT, INSERT, UPDATE | 922 | public.binarypackagefilepublishing = SELECT, INSERT, UPDATE |
32 | 923 | 923 | ||
33 | === modified file 'lib/lp/soyuz/browser/archive.py' | |||
34 | --- lib/lp/soyuz/browser/archive.py 2010-02-25 16:49:16 +0000 | |||
35 | +++ lib/lp/soyuz/browser/archive.py 2010-02-26 15:19:22 +0000 | |||
36 | @@ -46,6 +46,7 @@ | |||
37 | 46 | from canonical.launchpad import _ | 46 | from canonical.launchpad import _ |
38 | 47 | from canonical.launchpad.helpers import english_list | 47 | from canonical.launchpad.helpers import english_list |
39 | 48 | from canonical.lazr.utils import smartquote | 48 | from canonical.lazr.utils import smartquote |
40 | 49 | from canonical.widgets import CheckBoxMatrixWidget | ||
41 | 49 | from lp.services.browser_helpers import get_user_agent_distroseries | 50 | from lp.services.browser_helpers import get_user_agent_distroseries |
42 | 50 | from lp.soyuz.browser.build import BuildRecordsView | 51 | from lp.soyuz.browser.build import BuildRecordsView |
43 | 51 | from lp.soyuz.browser.sourceslist import ( | 52 | from lp.soyuz.browser.sourceslist import ( |
44 | @@ -1790,7 +1791,7 @@ | |||
45 | 1790 | 1791 | ||
46 | 1791 | field_names = ['enabled', 'private', 'require_virtualized', | 1792 | field_names = ['enabled', 'private', 'require_virtualized', |
47 | 1792 | 'buildd_secret', 'authorized_size', 'relative_build_score', | 1793 | 'buildd_secret', 'authorized_size', 'relative_build_score', |
49 | 1793 | 'external_dependencies'] | 1794 | 'external_dependencies', 'arm_builds_allowed'] |
50 | 1794 | 1795 | ||
51 | 1795 | custom_widget('external_dependencies', TextAreaWidget, height=3) | 1796 | custom_widget('external_dependencies', TextAreaWidget, height=3) |
52 | 1796 | 1797 | ||
53 | @@ -1817,7 +1818,7 @@ | |||
54 | 1817 | 'Do not specify for non-private archives') | 1818 | 'Do not specify for non-private archives') |
55 | 1818 | 1819 | ||
56 | 1819 | # Check the external_dependencies field. | 1820 | # Check the external_dependencies field. |
58 | 1820 | ext_deps = data.get('external_dependencies') | 1821 | ext_deps = data.get('external_dependencies') |
59 | 1821 | if ext_deps is not None: | 1822 | if ext_deps is not None: |
60 | 1822 | errors = self.validate_external_dependencies(ext_deps) | 1823 | errors = self.validate_external_dependencies(ext_deps) |
61 | 1823 | if len(errors) != 0: | 1824 | if len(errors) != 0: |
62 | 1824 | 1825 | ||
63 | === modified file 'lib/lp/soyuz/configure.zcml' | |||
64 | --- lib/lp/soyuz/configure.zcml 2010-02-25 22:41:23 +0000 | |||
65 | +++ lib/lp/soyuz/configure.zcml 2010-02-26 15:19:22 +0000 | |||
66 | @@ -400,7 +400,11 @@ | |||
67 | 400 | <require | 400 | <require |
68 | 401 | permission="launchpad.Edit" | 401 | permission="launchpad.Edit" |
69 | 402 | interface="lp.soyuz.interfaces.archive.IArchiveEdit" | 402 | interface="lp.soyuz.interfaces.archive.IArchiveEdit" |
70 | 403 | <<<<<<< TREE | ||
71 | 403 | set_attributes="description displayname publish"/> | 404 | set_attributes="description displayname publish"/> |
72 | 405 | ======= | ||
73 | 406 | set_attributes="description displayname arm_builds_allowed"/> | ||
74 | 407 | >>>>>>> MERGE-SOURCE | ||
75 | 404 | <require | 408 | <require |
76 | 405 | permission="launchpad.Commercial" | 409 | permission="launchpad.Commercial" |
77 | 406 | set_attributes="authorized_size buildd_secret | 410 | set_attributes="authorized_size buildd_secret |
78 | 407 | 411 | ||
79 | === modified file 'lib/lp/soyuz/interfaces/archive.py' | |||
80 | --- lib/lp/soyuz/interfaces/archive.py 2010-02-25 16:49:16 +0000 | |||
81 | +++ lib/lp/soyuz/interfaces/archive.py 2010-02-26 15:19:22 +0000 | |||
82 | @@ -1090,6 +1090,9 @@ | |||
83 | 1090 | def disable(): | 1090 | def disable(): |
84 | 1091 | """Disable the archive.""" | 1091 | """Disable the archive.""" |
85 | 1092 | 1092 | ||
86 | 1093 | arm_builds_allowed = Bool( | ||
87 | 1094 | title=_("Builds on ARM are allowed for this archive.")) | ||
88 | 1095 | |||
89 | 1093 | 1096 | ||
90 | 1094 | class IArchive(IArchivePublic, IArchiveAppend, IArchiveEdit, IArchiveView): | 1097 | class IArchive(IArchivePublic, IArchiveAppend, IArchiveEdit, IArchiveView): |
91 | 1095 | """Main Archive interface.""" | 1098 | """Main Archive interface.""" |
92 | 1096 | 1099 | ||
93 | === modified file 'lib/lp/soyuz/model/archive.py' | |||
94 | --- lib/lp/soyuz/model/archive.py 2010-02-18 17:05:50 +0000 | |||
95 | +++ lib/lp/soyuz/model/archive.py 2010-02-26 15:19:22 +0000 | |||
96 | @@ -59,6 +59,7 @@ | |||
97 | 59 | IDistributionArchive, InvalidComponent, IPPA, MAIN_ARCHIVE_PURPOSES, | 59 | IDistributionArchive, InvalidComponent, IPPA, MAIN_ARCHIVE_PURPOSES, |
98 | 60 | NoSuchPPA, PocketNotFound, VersionRequiresName, default_name_by_purpose) | 60 | NoSuchPPA, PocketNotFound, VersionRequiresName, default_name_by_purpose) |
99 | 61 | from lp.soyuz.interfaces.archiveauthtoken import IArchiveAuthTokenSet | 61 | from lp.soyuz.interfaces.archiveauthtoken import IArchiveAuthTokenSet |
100 | 62 | from lp.soyuz.interfaces.archivearch import IArchiveArchSet | ||
101 | 62 | from lp.soyuz.interfaces.archivepermission import ( | 63 | from lp.soyuz.interfaces.archivepermission import ( |
102 | 63 | ArchivePermissionType, IArchivePermissionSet) | 64 | ArchivePermissionType, IArchivePermissionSet) |
103 | 64 | from lp.soyuz.interfaces.archivesubscriber import ( | 65 | from lp.soyuz.interfaces.archivesubscriber import ( |
104 | @@ -75,6 +76,7 @@ | |||
105 | 75 | from lp.registry.interfaces.role import IHasOwner | 76 | from lp.registry.interfaces.role import IHasOwner |
106 | 76 | from lp.soyuz.interfaces.queue import PackageUploadStatus | 77 | from lp.soyuz.interfaces.queue import PackageUploadStatus |
107 | 77 | from lp.soyuz.interfaces.packagecopyrequest import IPackageCopyRequestSet | 78 | from lp.soyuz.interfaces.packagecopyrequest import IPackageCopyRequestSet |
108 | 79 | from lp.soyuz.interfaces.processor import IProcessorFamilySet | ||
109 | 78 | from lp.soyuz.interfaces.publishing import ( | 80 | from lp.soyuz.interfaces.publishing import ( |
110 | 79 | active_publishing_status, PackagePublishingStatus, IPublishingSet) | 81 | active_publishing_status, PackagePublishingStatus, IPublishingSet) |
111 | 80 | from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet | 82 | from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet |
112 | @@ -182,6 +184,39 @@ | |||
113 | 182 | external_dependencies = StringCol( | 184 | external_dependencies = StringCol( |
114 | 183 | dbName='external_dependencies', notNull=False, default=None) | 185 | dbName='external_dependencies', notNull=False, default=None) |
115 | 184 | 186 | ||
116 | 187 | def _get_arm_builds_enabled(self): | ||
117 | 188 | """Check whether ARM builds are allowed for this archive.""" | ||
118 | 189 | archive_arch_set = getUtility(IArchiveArchSet) | ||
119 | 190 | restricted_families = archive_arch_set.getRestrictedfamilies(self) | ||
120 | 191 | arm = getUtility(IProcessorFamilySet).getByName('arm') | ||
121 | 192 | for (family, archive_arch) in restricted_families: | ||
122 | 193 | if family == arm: | ||
123 | 194 | return (archive_arch is not None) | ||
124 | 195 | # ARM doesn't exist or isn't restricted. Either way, there is no | ||
125 | 196 | # need for an explicit association. | ||
126 | 197 | return False | ||
127 | 198 | |||
128 | 199 | def _set_arm_builds_enabled(self, value): | ||
129 | 200 | """Set whether ARM builds are enabled for this archive.""" | ||
130 | 201 | archive_arch_set = getUtility(IArchiveArchSet) | ||
131 | 202 | restricted_families = archive_arch_set.getRestrictedfamilies(self) | ||
132 | 203 | arm = getUtility(IProcessorFamilySet).getByName('arm') | ||
133 | 204 | for (family, archive_arch) in restricted_families: | ||
134 | 205 | if family == arm: | ||
135 | 206 | if value: | ||
136 | 207 | if archive_arch is not None: | ||
137 | 208 | # ARM builds are already enabled | ||
138 | 209 | return | ||
139 | 210 | else: | ||
140 | 211 | archive_arch_set.new(self, family) | ||
141 | 212 | else: | ||
142 | 213 | if archive_arch is not None: | ||
143 | 214 | Store.of(self).remove(archive_arch) | ||
144 | 215 | else: | ||
145 | 216 | pass # ARM builds are already disabled | ||
146 | 217 | arm_builds_allowed = property(_get_arm_builds_enabled, | ||
147 | 218 | _set_arm_builds_enabled) | ||
148 | 219 | |||
149 | 185 | def _init(self, *args, **kw): | 220 | def _init(self, *args, **kw): |
150 | 186 | """Provide the right interface for URL traversal.""" | 221 | """Provide the right interface for URL traversal.""" |
151 | 187 | SQLBase._init(self, *args, **kw) | 222 | SQLBase._init(self, *args, **kw) |
152 | 188 | 223 | ||
153 | === modified file 'lib/lp/soyuz/tests/test_archive.py' | |||
154 | --- lib/lp/soyuz/tests/test_archive.py 2010-02-08 16:33:12 +0000 | |||
155 | +++ lib/lp/soyuz/tests/test_archive.py 2010-02-26 15:19:22 +0000 | |||
156 | @@ -19,8 +19,10 @@ | |||
157 | 19 | from lp.registry.interfaces.person import IPersonSet | 19 | from lp.registry.interfaces.person import IPersonSet |
158 | 20 | from lp.services.job.interfaces.job import JobStatus | 20 | from lp.services.job.interfaces.job import JobStatus |
159 | 21 | from lp.soyuz.interfaces.archive import IArchiveSet, ArchivePurpose | 21 | from lp.soyuz.interfaces.archive import IArchiveSet, ArchivePurpose |
160 | 22 | from lp.soyuz.interfaces.archivearch import IArchiveArchSet | ||
161 | 22 | from lp.soyuz.interfaces.binarypackagerelease import BinaryPackageFormat | 23 | from lp.soyuz.interfaces.binarypackagerelease import BinaryPackageFormat |
162 | 23 | from lp.soyuz.interfaces.build import BuildStatus | 24 | from lp.soyuz.interfaces.build import BuildStatus |
163 | 25 | from lp.soyuz.interfaces.processor import IProcessorFamilySet | ||
164 | 24 | from lp.soyuz.interfaces.publishing import PackagePublishingStatus | 26 | from lp.soyuz.interfaces.publishing import PackagePublishingStatus |
165 | 25 | from lp.soyuz.model.build import Build | 27 | from lp.soyuz.model.build import Build |
166 | 26 | from lp.soyuz.tests.test_publishing import SoyuzTestPublisher | 28 | from lp.soyuz.tests.test_publishing import SoyuzTestPublisher |
167 | @@ -558,5 +560,56 @@ | |||
168 | 558 | self.assertEqual(1, len(pubs)) | 560 | self.assertEqual(1, len(pubs)) |
169 | 559 | self.assertEqual('0.5.11~ppa1', pubs[0].source_package_version) | 561 | self.assertEqual('0.5.11~ppa1', pubs[0].source_package_version) |
170 | 560 | 562 | ||
171 | 563 | |||
172 | 564 | class TestARMBuildsAllowed(TestCaseWithFactory): | ||
173 | 565 | """Ensure that ARM builds can be allowed and disallowed correctly.""" | ||
174 | 566 | |||
175 | 567 | layer = LaunchpadZopelessLayer | ||
176 | 568 | |||
177 | 569 | def setUp(self): | ||
178 | 570 | """Setup an archive with relevant publications.""" | ||
179 | 571 | super(TestARMBuildsAllowed, self).setUp() | ||
180 | 572 | self.publisher = SoyuzTestPublisher() | ||
181 | 573 | self.publisher.prepareBreezyAutotest() | ||
182 | 574 | self.archive = self.factory.makeArchive() | ||
183 | 575 | self.archive_arch_set = getUtility(IArchiveArchSet) | ||
184 | 576 | self.arm = getUtility(IProcessorFamilySet).getByName('arm') | ||
185 | 577 | |||
186 | 578 | def test_default(self): | ||
187 | 579 | """By default, ARM builds are not allowed.""" | ||
188 | 580 | self.assertEquals(0, | ||
189 | 581 | self.archive_arch_set.getByArchive(self.archive, self.arm).count()) | ||
190 | 582 | self.assertFalse(self.archive.arm_builds_allowed) | ||
191 | 583 | |||
192 | 584 | def test_get_uses_archivearch(self): | ||
193 | 585 | """Adding an entry to ArchiveArch for ARM and an archive will | ||
194 | 586 | enable arm_builds_allowed for that archive.""" | ||
195 | 587 | self.assertFalse(self.archive.arm_builds_allowed) | ||
196 | 588 | self.archive_arch_set.new(self.archive, self.arm) | ||
197 | 589 | self.assertTrue(self.archive.arm_builds_allowed) | ||
198 | 590 | |||
199 | 591 | def test_get_uses_arm_only(self): | ||
200 | 592 | """Adding an entry to ArchiveArch for something other than ARM | ||
201 | 593 | does not enable arm_builds_allowed for that archive.""" | ||
202 | 594 | self.assertFalse(self.archive.arm_builds_allowed) | ||
203 | 595 | self.archive_arch_set.new(self.archive, | ||
204 | 596 | getUtility(IProcessorFamilySet).getByName('amd64')) | ||
205 | 597 | self.assertFalse(self.archive.arm_builds_allowed) | ||
206 | 598 | |||
207 | 599 | def test_set(self): | ||
208 | 600 | """The property remembers its value correctly and sets ArchiveArch.""" | ||
209 | 601 | self.archive.arm_builds_allowed = True | ||
210 | 602 | allowed_restricted_families = self.archive_arch_set.getByArchive( | ||
211 | 603 | self.archive, self.arm) | ||
212 | 604 | self.assertEquals(1, allowed_restricted_families.count()) | ||
213 | 605 | self.assertEquals(self.arm, | ||
214 | 606 | allowed_restricted_families[0].processorfamily) | ||
215 | 607 | self.assertTrue(self.archive.arm_builds_allowed) | ||
216 | 608 | self.archive.arm_builds_allowed = False | ||
217 | 609 | self.assertEquals(0, | ||
218 | 610 | self.archive_arch_set.getByArchive(self.archive, self.arm).count()) | ||
219 | 611 | self.assertFalse(self.archive.arm_builds_allowed) | ||
220 | 612 | |||
221 | 613 | |||
222 | 561 | def test_suite(): | 614 | def test_suite(): |
223 | 562 | return unittest.TestLoader().loadTestsFromName(__name__) | 615 | return unittest.TestLoader().loadTestsFromName(__name__) |
224 | 563 | 616 | ||
225 | === modified file 'lib/lp/soyuz/tests/test_processor.py' | |||
226 | --- lib/lp/soyuz/tests/test_processor.py 2010-02-26 15:19:18 +0000 | |||
227 | +++ lib/lp/soyuz/tests/test_processor.py 2010-02-26 15:19:22 +0000 | |||
228 | @@ -18,11 +18,13 @@ | |||
229 | 18 | layer = LaunchpadZopelessLayer | 18 | layer = LaunchpadZopelessLayer |
230 | 19 | 19 | ||
231 | 20 | def test_create(self): | 20 | def test_create(self): |
232 | 21 | """Test adding a new ProcessorFamily.""" | ||
233 | 21 | family = getUtility(IProcessorFamilySet).new("avr", "Atmel AVR", | 22 | family = getUtility(IProcessorFamilySet).new("avr", "Atmel AVR", |
234 | 22 | "The Modified Harvard architecture 8-bit RISC processors.") | 23 | "The Modified Harvard architecture 8-bit RISC processors.") |
235 | 23 | self.assertProvides(family, IProcessorFamily) | 24 | self.assertProvides(family, IProcessorFamily) |
236 | 24 | 25 | ||
237 | 25 | def test_add_processor(self): | 26 | def test_add_processor(self): |
238 | 27 | """Test adding a new Processor to a ProcessorFamily.""" | ||
239 | 26 | family = getUtility(IProcessorFamilySet).new("avr", "Atmel AVR", | 28 | family = getUtility(IProcessorFamilySet).new("avr", "Atmel AVR", |
240 | 27 | "The Modified Harvard architecture 8-bit RISC processors.") | 29 | "The Modified Harvard architecture 8-bit RISC processors.") |
241 | 28 | proc = family.addProcessor("avr2001", "The 2001 AVR", "Fast as light.") | 30 | proc = family.addProcessor("avr2001", "The 2001 AVR", "Fast as light.") |
242 | 29 | 31 | ||
243 | === modified file 'lib/lp/soyuz/tests/test_publishing.py' | |||
244 | --- lib/lp/soyuz/tests/test_publishing.py 2010-02-26 15:19:18 +0000 | |||
245 | +++ lib/lp/soyuz/tests/test_publishing.py 2010-02-26 15:19:22 +0000 | |||
246 | @@ -883,8 +883,19 @@ | |||
247 | 883 | self.sparc_distroarch = self.factory.makeDistroArchSeries( | 883 | self.sparc_distroarch = self.factory.makeDistroArchSeries( |
248 | 884 | architecturetag='sparc', processorfamily=self.sparc_family, | 884 | architecturetag='sparc', processorfamily=self.sparc_family, |
249 | 885 | distroseries=self.distroseries, supports_virtualized=True) | 885 | distroseries=self.distroseries, supports_virtualized=True) |
250 | 886 | self.distroseries.nominatedarchindep = self.sparc_distroarch | ||
251 | 886 | self.addFakeChroots(self.distroseries) | 887 | self.addFakeChroots(self.distroseries) |
252 | 887 | 888 | ||
253 | 889 | def getPubSource(self, architecturehintlist): | ||
254 | 890 | """Return a mock source package publishing record for the archive | ||
255 | 891 | and architecture used in this testcase. | ||
256 | 892 | |||
257 | 893 | :param architecturehintlist: Architecture hint list (e.g. "i386 amd64") | ||
258 | 894 | """ | ||
259 | 895 | return super(BuildRecordCreationTests, self).getPubSource( | ||
260 | 896 | archive=self.archive, distroseries=self.distroseries, | ||
261 | 897 | architecturehintlist=architecturehintlist) | ||
262 | 898 | |||
263 | 888 | def test__getAllowedArchitectures_restricted(self): | 899 | def test__getAllowedArchitectures_restricted(self): |
264 | 889 | """Test _getAllowedArchitectures doesn't return unrestricted | 900 | """Test _getAllowedArchitectures doesn't return unrestricted |
265 | 890 | archs. | 901 | archs. |
266 | @@ -893,8 +904,7 @@ | |||
267 | 893 | be used. | 904 | be used. |
268 | 894 | """ | 905 | """ |
269 | 895 | available_archs = [self.sparc_distroarch, self.avr_distroarch] | 906 | available_archs = [self.sparc_distroarch, self.avr_distroarch] |
272 | 896 | pubrec = self.getPubSource(distroseries=self.distroseries, | 907 | pubrec = self.getPubSource(architecturehintlist='any') |
271 | 897 | archive=self.archive, architecturehintlist='any') | ||
273 | 898 | self.assertEquals([self.sparc_distroarch], | 908 | self.assertEquals([self.sparc_distroarch], |
274 | 899 | pubrec._getAllowedArchitectures(available_archs)) | 909 | pubrec._getAllowedArchitectures(available_archs)) |
275 | 900 | 910 | ||
276 | @@ -906,22 +916,45 @@ | |||
277 | 906 | """ | 916 | """ |
278 | 907 | available_archs = [self.sparc_distroarch, self.avr_distroarch] | 917 | available_archs = [self.sparc_distroarch, self.avr_distroarch] |
279 | 908 | getUtility(IArchiveArchSet).new(self.archive, self.avr_family) | 918 | getUtility(IArchiveArchSet).new(self.archive, self.avr_family) |
282 | 909 | pubrec = self.getPubSource(distroseries=self.distroseries, | 919 | pubrec = self.getPubSource(architecturehintlist='any') |
281 | 910 | archive=self.archive, architecturehintlist='any') | ||
283 | 911 | self.assertEquals([self.sparc_distroarch, self.avr_distroarch], | 920 | self.assertEquals([self.sparc_distroarch, self.avr_distroarch], |
284 | 912 | pubrec._getAllowedArchitectures(available_archs)) | 921 | pubrec._getAllowedArchitectures(available_archs)) |
285 | 913 | 922 | ||
289 | 914 | def test_createMissingBuilds_restricts(self): | 923 | def test_createMissingBuilds_restricts_any(self): |
290 | 915 | pubrec = self.getPubSource(distroseries=self.distroseries, | 924 | """createMissingBuilds() should limit builds targeted at 'any' |
291 | 916 | archive=self.archive, architecturehintlist='any') | 925 | architecture to those allowed for the archive. |
292 | 926 | """ | ||
293 | 927 | pubrec = self.getPubSource(architecturehintlist='any') | ||
294 | 928 | builds = pubrec.createMissingBuilds() | ||
295 | 929 | self.assertEquals(1, len(builds)) | ||
296 | 930 | self.assertEquals(self.sparc_distroarch, builds[0].distroarchseries) | ||
297 | 931 | |||
298 | 932 | def test_createMissingBuilds_restricts_explicitlist(self): | ||
299 | 933 | """createMissingBuilds() should limit builds targeted at a | ||
300 | 934 | variety of architectures architecture to those allowed for the archive. | ||
301 | 935 | """ | ||
302 | 936 | pubrec = self.getPubSource(architecturehintlist='sparc i386 avr') | ||
303 | 937 | builds = pubrec.createMissingBuilds() | ||
304 | 938 | self.assertEquals(1, len(builds)) | ||
305 | 939 | self.assertEquals(self.sparc_distroarch, builds[0].distroarchseries) | ||
306 | 940 | |||
307 | 941 | def test_createMissingBuilds_restricts_all(self): | ||
308 | 942 | """createMissingBuilds() should limit builds targeted at 'all' | ||
309 | 943 | architectures to the nominated independent architecture, | ||
310 | 944 | if that is allowed for the archive. | ||
311 | 945 | """ | ||
312 | 946 | pubrec = self.getPubSource(architecturehintlist='all') | ||
313 | 917 | builds = pubrec.createMissingBuilds() | 947 | builds = pubrec.createMissingBuilds() |
314 | 918 | self.assertEquals(1, len(builds)) | 948 | self.assertEquals(1, len(builds)) |
315 | 919 | self.assertEquals(self.sparc_distroarch, builds[0].distroarchseries) | 949 | self.assertEquals(self.sparc_distroarch, builds[0].distroarchseries) |
316 | 920 | 950 | ||
317 | 921 | def test_createMissingBuilds_restrict_override(self): | 951 | def test_createMissingBuilds_restrict_override(self): |
318 | 952 | """createMissingBuilds() should limit builds targeted at 'any' | ||
319 | 953 | architecture to architectures that are unrestricted or | ||
320 | 954 | explicitly associated with the archive. | ||
321 | 955 | """ | ||
322 | 922 | getUtility(IArchiveArchSet).new(self.archive, self.avr_family) | 956 | getUtility(IArchiveArchSet).new(self.archive, self.avr_family) |
325 | 923 | pubrec = self.getPubSource(distroseries=self.distroseries, | 957 | pubrec = self.getPubSource(architecturehintlist='any') |
324 | 924 | archive=self.archive, architecturehintlist='any') | ||
326 | 925 | builds = pubrec.createMissingBuilds() | 958 | builds = pubrec.createMissingBuilds() |
327 | 926 | self.assertEquals(2, len(builds)) | 959 | self.assertEquals(2, len(builds)) |
328 | 927 | self.assertEquals(self.avr_distroarch, builds[0].distroarchseries) | 960 | self.assertEquals(self.avr_distroarch, builds[0].distroarchseries) |
Add a button in the archive admin form to allow or disallow builds on ARM. This uses the previously added infrastructure (lp:~jelmer/launchpad/bug471148, lp:~al-maisan/launchpad/restricted-ui) that provide generic support for restricting architectures to certain PPA's.
Because of time constraints we have only added a checkbox for ARM in the UI for now, since there is an immediate need for that.