Merge lp:~jelmer/launchpad/bug471148-ui into lp:launchpad/db-devel

Proposed by Jelmer Vernooij
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
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.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

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.

Revision history for this message
Abel Deuring (adeuring) wrote :

(14:46:44) adeuring: jelmer: could you add doc strings to _get_arm_builds_enabled() and _get_arm_builds_disabled()?
(14:47:36) adeuring: jelmer: sorry... i mean _set_arm_builds_enabled() instead of the "disabled"
(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_builds_enabled() without a final "else". Could you add such an "else: pass", together with a comment why nothing needs to be done in this case?
(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.

review: Approve (code)
Revision history for this message
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://code.launchpad.net/~jelmer/launchpad/bug471148-ui is the code
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://code.edge.launchpad.net/~jelmer/launchpad/bug471148-ui/+merge/20208 is the mp
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://devpad.canonical.com/~muharem/bug471148-2.png
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
                 sentence case (https://dev.launchpad.net/UserInterfaceWording)
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.

review: Approve (ui)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== renamed file 'database/schema/patch-9999-24-0.sql' => 'database/schema/patch-2207-35-0.sql'
--- database/schema/patch-9999-24-0.sql 2010-02-26 15:19:18 +0000
+++ database/schema/patch-2207-35-0.sql 2010-02-26 15:19:22 +0000
@@ -5,4 +5,4 @@
55
6ALTER TABLE processorfamily ADD COLUMN restricted boolean DEFAULT FALSE NOT NULL;6ALTER TABLE processorfamily ADD COLUMN restricted boolean DEFAULT FALSE NOT NULL;
77
8INSERT INTO LaunchpadDatabaseRevision VALUES (9999, 24, 0);8INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 35, 0);
99
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2010-02-22 12:44:29 +0000
+++ database/schema/security.cfg 2010-02-26 15:19:22 +0000
@@ -125,7 +125,7 @@
125public.archive = SELECT, INSERT, UPDATE125public.archive = SELECT, INSERT, UPDATE
126public.archiveauthtoken = SELECT, INSERT, UPDATE126public.archiveauthtoken = SELECT, INSERT, UPDATE
127public.archivesubscriber = SELECT, INSERT, UPDATE127public.archivesubscriber = SELECT, INSERT, UPDATE
128public.archivearch = SELECT, INSERT, UPDATE128public.archivearch = SELECT, INSERT, UPDATE, DELETE
129public.archivedependency = SELECT, INSERT, DELETE129public.archivedependency = SELECT, INSERT, DELETE
130public.archivepermission = SELECT, INSERT, UPDATE, DELETE130public.archivepermission = SELECT, INSERT, UPDATE, DELETE
131public.authtoken = SELECT, INSERT, UPDATE, DELETE131public.authtoken = SELECT, INSERT, UPDATE, DELETE
@@ -916,7 +916,7 @@
916# certain processes, such as the librarian tables. This group is deprecated -916# certain processes, such as the librarian tables. This group is deprecated -
917# access should be explicitly granted to users.917# access should be explicitly granted to users.
918public.archive = SELECT, INSERT, UPDATE918public.archive = SELECT, INSERT, UPDATE
919public.archivearch = SELECT, INSERT, UPDATE919public.archivearch = SELECT, INSERT, UPDATE, DELETE
920public.binarypackagerelease = SELECT, INSERT, UPDATE920public.binarypackagerelease = SELECT, INSERT, UPDATE
921public.binarypackagefile = SELECT, INSERT, UPDATE921public.binarypackagefile = SELECT, INSERT, UPDATE
922public.binarypackagefilepublishing = SELECT, INSERT, UPDATE922public.binarypackagefilepublishing = SELECT, INSERT, UPDATE
923923
=== modified file 'lib/lp/soyuz/browser/archive.py'
--- lib/lp/soyuz/browser/archive.py 2010-02-25 16:49:16 +0000
+++ lib/lp/soyuz/browser/archive.py 2010-02-26 15:19:22 +0000
@@ -46,6 +46,7 @@
46from canonical.launchpad import _46from canonical.launchpad import _
47from canonical.launchpad.helpers import english_list47from canonical.launchpad.helpers import english_list
48from canonical.lazr.utils import smartquote48from canonical.lazr.utils import smartquote
49from canonical.widgets import CheckBoxMatrixWidget
49from lp.services.browser_helpers import get_user_agent_distroseries50from lp.services.browser_helpers import get_user_agent_distroseries
50from lp.soyuz.browser.build import BuildRecordsView51from lp.soyuz.browser.build import BuildRecordsView
51from lp.soyuz.browser.sourceslist import (52from lp.soyuz.browser.sourceslist import (
@@ -1790,7 +1791,7 @@
17901791
1791 field_names = ['enabled', 'private', 'require_virtualized',1792 field_names = ['enabled', 'private', 'require_virtualized',
1792 'buildd_secret', 'authorized_size', 'relative_build_score',1793 'buildd_secret', 'authorized_size', 'relative_build_score',
1793 'external_dependencies']1794 'external_dependencies', 'arm_builds_allowed']
17941795
1795 custom_widget('external_dependencies', TextAreaWidget, height=3)1796 custom_widget('external_dependencies', TextAreaWidget, height=3)
17961797
@@ -1817,7 +1818,7 @@
1817 'Do not specify for non-private archives')1818 'Do not specify for non-private archives')
18181819
1819 # Check the external_dependencies field.1820 # Check the external_dependencies field.
1820 ext_deps = data.get('external_dependencies')1821 ext_deps = data.get('external_dependencies')
1821 if ext_deps is not None:1822 if ext_deps is not None:
1822 errors = self.validate_external_dependencies(ext_deps)1823 errors = self.validate_external_dependencies(ext_deps)
1823 if len(errors) != 0:1824 if len(errors) != 0:
18241825
=== modified file 'lib/lp/soyuz/configure.zcml'
--- lib/lp/soyuz/configure.zcml 2010-02-25 22:41:23 +0000
+++ lib/lp/soyuz/configure.zcml 2010-02-26 15:19:22 +0000
@@ -400,7 +400,11 @@
400 <require400 <require
401 permission="launchpad.Edit"401 permission="launchpad.Edit"
402 interface="lp.soyuz.interfaces.archive.IArchiveEdit"402 interface="lp.soyuz.interfaces.archive.IArchiveEdit"
403<<<<<<< TREE
403 set_attributes="description displayname publish"/>404 set_attributes="description displayname publish"/>
405=======
406 set_attributes="description displayname arm_builds_allowed"/>
407>>>>>>> MERGE-SOURCE
404 <require408 <require
405 permission="launchpad.Commercial"409 permission="launchpad.Commercial"
406 set_attributes="authorized_size buildd_secret410 set_attributes="authorized_size buildd_secret
407411
=== modified file 'lib/lp/soyuz/interfaces/archive.py'
--- lib/lp/soyuz/interfaces/archive.py 2010-02-25 16:49:16 +0000
+++ lib/lp/soyuz/interfaces/archive.py 2010-02-26 15:19:22 +0000
@@ -1090,6 +1090,9 @@
1090 def disable():1090 def disable():
1091 """Disable the archive."""1091 """Disable the archive."""
10921092
1093 arm_builds_allowed = Bool(
1094 title=_("Builds on ARM are allowed for this archive."))
1095
10931096
1094class IArchive(IArchivePublic, IArchiveAppend, IArchiveEdit, IArchiveView):1097class IArchive(IArchivePublic, IArchiveAppend, IArchiveEdit, IArchiveView):
1095 """Main Archive interface."""1098 """Main Archive interface."""
10961099
=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py 2010-02-18 17:05:50 +0000
+++ lib/lp/soyuz/model/archive.py 2010-02-26 15:19:22 +0000
@@ -59,6 +59,7 @@
59 IDistributionArchive, InvalidComponent, IPPA, MAIN_ARCHIVE_PURPOSES,59 IDistributionArchive, InvalidComponent, IPPA, MAIN_ARCHIVE_PURPOSES,
60 NoSuchPPA, PocketNotFound, VersionRequiresName, default_name_by_purpose)60 NoSuchPPA, PocketNotFound, VersionRequiresName, default_name_by_purpose)
61from lp.soyuz.interfaces.archiveauthtoken import IArchiveAuthTokenSet61from lp.soyuz.interfaces.archiveauthtoken import IArchiveAuthTokenSet
62from lp.soyuz.interfaces.archivearch import IArchiveArchSet
62from lp.soyuz.interfaces.archivepermission import (63from lp.soyuz.interfaces.archivepermission import (
63 ArchivePermissionType, IArchivePermissionSet)64 ArchivePermissionType, IArchivePermissionSet)
64from lp.soyuz.interfaces.archivesubscriber import (65from lp.soyuz.interfaces.archivesubscriber import (
@@ -75,6 +76,7 @@
75from lp.registry.interfaces.role import IHasOwner76from lp.registry.interfaces.role import IHasOwner
76from lp.soyuz.interfaces.queue import PackageUploadStatus77from lp.soyuz.interfaces.queue import PackageUploadStatus
77from lp.soyuz.interfaces.packagecopyrequest import IPackageCopyRequestSet78from lp.soyuz.interfaces.packagecopyrequest import IPackageCopyRequestSet
79from lp.soyuz.interfaces.processor import IProcessorFamilySet
78from lp.soyuz.interfaces.publishing import (80from lp.soyuz.interfaces.publishing import (
79 active_publishing_status, PackagePublishingStatus, IPublishingSet)81 active_publishing_status, PackagePublishingStatus, IPublishingSet)
80from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet82from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
@@ -182,6 +184,39 @@
182 external_dependencies = StringCol(184 external_dependencies = StringCol(
183 dbName='external_dependencies', notNull=False, default=None)185 dbName='external_dependencies', notNull=False, default=None)
184186
187 def _get_arm_builds_enabled(self):
188 """Check whether ARM builds are allowed for this archive."""
189 archive_arch_set = getUtility(IArchiveArchSet)
190 restricted_families = archive_arch_set.getRestrictedfamilies(self)
191 arm = getUtility(IProcessorFamilySet).getByName('arm')
192 for (family, archive_arch) in restricted_families:
193 if family == arm:
194 return (archive_arch is not None)
195 # ARM doesn't exist or isn't restricted. Either way, there is no
196 # need for an explicit association.
197 return False
198
199 def _set_arm_builds_enabled(self, value):
200 """Set whether ARM builds are enabled for this archive."""
201 archive_arch_set = getUtility(IArchiveArchSet)
202 restricted_families = archive_arch_set.getRestrictedfamilies(self)
203 arm = getUtility(IProcessorFamilySet).getByName('arm')
204 for (family, archive_arch) in restricted_families:
205 if family == arm:
206 if value:
207 if archive_arch is not None:
208 # ARM builds are already enabled
209 return
210 else:
211 archive_arch_set.new(self, family)
212 else:
213 if archive_arch is not None:
214 Store.of(self).remove(archive_arch)
215 else:
216 pass # ARM builds are already disabled
217 arm_builds_allowed = property(_get_arm_builds_enabled,
218 _set_arm_builds_enabled)
219
185 def _init(self, *args, **kw):220 def _init(self, *args, **kw):
186 """Provide the right interface for URL traversal."""221 """Provide the right interface for URL traversal."""
187 SQLBase._init(self, *args, **kw)222 SQLBase._init(self, *args, **kw)
188223
=== modified file 'lib/lp/soyuz/tests/test_archive.py'
--- lib/lp/soyuz/tests/test_archive.py 2010-02-08 16:33:12 +0000
+++ lib/lp/soyuz/tests/test_archive.py 2010-02-26 15:19:22 +0000
@@ -19,8 +19,10 @@
19from lp.registry.interfaces.person import IPersonSet19from lp.registry.interfaces.person import IPersonSet
20from lp.services.job.interfaces.job import JobStatus20from lp.services.job.interfaces.job import JobStatus
21from lp.soyuz.interfaces.archive import IArchiveSet, ArchivePurpose21from lp.soyuz.interfaces.archive import IArchiveSet, ArchivePurpose
22from lp.soyuz.interfaces.archivearch import IArchiveArchSet
22from lp.soyuz.interfaces.binarypackagerelease import BinaryPackageFormat23from lp.soyuz.interfaces.binarypackagerelease import BinaryPackageFormat
23from lp.soyuz.interfaces.build import BuildStatus24from lp.soyuz.interfaces.build import BuildStatus
25from lp.soyuz.interfaces.processor import IProcessorFamilySet
24from lp.soyuz.interfaces.publishing import PackagePublishingStatus26from lp.soyuz.interfaces.publishing import PackagePublishingStatus
25from lp.soyuz.model.build import Build27from lp.soyuz.model.build import Build
26from lp.soyuz.tests.test_publishing import SoyuzTestPublisher28from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
@@ -558,5 +560,56 @@
558 self.assertEqual(1, len(pubs))560 self.assertEqual(1, len(pubs))
559 self.assertEqual('0.5.11~ppa1', pubs[0].source_package_version)561 self.assertEqual('0.5.11~ppa1', pubs[0].source_package_version)
560562
563
564class TestARMBuildsAllowed(TestCaseWithFactory):
565 """Ensure that ARM builds can be allowed and disallowed correctly."""
566
567 layer = LaunchpadZopelessLayer
568
569 def setUp(self):
570 """Setup an archive with relevant publications."""
571 super(TestARMBuildsAllowed, self).setUp()
572 self.publisher = SoyuzTestPublisher()
573 self.publisher.prepareBreezyAutotest()
574 self.archive = self.factory.makeArchive()
575 self.archive_arch_set = getUtility(IArchiveArchSet)
576 self.arm = getUtility(IProcessorFamilySet).getByName('arm')
577
578 def test_default(self):
579 """By default, ARM builds are not allowed."""
580 self.assertEquals(0,
581 self.archive_arch_set.getByArchive(self.archive, self.arm).count())
582 self.assertFalse(self.archive.arm_builds_allowed)
583
584 def test_get_uses_archivearch(self):
585 """Adding an entry to ArchiveArch for ARM and an archive will
586 enable arm_builds_allowed for that archive."""
587 self.assertFalse(self.archive.arm_builds_allowed)
588 self.archive_arch_set.new(self.archive, self.arm)
589 self.assertTrue(self.archive.arm_builds_allowed)
590
591 def test_get_uses_arm_only(self):
592 """Adding an entry to ArchiveArch for something other than ARM
593 does not enable arm_builds_allowed for that archive."""
594 self.assertFalse(self.archive.arm_builds_allowed)
595 self.archive_arch_set.new(self.archive,
596 getUtility(IProcessorFamilySet).getByName('amd64'))
597 self.assertFalse(self.archive.arm_builds_allowed)
598
599 def test_set(self):
600 """The property remembers its value correctly and sets ArchiveArch."""
601 self.archive.arm_builds_allowed = True
602 allowed_restricted_families = self.archive_arch_set.getByArchive(
603 self.archive, self.arm)
604 self.assertEquals(1, allowed_restricted_families.count())
605 self.assertEquals(self.arm,
606 allowed_restricted_families[0].processorfamily)
607 self.assertTrue(self.archive.arm_builds_allowed)
608 self.archive.arm_builds_allowed = False
609 self.assertEquals(0,
610 self.archive_arch_set.getByArchive(self.archive, self.arm).count())
611 self.assertFalse(self.archive.arm_builds_allowed)
612
613
561def test_suite():614def test_suite():
562 return unittest.TestLoader().loadTestsFromName(__name__)615 return unittest.TestLoader().loadTestsFromName(__name__)
563616
=== modified file 'lib/lp/soyuz/tests/test_processor.py'
--- lib/lp/soyuz/tests/test_processor.py 2010-02-26 15:19:18 +0000
+++ lib/lp/soyuz/tests/test_processor.py 2010-02-26 15:19:22 +0000
@@ -18,11 +18,13 @@
18 layer = LaunchpadZopelessLayer18 layer = LaunchpadZopelessLayer
1919
20 def test_create(self):20 def test_create(self):
21 """Test adding a new ProcessorFamily."""
21 family = getUtility(IProcessorFamilySet).new("avr", "Atmel AVR",22 family = getUtility(IProcessorFamilySet).new("avr", "Atmel AVR",
22 "The Modified Harvard architecture 8-bit RISC processors.")23 "The Modified Harvard architecture 8-bit RISC processors.")
23 self.assertProvides(family, IProcessorFamily)24 self.assertProvides(family, IProcessorFamily)
2425
25 def test_add_processor(self):26 def test_add_processor(self):
27 """Test adding a new Processor to a ProcessorFamily."""
26 family = getUtility(IProcessorFamilySet).new("avr", "Atmel AVR",28 family = getUtility(IProcessorFamilySet).new("avr", "Atmel AVR",
27 "The Modified Harvard architecture 8-bit RISC processors.")29 "The Modified Harvard architecture 8-bit RISC processors.")
28 proc = family.addProcessor("avr2001", "The 2001 AVR", "Fast as light.")30 proc = family.addProcessor("avr2001", "The 2001 AVR", "Fast as light.")
2931
=== modified file 'lib/lp/soyuz/tests/test_publishing.py'
--- lib/lp/soyuz/tests/test_publishing.py 2010-02-26 15:19:18 +0000
+++ lib/lp/soyuz/tests/test_publishing.py 2010-02-26 15:19:22 +0000
@@ -883,8 +883,19 @@
883 self.sparc_distroarch = self.factory.makeDistroArchSeries(883 self.sparc_distroarch = self.factory.makeDistroArchSeries(
884 architecturetag='sparc', processorfamily=self.sparc_family,884 architecturetag='sparc', processorfamily=self.sparc_family,
885 distroseries=self.distroseries, supports_virtualized=True)885 distroseries=self.distroseries, supports_virtualized=True)
886 self.distroseries.nominatedarchindep = self.sparc_distroarch
886 self.addFakeChroots(self.distroseries)887 self.addFakeChroots(self.distroseries)
887888
889 def getPubSource(self, architecturehintlist):
890 """Return a mock source package publishing record for the archive
891 and architecture used in this testcase.
892
893 :param architecturehintlist: Architecture hint list (e.g. "i386 amd64")
894 """
895 return super(BuildRecordCreationTests, self).getPubSource(
896 archive=self.archive, distroseries=self.distroseries,
897 architecturehintlist=architecturehintlist)
898
888 def test__getAllowedArchitectures_restricted(self):899 def test__getAllowedArchitectures_restricted(self):
889 """Test _getAllowedArchitectures doesn't return unrestricted900 """Test _getAllowedArchitectures doesn't return unrestricted
890 archs.901 archs.
@@ -893,8 +904,7 @@
893 be used.904 be used.
894 """905 """
895 available_archs = [self.sparc_distroarch, self.avr_distroarch]906 available_archs = [self.sparc_distroarch, self.avr_distroarch]
896 pubrec = self.getPubSource(distroseries=self.distroseries,907 pubrec = self.getPubSource(architecturehintlist='any')
897 archive=self.archive, architecturehintlist='any')
898 self.assertEquals([self.sparc_distroarch],908 self.assertEquals([self.sparc_distroarch],
899 pubrec._getAllowedArchitectures(available_archs))909 pubrec._getAllowedArchitectures(available_archs))
900910
@@ -906,22 +916,45 @@
906 """916 """
907 available_archs = [self.sparc_distroarch, self.avr_distroarch]917 available_archs = [self.sparc_distroarch, self.avr_distroarch]
908 getUtility(IArchiveArchSet).new(self.archive, self.avr_family)918 getUtility(IArchiveArchSet).new(self.archive, self.avr_family)
909 pubrec = self.getPubSource(distroseries=self.distroseries,919 pubrec = self.getPubSource(architecturehintlist='any')
910 archive=self.archive, architecturehintlist='any')
911 self.assertEquals([self.sparc_distroarch, self.avr_distroarch], 920 self.assertEquals([self.sparc_distroarch, self.avr_distroarch],
912 pubrec._getAllowedArchitectures(available_archs))921 pubrec._getAllowedArchitectures(available_archs))
913922
914 def test_createMissingBuilds_restricts(self):923 def test_createMissingBuilds_restricts_any(self):
915 pubrec = self.getPubSource(distroseries=self.distroseries,924 """createMissingBuilds() should limit builds targeted at 'any'
916 archive=self.archive, architecturehintlist='any')925 architecture to those allowed for the archive.
926 """
927 pubrec = self.getPubSource(architecturehintlist='any')
928 builds = pubrec.createMissingBuilds()
929 self.assertEquals(1, len(builds))
930 self.assertEquals(self.sparc_distroarch, builds[0].distroarchseries)
931
932 def test_createMissingBuilds_restricts_explicitlist(self):
933 """createMissingBuilds() should limit builds targeted at a
934 variety of architectures architecture to those allowed for the archive.
935 """
936 pubrec = self.getPubSource(architecturehintlist='sparc i386 avr')
937 builds = pubrec.createMissingBuilds()
938 self.assertEquals(1, len(builds))
939 self.assertEquals(self.sparc_distroarch, builds[0].distroarchseries)
940
941 def test_createMissingBuilds_restricts_all(self):
942 """createMissingBuilds() should limit builds targeted at 'all'
943 architectures to the nominated independent architecture,
944 if that is allowed for the archive.
945 """
946 pubrec = self.getPubSource(architecturehintlist='all')
917 builds = pubrec.createMissingBuilds()947 builds = pubrec.createMissingBuilds()
918 self.assertEquals(1, len(builds))948 self.assertEquals(1, len(builds))
919 self.assertEquals(self.sparc_distroarch, builds[0].distroarchseries)949 self.assertEquals(self.sparc_distroarch, builds[0].distroarchseries)
920950
921 def test_createMissingBuilds_restrict_override(self):951 def test_createMissingBuilds_restrict_override(self):
952 """createMissingBuilds() should limit builds targeted at 'any'
953 architecture to architectures that are unrestricted or
954 explicitly associated with the archive.
955 """
922 getUtility(IArchiveArchSet).new(self.archive, self.avr_family)956 getUtility(IArchiveArchSet).new(self.archive, self.avr_family)
923 pubrec = self.getPubSource(distroseries=self.distroseries,957 pubrec = self.getPubSource(architecturehintlist='any')
924 archive=self.archive, architecturehintlist='any')
925 builds = pubrec.createMissingBuilds()958 builds = pubrec.createMissingBuilds()
926 self.assertEquals(2, len(builds))959 self.assertEquals(2, len(builds))
927 self.assertEquals(self.avr_distroarch, builds[0].distroarchseries)960 self.assertEquals(self.avr_distroarch, builds[0].distroarchseries)

Subscribers

People subscribed via source and target branches

to status/vote changes: