Merge lp:~jelmer/launchpad/stable-fix into lp:launchpad/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
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.
Revision history for this message
Edwin Grubbs (edwin-grubbs) wrote :

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
    133: local variable 'gedit_main_src_hist' is assigned to but never used

== Pylint notices ==

lib/lp/soyuz/interfaces/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)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/soyuz/browser/archive.py'
--- lib/lp/soyuz/browser/archive.py 2010-06-25 15:03:10 +0000
+++ lib/lp/soyuz/browser/archive.py 2010-06-30 17:52:31 +0000
@@ -78,6 +78,7 @@
78from lp.soyuz.interfaces.packageset import IPackagesetSet78from lp.soyuz.interfaces.packageset import IPackagesetSet
79from lp.registry.interfaces.person import IPersonSet, PersonVisibility79from lp.registry.interfaces.person import IPersonSet, PersonVisibility
80from lp.registry.interfaces.pocket import PackagePublishingPocket80from lp.registry.interfaces.pocket import PackagePublishingPocket
81from lp.soyuz.interfaces.processor import IProcessorFamilySet
81from lp.soyuz.interfaces.publishing import (82from lp.soyuz.interfaces.publishing import (
82 active_publishing_status, inactive_publishing_status, IPublishingSet,83 active_publishing_status, inactive_publishing_status, IPublishingSet,
83 PackagePublishingStatus)84 PackagePublishingStatus)
@@ -1874,10 +1875,12 @@
18741875
1875 field_names = ['enabled', 'private', 'commercial', 'require_virtualized',1876 field_names = ['enabled', 'private', 'commercial', 'require_virtualized',
1876 'buildd_secret', 'authorized_size', 'relative_build_score',1877 'buildd_secret', 'authorized_size', 'relative_build_score',
1877 'external_dependencies', 'arm_builds_allowed']1878 'external_dependencies']
18781879
1879 custom_widget('external_dependencies', TextAreaWidget, height=3)1880 custom_widget('external_dependencies', TextAreaWidget, height=3)
18801881
1882 custom_widget('enabled_restricted_families', LabeledMultiCheckBoxWidget)
1883
1881 def validate_save(self, action, data):1884 def validate_save(self, action, data):
1882 """Validate the save action on ArchiveAdminView.1885 """Validate the save action on ArchiveAdminView.
18831886
@@ -1956,6 +1959,31 @@
1956 """1959 """
1957 return self.context.owner.visibility == PersonVisibility.PRIVATE1960 return self.context.owner.visibility == PersonVisibility.PRIVATE
19581961
1962 def setUpFields(self):
1963 """Override `LaunchpadEditFormView`.
1964
1965 See `createEnabledRestrictedFamilies` method.
1966 """
1967 super(ArchiveAdminView, self).setUpFields()
1968 self.form_fields += self.createEnabledRestrictedFamilies()
1969
1970 def createEnabledRestrictedFamilies(self):
1971 """Creates the 'enabled_restricted_families' field.
1972
1973 """
1974 terms = []
1975 for family in getUtility(IProcessorFamilySet).getRestricted():
1976 terms.append(SimpleTerm(
1977 family, token=family.name, title=family.title))
1978 return form.Fields(
1979 List(__name__='enabled_restricted_families',
1980 title=_('Enabled restricted families'),
1981 value_type=Choice(vocabulary=SimpleVocabulary(terms)),
1982 required=False,
1983 description=_('Select the restricted architecture families '
1984 'on which this archive is allowed to build.')),
1985 render_context=self.render_context)
1986
19591987
1960class ArchiveDeleteView(LaunchpadFormView):1988class ArchiveDeleteView(LaunchpadFormView):
1961 """View class for deleting `IArchive`s"""1989 """View class for deleting `IArchive`s"""
19621990
=== modified file 'lib/lp/soyuz/configure.zcml'
--- lib/lp/soyuz/configure.zcml 2010-06-21 19:29:34 +0000
+++ lib/lp/soyuz/configure.zcml 2010-06-30 17:52:31 +0000
@@ -405,7 +405,8 @@
405 set_attributes="description displayname publish status"/>405 set_attributes="description displayname publish status"/>
406 <require406 <require
407 permission="launchpad.Commercial"407 permission="launchpad.Commercial"
408 set_attributes="authorized_size buildd_secret arm_builds_allowed408 set_attributes="authorized_size buildd_secret
409 enabled_restricted_families
409 commercial external_dependencies private410 commercial external_dependencies private
410 require_virtualized relative_build_score "/>411 require_virtualized relative_build_score "/>
411 <require412 <require
412413
=== modified file 'lib/lp/soyuz/interfaces/archive.py'
--- lib/lp/soyuz/interfaces/archive.py 2010-06-25 15:03:10 +0000
+++ lib/lp/soyuz/interfaces/archive.py 2010-06-30 17:52:31 +0000
@@ -56,6 +56,7 @@
56from canonical.launchpad.interfaces.launchpad import IPrivacy56from canonical.launchpad.interfaces.launchpad import IPrivacy
57from lp.registry.interfaces.role import IHasOwner57from lp.registry.interfaces.role import IHasOwner
58from lp.soyuz.interfaces.buildrecords import IHasBuildRecords58from lp.soyuz.interfaces.buildrecords import IHasBuildRecords
59from lp.soyuz.interfaces.processor import IProcessorFamily
59from lp.registry.interfaces.gpg import IGPGKey60from lp.registry.interfaces.gpg import IGPGKey
60from lp.registry.interfaces.person import IPerson61from lp.registry.interfaces.person import IPerson
61from canonical.launchpad.validators.name import name_validator62from canonical.launchpad.validators.name import name_validator
@@ -368,8 +369,11 @@
368 "context build.\n"369 "context build.\n"
369 "NOTE: This is for migration of OEM PPAs only!"))370 "NOTE: This is for migration of OEM PPAs only!"))
370371
371 arm_builds_allowed = Bool(372 enabled_restricted_families = CollectionField(
372 title=_("Allow ARM builds for this archive"))373 title=_("Restricted architecture families this archive can build "
374 "on"),
375 value_type=Reference(schema=IProcessorFamily),
376 readonly=False)
373377
374 commercial = exported(378 commercial = exported(
375 Bool(379 Bool(
376380
=== modified file 'lib/lp/soyuz/interfaces/processor.py'
--- lib/lp/soyuz/interfaces/processor.py 2010-02-24 15:13:10 +0000
+++ lib/lp/soyuz/interfaces/processor.py 2010-06-30 17:52:31 +0000
@@ -55,6 +55,12 @@
55 :return: A `IProcessorFamily` instance if found, None otherwise.55 :return: A `IProcessorFamily` instance if found, None otherwise.
56 """56 """
5757
58 def getRestricted():
59 """Return a sequence of all restricted architectures.
60
61 :return: A sequence of `IProcessorFamily` instances.
62 """
63
58 def getByProcessorName(name):64 def getByProcessorName(name):
59 """Given a processor name return the ProcessorFamily it belongs to.65 """Given a processor name return the ProcessorFamily it belongs to.
6066
6167
=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py 2010-06-29 09:37:26 +0000
+++ lib/lp/soyuz/model/archive.py 2010-06-30 17:52:31 +0000
@@ -1590,6 +1590,24 @@
1590 LibraryFileContent.id == LibraryFileAlias.contentID).config(1590 LibraryFileContent.id == LibraryFileAlias.contentID).config(
1591 distinct=True))1591 distinct=True))
15921592
1593 def _get_enabled_restricted_families(self):
1594 archive_arch_set = getUtility(IArchiveArchSet)
1595 restricted_families = archive_arch_set.getRestrictedfamilies(self)
1596 return [family for (family, archive_arch) in restricted_families
1597 if archive_arch is not None]
1598
1599 def _set_enabled_restricted_families(self, value):
1600 archive_arch_set = getUtility(IArchiveArchSet)
1601 restricted_families = archive_arch_set.getRestrictedfamilies(self)
1602 for (family, archive_arch) in restricted_families:
1603 if family in value and archive_arch is None:
1604 archive_arch_set.new(self, family)
1605 if family not in value and archive_arch is not None:
1606 Store.of(self).remove(archive_arch)
1607
1608 enabled_restricted_families = property(_get_enabled_restricted_families,
1609 _set_enabled_restricted_families)
1610
15931611
1594class ArchiveSet:1612class ArchiveSet:
1595 implements(IArchiveSet)1613 implements(IArchiveSet)
15961614
=== modified file 'lib/lp/soyuz/model/processor.py'
--- lib/lp/soyuz/model/processor.py 2010-02-24 16:14:37 +0000
+++ lib/lp/soyuz/model/processor.py 2010-06-30 17:52:31 +0000
@@ -59,6 +59,11 @@
59 rset = store.find(ProcessorFamily, ProcessorFamily.name == name)59 rset = store.find(ProcessorFamily, ProcessorFamily.name == name)
60 return rset.one()60 return rset.one()
6161
62 def getRestricted(self):
63 """See `IProcessorFamilySet`."""
64 store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
65 return store.find(ProcessorFamily, ProcessorFamily.restricted == True)
66
62 def getByProcessorName(self, name):67 def getByProcessorName(self, name):
63 """Please see `IProcessorFamilySet`."""68 """Please see `IProcessorFamilySet`."""
64 store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)69 store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
6570
=== modified file 'lib/lp/soyuz/tests/test_archive.py'
--- lib/lp/soyuz/tests/test_archive.py 2010-06-25 15:03:10 +0000
+++ lib/lp/soyuz/tests/test_archive.py 2010-06-30 17:52:31 +0000
@@ -739,14 +739,15 @@
739 self.assertCount(3, self.archive, self.bpr_2, day, self.australia)739 self.assertCount(3, self.archive, self.bpr_2, day, self.australia)
740740
741741
742class TestARMBuildsAllowed(TestCaseWithFactory):742class TestEnabledRestrictedBuilds(TestCaseWithFactory):
743 """Ensure that ARM builds can be allowed and disallowed correctly."""743 """Ensure that restricted architecture family builds can be allowed and
744 disallowed correctly."""
744745
745 layer = LaunchpadZopelessLayer746 layer = LaunchpadZopelessLayer
746747
747 def setUp(self):748 def setUp(self):
748 """Setup an archive with relevant publications."""749 """Setup an archive with relevant publications."""
749 super(TestARMBuildsAllowed, self).setUp()750 super(TestEnabledRestrictedBuilds, self).setUp()
750 self.publisher = SoyuzTestPublisher()751 self.publisher = SoyuzTestPublisher()
751 self.publisher.prepareBreezyAutotest()752 self.publisher.prepareBreezyAutotest()
752 self.archive = self.factory.makeArchive()753 self.archive = self.factory.makeArchive()
@@ -754,41 +755,44 @@
754 self.arm = getUtility(IProcessorFamilySet).getByName('arm')755 self.arm = getUtility(IProcessorFamilySet).getByName('arm')
755756
756 def test_default(self):757 def test_default(self):
757 """By default, ARM builds are not allowed."""758 """By default, ARM builds are not allowed as ARM is restricted."""
758 self.assertEquals(0,759 self.assertEquals(0,
759 self.archive_arch_set.getByArchive(760 self.archive_arch_set.getByArchive(
760 self.archive, self.arm).count())761 self.archive, self.arm).count())
761 self.assertFalse(self.archive.arm_builds_allowed)762 self.assertEquals([], list(self.archive.enabled_restricted_families))
762763
763 def test_get_uses_archivearch(self):764 def test_get_uses_archivearch(self):
764 """Adding an entry to ArchiveArch for ARM and an archive will765 """Adding an entry to ArchiveArch for ARM and an archive will
765 enable arm_builds_allowed for that archive."""766 enable enabled_restricted_families for arm for that archive."""
766 self.assertFalse(self.archive.arm_builds_allowed)767 self.assertEquals([], list(self.archive.enabled_restricted_families))
767 self.archive_arch_set.new(self.archive, self.arm)768 self.archive_arch_set.new(self.archive, self.arm)
768 self.assertTrue(self.archive.arm_builds_allowed)769 self.assertEquals([self.arm],
770 list(self.archive.enabled_restricted_families))
769771
770 def test_get_uses_arm_only(self):772 def test_get_returns_restricted_only(self):
771 """Adding an entry to ArchiveArch for something other than ARM773 """Adding an entry to ArchiveArch for something that is not
772 does not enable arm_builds_allowed for that archive."""774 restricted does not make it show up in enabled_restricted_families.
773 self.assertFalse(self.archive.arm_builds_allowed)775 """
776 self.assertEquals([], list(self.archive.enabled_restricted_families))
774 self.archive_arch_set.new(self.archive,777 self.archive_arch_set.new(self.archive,
775 getUtility(IProcessorFamilySet).getByName('amd64'))778 getUtility(IProcessorFamilySet).getByName('amd64'))
776 self.assertFalse(self.archive.arm_builds_allowed)779 self.assertEquals([], list(self.archive.enabled_restricted_families))
777780
778 def test_set(self):781 def test_set(self):
779 """The property remembers its value correctly and sets ArchiveArch."""782 """The property remembers its value correctly and sets ArchiveArch."""
780 self.archive.arm_builds_allowed = True783 self.archive.enabled_restricted_families = [self.arm]
781 allowed_restricted_families = self.archive_arch_set.getByArchive(784 allowed_restricted_families = self.archive_arch_set.getByArchive(
782 self.archive, self.arm)785 self.archive, self.arm)
783 self.assertEquals(1, allowed_restricted_families.count())786 self.assertEquals(1, allowed_restricted_families.count())
784 self.assertEquals(self.arm,787 self.assertEquals(self.arm,
785 allowed_restricted_families[0].processorfamily)788 allowed_restricted_families[0].processorfamily)
786 self.assertTrue(self.archive.arm_builds_allowed)789 self.assertEquals([self.arm], self.archive.enabled_restricted_families)
787 self.archive.arm_builds_allowed = False790 self.archive.enabled_restricted_families = []
788 self.assertEquals(0,791 self.assertEquals(0,
789 self.archive_arch_set.getByArchive(792 self.archive_arch_set.getByArchive(
790 self.archive, self.arm).count())793 self.archive, self.arm).count())
791 self.assertFalse(self.archive.arm_builds_allowed)794 self.assertEquals([], list(self.archive.enabled_restricted_families))
795
792796
793class TestArchiveTokens(TestCaseWithFactory):797class TestArchiveTokens(TestCaseWithFactory):
794 layer = LaunchpadZopelessLayer798 layer = LaunchpadZopelessLayer
795799
=== modified file 'lib/lp/soyuz/tests/test_processor.py'
--- lib/lp/soyuz/tests/test_processor.py 2010-02-25 17:07:38 +0000
+++ lib/lp/soyuz/tests/test_processor.py 2010-06-30 17:52:31 +0000
@@ -30,3 +30,13 @@
30 proc = family.addProcessor("avr2001", "The 2001 AVR", "Fast as light.")30 proc = family.addProcessor("avr2001", "The 2001 AVR", "Fast as light.")
31 self.assertProvides(proc, IProcessor)31 self.assertProvides(proc, IProcessor)
32 self.assertEquals(family, proc.family)32 self.assertEquals(family, proc.family)
33
34 def test_get_restricted(self):
35 """Test retrieving all restricted processors."""
36 family_set = getUtility(IProcessorFamilySet)
37 normal_family = getUtility(IProcessorFamilySet).new("avr", "Atmel AVR",
38 "The Modified Harvard architecture 8-bit RISC processors.")
39 restricted_family = getUtility(IProcessorFamilySet).new("5051", "5051",
40 "Another small processor family", restricted=True)
41 self.assertFalse(normal_family in family_set.getRestricted())
42 self.assertTrue(restricted_family in family_set.getRestricted())

Subscribers

People subscribed via source and target branches

to status/vote changes: