Merge lp:~jelmer/launchpad/stable-fix into lp:launchpad/db-devel
- stable-fix
- Merge into db-devel
Proposed by
Jelmer Vernooij
Status: | Merged |
---|---|
Approved by: | Edwin Grubbs |
Approved revision: | no longer in the source branch. |
Merged at revision: | 9513 |
Proposed branch: | lp:~jelmer/launchpad/stable-fix |
Merge into: | lp:launchpad/db-devel |
Diff against target: |
259 lines (+97/-21) 8 files modified
lib/lp/soyuz/browser/archive.py (+29/-1) lib/lp/soyuz/configure.zcml (+2/-1) lib/lp/soyuz/interfaces/archive.py (+6/-2) lib/lp/soyuz/interfaces/processor.py (+6/-0) lib/lp/soyuz/model/archive.py (+18/-0) lib/lp/soyuz/model/processor.py (+5/-0) lib/lp/soyuz/tests/test_archive.py (+21/-17) lib/lp/soyuz/tests/test_processor.py (+10/-0) |
To merge this branch: | bzr merge lp:~jelmer/launchpad/stable-fix |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Edwin Grubbs (community) | Approve | ||
Review via email: mp+28912@code.launchpad.net |
Commit message
Manual merge of stable.
Description of the change
Merge of the stable branch, with conflicts resolved.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/lp/soyuz/browser/archive.py' | |||
2 | --- lib/lp/soyuz/browser/archive.py 2010-06-25 15:03:10 +0000 | |||
3 | +++ lib/lp/soyuz/browser/archive.py 2010-06-30 17:52:31 +0000 | |||
4 | @@ -78,6 +78,7 @@ | |||
5 | 78 | from lp.soyuz.interfaces.packageset import IPackagesetSet | 78 | from lp.soyuz.interfaces.packageset import IPackagesetSet |
6 | 79 | from lp.registry.interfaces.person import IPersonSet, PersonVisibility | 79 | from lp.registry.interfaces.person import IPersonSet, PersonVisibility |
7 | 80 | from lp.registry.interfaces.pocket import PackagePublishingPocket | 80 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
8 | 81 | from lp.soyuz.interfaces.processor import IProcessorFamilySet | ||
9 | 81 | from lp.soyuz.interfaces.publishing import ( | 82 | from lp.soyuz.interfaces.publishing import ( |
10 | 82 | active_publishing_status, inactive_publishing_status, IPublishingSet, | 83 | active_publishing_status, inactive_publishing_status, IPublishingSet, |
11 | 83 | PackagePublishingStatus) | 84 | PackagePublishingStatus) |
12 | @@ -1874,10 +1875,12 @@ | |||
13 | 1874 | 1875 | ||
14 | 1875 | field_names = ['enabled', 'private', 'commercial', 'require_virtualized', | 1876 | field_names = ['enabled', 'private', 'commercial', 'require_virtualized', |
15 | 1876 | 'buildd_secret', 'authorized_size', 'relative_build_score', | 1877 | 'buildd_secret', 'authorized_size', 'relative_build_score', |
17 | 1877 | 'external_dependencies', 'arm_builds_allowed'] | 1878 | 'external_dependencies'] |
18 | 1878 | 1879 | ||
19 | 1879 | custom_widget('external_dependencies', TextAreaWidget, height=3) | 1880 | custom_widget('external_dependencies', TextAreaWidget, height=3) |
20 | 1880 | 1881 | ||
21 | 1882 | custom_widget('enabled_restricted_families', LabeledMultiCheckBoxWidget) | ||
22 | 1883 | |||
23 | 1881 | def validate_save(self, action, data): | 1884 | def validate_save(self, action, data): |
24 | 1882 | """Validate the save action on ArchiveAdminView. | 1885 | """Validate the save action on ArchiveAdminView. |
25 | 1883 | 1886 | ||
26 | @@ -1956,6 +1959,31 @@ | |||
27 | 1956 | """ | 1959 | """ |
28 | 1957 | return self.context.owner.visibility == PersonVisibility.PRIVATE | 1960 | return self.context.owner.visibility == PersonVisibility.PRIVATE |
29 | 1958 | 1961 | ||
30 | 1962 | def setUpFields(self): | ||
31 | 1963 | """Override `LaunchpadEditFormView`. | ||
32 | 1964 | |||
33 | 1965 | See `createEnabledRestrictedFamilies` method. | ||
34 | 1966 | """ | ||
35 | 1967 | super(ArchiveAdminView, self).setUpFields() | ||
36 | 1968 | self.form_fields += self.createEnabledRestrictedFamilies() | ||
37 | 1969 | |||
38 | 1970 | def createEnabledRestrictedFamilies(self): | ||
39 | 1971 | """Creates the 'enabled_restricted_families' field. | ||
40 | 1972 | |||
41 | 1973 | """ | ||
42 | 1974 | terms = [] | ||
43 | 1975 | for family in getUtility(IProcessorFamilySet).getRestricted(): | ||
44 | 1976 | terms.append(SimpleTerm( | ||
45 | 1977 | family, token=family.name, title=family.title)) | ||
46 | 1978 | return form.Fields( | ||
47 | 1979 | List(__name__='enabled_restricted_families', | ||
48 | 1980 | title=_('Enabled restricted families'), | ||
49 | 1981 | value_type=Choice(vocabulary=SimpleVocabulary(terms)), | ||
50 | 1982 | required=False, | ||
51 | 1983 | description=_('Select the restricted architecture families ' | ||
52 | 1984 | 'on which this archive is allowed to build.')), | ||
53 | 1985 | render_context=self.render_context) | ||
54 | 1986 | |||
55 | 1959 | 1987 | ||
56 | 1960 | class ArchiveDeleteView(LaunchpadFormView): | 1988 | class ArchiveDeleteView(LaunchpadFormView): |
57 | 1961 | """View class for deleting `IArchive`s""" | 1989 | """View class for deleting `IArchive`s""" |
58 | 1962 | 1990 | ||
59 | === modified file 'lib/lp/soyuz/configure.zcml' | |||
60 | --- lib/lp/soyuz/configure.zcml 2010-06-21 19:29:34 +0000 | |||
61 | +++ lib/lp/soyuz/configure.zcml 2010-06-30 17:52:31 +0000 | |||
62 | @@ -405,7 +405,8 @@ | |||
63 | 405 | set_attributes="description displayname publish status"/> | 405 | set_attributes="description displayname publish status"/> |
64 | 406 | <require | 406 | <require |
65 | 407 | permission="launchpad.Commercial" | 407 | permission="launchpad.Commercial" |
67 | 408 | set_attributes="authorized_size buildd_secret arm_builds_allowed | 408 | set_attributes="authorized_size buildd_secret |
68 | 409 | enabled_restricted_families | ||
69 | 409 | commercial external_dependencies private | 410 | commercial external_dependencies private |
70 | 410 | require_virtualized relative_build_score "/> | 411 | require_virtualized relative_build_score "/> |
71 | 411 | <require | 412 | <require |
72 | 412 | 413 | ||
73 | === modified file 'lib/lp/soyuz/interfaces/archive.py' | |||
74 | --- lib/lp/soyuz/interfaces/archive.py 2010-06-25 15:03:10 +0000 | |||
75 | +++ lib/lp/soyuz/interfaces/archive.py 2010-06-30 17:52:31 +0000 | |||
76 | @@ -56,6 +56,7 @@ | |||
77 | 56 | from canonical.launchpad.interfaces.launchpad import IPrivacy | 56 | from canonical.launchpad.interfaces.launchpad import IPrivacy |
78 | 57 | from lp.registry.interfaces.role import IHasOwner | 57 | from lp.registry.interfaces.role import IHasOwner |
79 | 58 | from lp.soyuz.interfaces.buildrecords import IHasBuildRecords | 58 | from lp.soyuz.interfaces.buildrecords import IHasBuildRecords |
80 | 59 | from lp.soyuz.interfaces.processor import IProcessorFamily | ||
81 | 59 | from lp.registry.interfaces.gpg import IGPGKey | 60 | from lp.registry.interfaces.gpg import IGPGKey |
82 | 60 | from lp.registry.interfaces.person import IPerson | 61 | from lp.registry.interfaces.person import IPerson |
83 | 61 | from canonical.launchpad.validators.name import name_validator | 62 | from canonical.launchpad.validators.name import name_validator |
84 | @@ -368,8 +369,11 @@ | |||
85 | 368 | "context build.\n" | 369 | "context build.\n" |
86 | 369 | "NOTE: This is for migration of OEM PPAs only!")) | 370 | "NOTE: This is for migration of OEM PPAs only!")) |
87 | 370 | 371 | ||
90 | 371 | arm_builds_allowed = Bool( | 372 | enabled_restricted_families = CollectionField( |
91 | 372 | title=_("Allow ARM builds for this archive")) | 373 | title=_("Restricted architecture families this archive can build " |
92 | 374 | "on"), | ||
93 | 375 | value_type=Reference(schema=IProcessorFamily), | ||
94 | 376 | readonly=False) | ||
95 | 373 | 377 | ||
96 | 374 | commercial = exported( | 378 | commercial = exported( |
97 | 375 | Bool( | 379 | Bool( |
98 | 376 | 380 | ||
99 | === modified file 'lib/lp/soyuz/interfaces/processor.py' | |||
100 | --- lib/lp/soyuz/interfaces/processor.py 2010-02-24 15:13:10 +0000 | |||
101 | +++ lib/lp/soyuz/interfaces/processor.py 2010-06-30 17:52:31 +0000 | |||
102 | @@ -55,6 +55,12 @@ | |||
103 | 55 | :return: A `IProcessorFamily` instance if found, None otherwise. | 55 | :return: A `IProcessorFamily` instance if found, None otherwise. |
104 | 56 | """ | 56 | """ |
105 | 57 | 57 | ||
106 | 58 | def getRestricted(): | ||
107 | 59 | """Return a sequence of all restricted architectures. | ||
108 | 60 | |||
109 | 61 | :return: A sequence of `IProcessorFamily` instances. | ||
110 | 62 | """ | ||
111 | 63 | |||
112 | 58 | def getByProcessorName(name): | 64 | def getByProcessorName(name): |
113 | 59 | """Given a processor name return the ProcessorFamily it belongs to. | 65 | """Given a processor name return the ProcessorFamily it belongs to. |
114 | 60 | 66 | ||
115 | 61 | 67 | ||
116 | === modified file 'lib/lp/soyuz/model/archive.py' | |||
117 | --- lib/lp/soyuz/model/archive.py 2010-06-29 09:37:26 +0000 | |||
118 | +++ lib/lp/soyuz/model/archive.py 2010-06-30 17:52:31 +0000 | |||
119 | @@ -1590,6 +1590,24 @@ | |||
120 | 1590 | LibraryFileContent.id == LibraryFileAlias.contentID).config( | 1590 | LibraryFileContent.id == LibraryFileAlias.contentID).config( |
121 | 1591 | distinct=True)) | 1591 | distinct=True)) |
122 | 1592 | 1592 | ||
123 | 1593 | def _get_enabled_restricted_families(self): | ||
124 | 1594 | archive_arch_set = getUtility(IArchiveArchSet) | ||
125 | 1595 | restricted_families = archive_arch_set.getRestrictedfamilies(self) | ||
126 | 1596 | return [family for (family, archive_arch) in restricted_families | ||
127 | 1597 | if archive_arch is not None] | ||
128 | 1598 | |||
129 | 1599 | def _set_enabled_restricted_families(self, value): | ||
130 | 1600 | archive_arch_set = getUtility(IArchiveArchSet) | ||
131 | 1601 | restricted_families = archive_arch_set.getRestrictedfamilies(self) | ||
132 | 1602 | for (family, archive_arch) in restricted_families: | ||
133 | 1603 | if family in value and archive_arch is None: | ||
134 | 1604 | archive_arch_set.new(self, family) | ||
135 | 1605 | if family not in value and archive_arch is not None: | ||
136 | 1606 | Store.of(self).remove(archive_arch) | ||
137 | 1607 | |||
138 | 1608 | enabled_restricted_families = property(_get_enabled_restricted_families, | ||
139 | 1609 | _set_enabled_restricted_families) | ||
140 | 1610 | |||
141 | 1593 | 1611 | ||
142 | 1594 | class ArchiveSet: | 1612 | class ArchiveSet: |
143 | 1595 | implements(IArchiveSet) | 1613 | implements(IArchiveSet) |
144 | 1596 | 1614 | ||
145 | === modified file 'lib/lp/soyuz/model/processor.py' | |||
146 | --- lib/lp/soyuz/model/processor.py 2010-02-24 16:14:37 +0000 | |||
147 | +++ lib/lp/soyuz/model/processor.py 2010-06-30 17:52:31 +0000 | |||
148 | @@ -59,6 +59,11 @@ | |||
149 | 59 | rset = store.find(ProcessorFamily, ProcessorFamily.name == name) | 59 | rset = store.find(ProcessorFamily, ProcessorFamily.name == name) |
150 | 60 | return rset.one() | 60 | return rset.one() |
151 | 61 | 61 | ||
152 | 62 | def getRestricted(self): | ||
153 | 63 | """See `IProcessorFamilySet`.""" | ||
154 | 64 | store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR) | ||
155 | 65 | return store.find(ProcessorFamily, ProcessorFamily.restricted == True) | ||
156 | 66 | |||
157 | 62 | def getByProcessorName(self, name): | 67 | def getByProcessorName(self, name): |
158 | 63 | """Please see `IProcessorFamilySet`.""" | 68 | """Please see `IProcessorFamilySet`.""" |
159 | 64 | store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR) | 69 | store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR) |
160 | 65 | 70 | ||
161 | === modified file 'lib/lp/soyuz/tests/test_archive.py' | |||
162 | --- lib/lp/soyuz/tests/test_archive.py 2010-06-25 15:03:10 +0000 | |||
163 | +++ lib/lp/soyuz/tests/test_archive.py 2010-06-30 17:52:31 +0000 | |||
164 | @@ -739,14 +739,15 @@ | |||
165 | 739 | self.assertCount(3, self.archive, self.bpr_2, day, self.australia) | 739 | self.assertCount(3, self.archive, self.bpr_2, day, self.australia) |
166 | 740 | 740 | ||
167 | 741 | 741 | ||
170 | 742 | class TestARMBuildsAllowed(TestCaseWithFactory): | 742 | class TestEnabledRestrictedBuilds(TestCaseWithFactory): |
171 | 743 | """Ensure that ARM builds can be allowed and disallowed correctly.""" | 743 | """Ensure that restricted architecture family builds can be allowed and |
172 | 744 | disallowed correctly.""" | ||
173 | 744 | 745 | ||
174 | 745 | layer = LaunchpadZopelessLayer | 746 | layer = LaunchpadZopelessLayer |
175 | 746 | 747 | ||
176 | 747 | def setUp(self): | 748 | def setUp(self): |
177 | 748 | """Setup an archive with relevant publications.""" | 749 | """Setup an archive with relevant publications.""" |
179 | 749 | super(TestARMBuildsAllowed, self).setUp() | 750 | super(TestEnabledRestrictedBuilds, self).setUp() |
180 | 750 | self.publisher = SoyuzTestPublisher() | 751 | self.publisher = SoyuzTestPublisher() |
181 | 751 | self.publisher.prepareBreezyAutotest() | 752 | self.publisher.prepareBreezyAutotest() |
182 | 752 | self.archive = self.factory.makeArchive() | 753 | self.archive = self.factory.makeArchive() |
183 | @@ -754,41 +755,44 @@ | |||
184 | 754 | self.arm = getUtility(IProcessorFamilySet).getByName('arm') | 755 | self.arm = getUtility(IProcessorFamilySet).getByName('arm') |
185 | 755 | 756 | ||
186 | 756 | def test_default(self): | 757 | def test_default(self): |
188 | 757 | """By default, ARM builds are not allowed.""" | 758 | """By default, ARM builds are not allowed as ARM is restricted.""" |
189 | 758 | self.assertEquals(0, | 759 | self.assertEquals(0, |
190 | 759 | self.archive_arch_set.getByArchive( | 760 | self.archive_arch_set.getByArchive( |
191 | 760 | self.archive, self.arm).count()) | 761 | self.archive, self.arm).count()) |
193 | 761 | self.assertFalse(self.archive.arm_builds_allowed) | 762 | self.assertEquals([], list(self.archive.enabled_restricted_families)) |
194 | 762 | 763 | ||
195 | 763 | def test_get_uses_archivearch(self): | 764 | def test_get_uses_archivearch(self): |
196 | 764 | """Adding an entry to ArchiveArch for ARM and an archive will | 765 | """Adding an entry to ArchiveArch for ARM and an archive will |
199 | 765 | enable arm_builds_allowed for that archive.""" | 766 | enable enabled_restricted_families for arm for that archive.""" |
200 | 766 | self.assertFalse(self.archive.arm_builds_allowed) | 767 | self.assertEquals([], list(self.archive.enabled_restricted_families)) |
201 | 767 | self.archive_arch_set.new(self.archive, self.arm) | 768 | self.archive_arch_set.new(self.archive, self.arm) |
203 | 768 | self.assertTrue(self.archive.arm_builds_allowed) | 769 | self.assertEquals([self.arm], |
204 | 770 | list(self.archive.enabled_restricted_families)) | ||
205 | 769 | 771 | ||
210 | 770 | def test_get_uses_arm_only(self): | 772 | def test_get_returns_restricted_only(self): |
211 | 771 | """Adding an entry to ArchiveArch for something other than ARM | 773 | """Adding an entry to ArchiveArch for something that is not |
212 | 772 | does not enable arm_builds_allowed for that archive.""" | 774 | restricted does not make it show up in enabled_restricted_families. |
213 | 773 | self.assertFalse(self.archive.arm_builds_allowed) | 775 | """ |
214 | 776 | self.assertEquals([], list(self.archive.enabled_restricted_families)) | ||
215 | 774 | self.archive_arch_set.new(self.archive, | 777 | self.archive_arch_set.new(self.archive, |
216 | 775 | getUtility(IProcessorFamilySet).getByName('amd64')) | 778 | getUtility(IProcessorFamilySet).getByName('amd64')) |
218 | 776 | self.assertFalse(self.archive.arm_builds_allowed) | 779 | self.assertEquals([], list(self.archive.enabled_restricted_families)) |
219 | 777 | 780 | ||
220 | 778 | def test_set(self): | 781 | def test_set(self): |
221 | 779 | """The property remembers its value correctly and sets ArchiveArch.""" | 782 | """The property remembers its value correctly and sets ArchiveArch.""" |
223 | 780 | self.archive.arm_builds_allowed = True | 783 | self.archive.enabled_restricted_families = [self.arm] |
224 | 781 | allowed_restricted_families = self.archive_arch_set.getByArchive( | 784 | allowed_restricted_families = self.archive_arch_set.getByArchive( |
225 | 782 | self.archive, self.arm) | 785 | self.archive, self.arm) |
226 | 783 | self.assertEquals(1, allowed_restricted_families.count()) | 786 | self.assertEquals(1, allowed_restricted_families.count()) |
227 | 784 | self.assertEquals(self.arm, | 787 | self.assertEquals(self.arm, |
228 | 785 | allowed_restricted_families[0].processorfamily) | 788 | allowed_restricted_families[0].processorfamily) |
231 | 786 | self.assertTrue(self.archive.arm_builds_allowed) | 789 | self.assertEquals([self.arm], self.archive.enabled_restricted_families) |
232 | 787 | self.archive.arm_builds_allowed = False | 790 | self.archive.enabled_restricted_families = [] |
233 | 788 | self.assertEquals(0, | 791 | self.assertEquals(0, |
234 | 789 | self.archive_arch_set.getByArchive( | 792 | self.archive_arch_set.getByArchive( |
235 | 790 | self.archive, self.arm).count()) | 793 | self.archive, self.arm).count()) |
237 | 791 | self.assertFalse(self.archive.arm_builds_allowed) | 794 | self.assertEquals([], list(self.archive.enabled_restricted_families)) |
238 | 795 | |||
239 | 792 | 796 | ||
240 | 793 | class TestArchiveTokens(TestCaseWithFactory): | 797 | class TestArchiveTokens(TestCaseWithFactory): |
241 | 794 | layer = LaunchpadZopelessLayer | 798 | layer = LaunchpadZopelessLayer |
242 | 795 | 799 | ||
243 | === modified file 'lib/lp/soyuz/tests/test_processor.py' | |||
244 | --- lib/lp/soyuz/tests/test_processor.py 2010-02-25 17:07:38 +0000 | |||
245 | +++ lib/lp/soyuz/tests/test_processor.py 2010-06-30 17:52:31 +0000 | |||
246 | @@ -30,3 +30,13 @@ | |||
247 | 30 | proc = family.addProcessor("avr2001", "The 2001 AVR", "Fast as light.") | 30 | proc = family.addProcessor("avr2001", "The 2001 AVR", "Fast as light.") |
248 | 31 | self.assertProvides(proc, IProcessor) | 31 | self.assertProvides(proc, IProcessor) |
249 | 32 | self.assertEquals(family, proc.family) | 32 | self.assertEquals(family, proc.family) |
250 | 33 | |||
251 | 34 | def test_get_restricted(self): | ||
252 | 35 | """Test retrieving all restricted processors.""" | ||
253 | 36 | family_set = getUtility(IProcessorFamilySet) | ||
254 | 37 | normal_family = getUtility(IProcessorFamilySet).new("avr", "Atmel AVR", | ||
255 | 38 | "The Modified Harvard architecture 8-bit RISC processors.") | ||
256 | 39 | restricted_family = getUtility(IProcessorFamilySet).new("5051", "5051", | ||
257 | 40 | "Another small processor family", restricted=True) | ||
258 | 41 | self.assertFalse(normal_family in family_set.getRestricted()) | ||
259 | 42 | self.assertTrue(restricted_family in family_set.getRestricted()) |
Hi Jelmer,
The merge looks good, but there are a bunch of lint errors. There are also dangling whitespace and tab characters that lint doesn't warn you about, since that is normally picked up by the user's editor configuration.
-Edwin
configure.zcml has tab-characters instead of spaces and dangling
whitespace at the end of lines.
test_archive.py has a lot of dangling whitespace.
archive.py has dangling whitespace.
== Pyflakes notices ==
lib/lp/ soyuz/tests/ test_archive. py main_src_ hist' is assigned to but never used
133: local variable 'gedit_
== Pylint notices ==
lib/lp/ soyuz/interface s/archive. py
502: [C0301] Line too long (79/78)
lib/lp/ soyuz/tests/ test_archive. py
789: [C0301] Line too long (79/78)
lib/lp/ soyuz/tests/ test_processor. py
30: [C0301] Line too long (79/78)
37: [C0301] Line too long (79/78)
39: [C0301] Line too long (79/78)