launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #15929
[Merge] lp:~stevenk/launchpad/destroy-pf into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/destroy-pf into lp:launchpad with lp:~stevenk/launchpad/db-no-not-null-pf as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1225856 in Launchpad itself: "ProcessorFamily mostly just duplicates Processor"
https://bugs.launchpad.net/launchpad/+bug/1225856
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/destroy-pf/+merge/186956
Now that the new processor columns are populated, and set as NOT NULL, we can set about destroying processorfamily. This branch removes the models, interfaces, and no longer sets or displays it so that the next DB patch can drop the table and foreign keys.
--
https://code.launchpad.net/~stevenk/launchpad/destroy-pf/+merge/186956
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/destroy-pf into lp:launchpad.
=== modified file 'lib/lp/_schema_circular_imports.py'
--- lib/lp/_schema_circular_imports.py 2013-09-13 07:07:25 +0000
+++ lib/lp/_schema_circular_imports.py 2013-09-23 02:43:48 +0000
@@ -200,10 +200,7 @@
IPackageset,
IPackagesetSet,
)
-from lp.soyuz.interfaces.processor import (
- IProcessorFamily,
- IProcessor,
- )
+from lp.soyuz.interfaces.processor import IProcessor
from lp.soyuz.interfaces.publishing import (
IBinaryPackagePublishingHistory,
IBinaryPackagePublishingHistoryEdit,
@@ -395,8 +392,6 @@
patch_reference_property(IArchive, 'distribution', IDistribution)
patch_collection_property(IArchive, 'dependencies', IArchiveDependency)
patch_collection_property(
- IArchive, 'enabled_restricted_families', IProcessorFamily)
-patch_collection_property(
IArchive, 'enabled_restricted_processors', IProcessor)
patch_collection_return_type(IArchive, 'getAllPermissions', IArchivePermission)
patch_collection_return_type(
@@ -496,13 +491,8 @@
patch_entry_return_type(
IArchive, '_addArchiveDependency', IArchiveDependency)
patch_plain_parameter_type(
- IArchive, 'enableRestrictedFamily', 'family', IProcessorFamily)
-patch_plain_parameter_type(
IArchive, 'enableRestrictedProcessor', 'processor', IProcessor)
-# IProcessor
-patch_reference_property(IProcessor, 'family', IProcessorFamily)
-
# IBuildFarmJob
IBuildFarmJob['status'].vocabulary = BuildStatus
IBuildFarmJob['buildqueue_record'].schema = IBuildQueue
=== modified file 'lib/lp/app/browser/launchpad.py'
--- lib/lp/app/browser/launchpad.py 2013-04-09 08:22:58 +0000
+++ lib/lp/app/browser/launchpad.py 2013-09-23 02:43:48 +0000
@@ -145,10 +145,7 @@
from lp.services.worlddata.interfaces.language import ILanguageSet
from lp.soyuz.interfaces.binarypackagename import IBinaryPackageNameSet
from lp.soyuz.interfaces.packageset import IPackagesetSet
-from lp.soyuz.interfaces.processor import (
- IProcessorFamilySet,
- IProcessorSet,
- )
+from lp.soyuz.interfaces.processor import IProcessorSet
from lp.testopenid.interfaces.server import ITestOpenIDApplication
from lp.translations.interfaces.translationgroup import ITranslationGroupSet
from lp.translations.interfaces.translationimportqueue import (
@@ -679,7 +676,6 @@
'package-sets': IPackagesetSet,
'people': IPersonSet,
'pillars': IPillarNameSet,
- '+processor-families': IProcessorFamilySet,
'+processors': IProcessorSet,
'projects': IProductSet,
'projectgroups': IProjectGroupSet,
=== modified file 'lib/lp/archivepublisher/tests/test_dominator.py'
--- lib/lp/archivepublisher/tests/test_dominator.py 2013-05-23 07:06:42 +0000
+++ lib/lp/archivepublisher/tests/test_dominator.py 2013-09-23 02:43:48 +0000
@@ -999,7 +999,7 @@
distribution=das.distroseries.distribution)
other_das = self.factory.makeDistroArchSeries(
distroseries=other_series, architecturetag=das.architecturetag,
- processorfamily=das.processorfamily)
+ processor=das.processor)
self.assertContentEqual(
[], dominator.findBinariesForDomination(
other_das, bpphs[0].pocket))
=== modified file 'lib/lp/archivepublisher/tests/test_generate_contents_files.py'
--- lib/lp/archivepublisher/tests/test_generate_contents_files.py 2012-11-10 02:25:07 +0000
+++ lib/lp/archivepublisher/tests/test_generate_contents_files.py 2013-09-23 02:43:48 +0000
@@ -273,7 +273,7 @@
distroseries = self.factory.makeDistroSeries(distribution=distro)
processor = self.factory.makeProcessor()
das = self.factory.makeDistroArchSeries(
- distroseries=distroseries, processorfamily=processor.family)
+ distroseries=distroseries, processor=processor)
package = self.factory.makeSuiteSourcePackage(distroseries)
self.factory.makeSourcePackagePublishingHistory(
distroseries=distroseries, pocket=package.pocket)
=== modified file 'lib/lp/archivepublisher/tests/test_generate_extra_overrides.py'
--- lib/lp/archivepublisher/tests/test_generate_extra_overrides.py 2013-08-29 10:29:01 +0000
+++ lib/lp/archivepublisher/tests/test_generate_extra_overrides.py 2013-09-23 02:43:48 +0000
@@ -151,7 +151,7 @@
for das in dases:
build = self.factory.makeBinaryPackageBuild(
source_package_release=spph.sourcepackagerelease,
- distroarchseries=das, processor=das.default_processor)
+ distroarchseries=das, processor=das.processor)
bpr = self.factory.makeBinaryPackageRelease(
binarypackagename=package.name, build=build,
component=component, architecturespecific=True,
=== modified file 'lib/lp/archiveuploader/tests/test_buildduploads.py'
--- lib/lp/archiveuploader/tests/test_buildduploads.py 2012-07-03 11:01:01 +0000
+++ lib/lp/archiveuploader/tests/test_buildduploads.py 2013-09-23 02:43:48 +0000
@@ -20,12 +20,9 @@
PackagePublishingStatus,
PackageUploadStatus,
)
+from lp.soyuz.interfaces.processor import IProcessorSet
from lp.soyuz.interfaces.publishing import IPublishingSet
from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
-from lp.soyuz.model.processor import (
- Processor,
- ProcessorFamily,
- )
from lp.testing.gpgkeys import import_public_test_keys
@@ -181,12 +178,10 @@
"""Extend breezy setup to enable uploads to powerpc architecture."""
TestStagedBinaryUploadBase.setupBreezy(self)
self.switchToAdmin()
- ppc_family = ProcessorFamily.selectOneBy(name='powerpc')
- Processor(
- name='powerpc', title='PowerPC', description='not yet',
- family=ppc_family)
+ ppc = getUtility(IProcessorSet).new(
+ name='powerpc', title='PowerPC', description='not yet')
self.breezy.newArch(
- 'powerpc', ppc_family, True, self.breezy.owner)
+ 'powerpc', ppc, True, self.breezy.owner)
self.switchToUploader()
def setUp(self):
=== modified file 'lib/lp/buildmaster/doc/builder.txt'
--- lib/lp/buildmaster/doc/builder.txt 2013-08-27 06:46:28 +0000
+++ lib/lp/buildmaster/doc/builder.txt 2013-09-23 02:43:48 +0000
@@ -149,9 +149,9 @@
>>> print recipe_bq.processor
None
- >>> from lp.soyuz.interfaces.processor import IProcessorFamilySet
- >>> i386_family = getUtility(IProcessorFamilySet).getByName('x86')
- >>> recipe_bq.processor = i386_family.processors[0]
+ >>> from lp.soyuz.interfaces.processor import IProcessorSet
+ >>> i386_processor = getUtility(IProcessorSet).getByName('386')
+ >>> recipe_bq.processor = i386_processor
>>> recipe_bq.virtualized = True
>>> transaction.commit()
@@ -164,7 +164,7 @@
>>> recipe_bq = factory.makeSourcePackageRecipeBuildJob()
>>> recipe_bq.virtualized = None
- >>> recipe_bq.processor = i386_family.processors[0]
+ >>> recipe_bq.processor = i386_processor
>>> transaction.commit()
>>> queue_sizes = builderset.getBuildQueueSizes()
=== modified file 'lib/lp/buildmaster/tests/test_buildfarmjobbehavior.py'
--- lib/lp/buildmaster/tests/test_buildfarmjobbehavior.py 2013-09-18 04:57:10 +0000
+++ lib/lp/buildmaster/tests/test_buildfarmjobbehavior.py 2013-09-23 02:43:48 +0000
@@ -24,7 +24,7 @@
from lp.buildmaster.tests.mock_slaves import WaitingSlave
from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.services.config import config
-from lp.soyuz.interfaces.processor import IProcessorFamilySet
+from lp.soyuz.interfaces.processor import IProcessorSet
from lp.testing import TestCaseWithFactory
from lp.testing.factory import LaunchpadObjectFactory
from lp.testing.fakemethod import FakeMethod
@@ -55,9 +55,9 @@
def _makeBuild(self):
"""Create a `Build` object."""
- x86 = getUtility(IProcessorFamilySet).getByName('x86')
+ x86 = getUtility(IProcessorSet).getByName('386')
distroarchseries = self.factory.makeDistroArchSeries(
- architecturetag='x86', processorfamily=x86)
+ architecturetag='x86', processor=x86)
distroseries = distroarchseries.distroseries
archive = self.factory.makeArchive(
distribution=distroseries.distribution)
=== modified file 'lib/lp/buildmaster/tests/test_buildqueue.py'
--- lib/lp/buildmaster/tests/test_buildqueue.py 2013-09-02 08:11:58 +0000
+++ lib/lp/buildmaster/tests/test_buildqueue.py 2013-09-23 02:43:48 +0000
@@ -35,7 +35,7 @@
PackagePublishingStatus,
)
from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
-from lp.soyuz.model.processor import ProcessorFamilySet
+from lp.soyuz.interfaces.processor import IProcessorSet
from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
from lp.testing import TestCaseWithFactory
from lp.testing.fakemethod import FakeMethod
@@ -188,12 +188,11 @@
(estimate.seconds, delay_in_seconds))
-def disable_builders(test, processor, virtualized):
+def disable_builders(test, processor_name, virtualized):
"""Disable bulders with the given processor and virtualization setting."""
- if processor is not None:
- processor_fam = ProcessorFamilySet().getByName(processor)
- processor = processor_fam.processors[0].id
- for builder in test.builders[(processor, virtualized)]:
+ if processor_name is not None:
+ processor = getUtility(IProcessorSet).getByName(processor_name)
+ for builder in test.builders[(processor.id, virtualized)]:
builder.builderok = False
@@ -219,8 +218,7 @@
self.i9 = self.factory.makeBuilder(name='i386-n-9', virtualized=False)
# Next make seven 'hppa' builders.
- processor_fam = ProcessorFamilySet().getByName('hppa')
- self.hppa_proc = processor_fam.processors[0]
+ self.hppa_proc = getUtility(IProcessorSet).getByName('hppa')
self.h1 = self.factory.makeBuilder(
name='hppa-v-1', processor=self.hppa_proc)
self.h2 = self.factory.makeBuilder(
@@ -237,8 +235,7 @@
name='hppa-n-7', processor=self.hppa_proc, virtualized=False)
# Finally make five 'amd64' builders.
- processor_fam = ProcessorFamilySet().getByName('amd64')
- self.amd_proc = processor_fam.processors[0]
+ self.amd_proc = getUtility(IProcessorSet).getByName('amd64')
self.a1 = self.factory.makeBuilder(
name='amd64-v-1', processor=self.amd_proc)
self.a2 = self.factory.makeBuilder(
@@ -251,8 +248,7 @@
name='amd64-n-5', processor=self.amd_proc, virtualized=False)
self.builders = dict()
- processor_fam = ProcessorFamilySet().getByName('x86')
- self.x86_proc = processor_fam.processors[0]
+ self.x86_proc = getUtility(IProcessorSet).getByName('386')
# x86 native
self.builders[(self.x86_proc.id, False)] = [
self.i6, self.i7, self.i8, self.i9]
@@ -1318,7 +1314,7 @@
def test_no_builder_no_estimate(self):
# No dispatch estimate is provided in the absence of builders that
# can run the job of interest (JOI).
- disable_builders(self, 'x86', True)
+ disable_builders(self, '386', True)
vim_build, vim_job = find_job(self, 'vim', '386')
check_estimate(self, vim_job, None)
@@ -1326,7 +1322,7 @@
# Test that a reduced builder pool results in longer dispatch time
# estimates.
vim_build, vim_job = find_job(self, 'vim', '386')
- disable_builders(self, 'x86', True)
+ disable_builders(self, '386', True)
# Re-enable one builder.
builder = self.builders[(self.x86_proc.id, True)][0]
builder.builderok = True
@@ -1355,7 +1351,7 @@
def test_estimation_binary_virtual_headjob(self):
# The head job only waits for the next builder to become available.
- disable_builders(self, 'x86', True)
+ disable_builders(self, '386', True)
# Re-enable one builder.
builder = self.builders[(self.x86_proc.id, True)][0]
builder.builderok = True
=== modified file 'lib/lp/buildmaster/tests/test_interactor.py'
--- lib/lp/buildmaster/tests/test_interactor.py 2013-09-18 06:38:31 +0000
+++ lib/lp/buildmaster/tests/test_interactor.py 2013-09-23 02:43:48 +0000
@@ -316,7 +316,7 @@
distroseries = self.factory.makeDistroSeries()
das = self.factory.makeDistroArchSeries(
distroseries=distroseries, architecturetag="i386",
- processorfamily=processor.family)
+ processor=processor)
chroot = self.factory.makeLibraryFileAlias(db_only=True)
das.addOrUpdateChroot(chroot)
distroseries.nominatedarchindep = das
=== modified file 'lib/lp/buildmaster/tests/test_webservice.py'
--- lib/lp/buildmaster/tests/test_webservice.py 2012-01-01 02:58:52 +0000
+++ lib/lp/buildmaster/tests/test_webservice.py 2013-09-23 02:43:48 +0000
@@ -29,8 +29,8 @@
['nonvirt', 'virt'], sorted(results.jsonBody().keys()))
def test_getBuildersForQueue(self):
- g1 = self.factory.makeProcessorFamily('g1').processors[0]
- quantum = self.factory.makeProcessorFamily('quantum').processors[0]
+ g1 = self.factory.makeProcessor('g1')
+ quantum = self.factory.makeProcessor('quantum')
self.factory.makeBuilder(
processor=quantum, name='quantum_builder1')
self.factory.makeBuilder(
@@ -58,9 +58,8 @@
self.webservice = LaunchpadWebServiceCaller()
def test_exports_processor(self):
- processor_family = self.factory.makeProcessorFamily('s1')
- builder = self.factory.makeBuilder(
- processor=processor_family.processors[0])
+ processor = self.factory.makeProcessor('s1')
+ builder = self.factory.makeBuilder(processor=processor)
logout()
entry = self.webservice.get(
=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2013-08-22 04:30:39 +0000
+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2013-09-23 02:43:48 +0000
@@ -45,7 +45,7 @@
from lp.services.webapp.escaping import html_escape
from lp.services.webapp.interfaces import ILaunchpadRoot
from lp.services.webapp.servers import LaunchpadTestRequest
-from lp.soyuz.model.processor import ProcessorFamily
+from lp.soyuz.interfaces.processor import IProcessorSet
from lp.testing import (
admin_logged_in,
ANONYMOUS,
@@ -105,8 +105,8 @@
distribution=self.ppa.distribution)
naked_squirrel = removeSecurityProxy(self.squirrel)
naked_squirrel.nominatedarchindep = self.squirrel.newArch(
- 'i386', ProcessorFamily.get(1), False, self.chef,
- supports_virtualized=True)
+ 'i386', getUtility(IProcessorSet).getByName('386'), False,
+ self.chef, supports_virtualized=True)
def makeRecipe(self):
"""Create and return a specific recipe."""
@@ -1507,8 +1507,8 @@
name='woody', displayname='Woody',
distribution=self.ppa.distribution)
removeSecurityProxy(woody).nominatedarchindep = woody.newArch(
- 'i386', ProcessorFamily.get(1), False, self.factory.makePerson(),
- supports_virtualized=True)
+ 'i386', getUtility(IProcessorSet).getByName('386'), False,
+ self.factory.makePerson(), supports_virtualized=True)
return woody
def test_request_build_rejects_over_quota(self):
@@ -1734,7 +1734,7 @@
distroarchseries = self.factory.makeDistroArchSeries(
architecturetag=architecturetag,
distroseries=release.upload_distroseries,
- processorfamily=self.factory.makeProcessorFamily())
+ processor=self.factory.makeProcessor())
return self.factory.makeBinaryPackageBuild(
source_package_release=release, distroarchseries=distroarchseries)
=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py'
--- lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py 2013-01-23 10:16:18 +0000
+++ lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py 2013-09-23 02:43:48 +0000
@@ -15,7 +15,7 @@
from lp.buildmaster.enums import BuildStatus
from lp.registry.interfaces.person import IPersonSet
from lp.services.webapp import canonical_url
-from lp.soyuz.model.processor import ProcessorFamily
+from lp.soyuz.interfaces.processor import IProcessorSet
from lp.testing import (
admin_logged_in,
ANONYMOUS,
@@ -69,8 +69,8 @@
distribution=self.ppa.distribution)
naked_squirrel = removeSecurityProxy(self.squirrel)
naked_squirrel.nominatedarchindep = self.squirrel.newArch(
- 'i386', ProcessorFamily.get(1), False, self.chef,
- supports_virtualized=True)
+ 'i386', getUtility(IProcessorSet).getByName('386'), False,
+ self.chef, supports_virtualized=True)
def makeRecipeBuild(self):
"""Create and return a specific recipe."""
=== modified file 'lib/lp/code/model/sourcepackagerecipebuild.py'
--- lib/lp/code/model/sourcepackagerecipebuild.py 2013-09-02 08:11:58 +0000
+++ lib/lp/code/model/sourcepackagerecipebuild.py 2013-09-23 02:43:48 +0000
@@ -433,7 +433,7 @@
@property
def processor(self):
- return self.build.distroseries.nominatedarchindep.default_processor
+ return self.build.distroseries.nominatedarchindep.processor
@property
def virtualized(self):
=== modified file 'lib/lp/code/model/tests/test_recipebuilder.py'
--- lib/lp/code/model/tests/test_recipebuilder.py 2013-09-18 06:38:31 +0000
+++ lib/lp/code/model/tests/test_recipebuilder.py 2013-09-23 02:43:48 +0000
@@ -9,6 +9,8 @@
import tempfile
from textwrap import dedent
+from zope.component import getUtility
+
from testtools import run_test_with
from testtools.deferredruntest import (
assert_fails_with,
@@ -47,7 +49,7 @@
from lp.soyuz.adapters.archivedependencies import (
get_sources_list_for_building,
)
-from lp.soyuz.model.processor import ProcessorFamilySet
+from lp.soyuz.interfaces.processor import IProcessorSet
from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
from lp.testing import (
person_logged_in,
@@ -69,9 +71,9 @@
distro = self.factory.makeDistribution(name="distro")
distroseries = self.factory.makeDistroSeries(name="mydistro",
distribution=distro)
- processorfamily = ProcessorFamilySet().getByProcessorName('386')
+ processor = getUtility(IProcessorSet).getByName('386')
distroseries.newArch(
- 'i386', processorfamily, True, self.factory.makePerson())
+ 'i386', processor, True, self.factory.makePerson())
sourcepackage = self.factory.makeSourcePackage(spn, distroseries)
if recipe_registrant is None:
recipe_registrant = self.factory.makePerson(
@@ -302,8 +304,7 @@
test_publisher.addFakeChroots(job.build.distroseries)
slave = OkSlave()
builder = MockBuilder("bob-de-bouwer")
- processorfamily = ProcessorFamilySet().getByProcessorName('386')
- builder.processor = processorfamily.processors[0]
+ builder.processor = getUtility(IProcessorSet).getByName('386')
job.setBuilder(builder, slave)
logger = BufferLogger()
d = defer.maybeDeferred(job.dispatchBuildToSlave, "someid", logger)
@@ -333,8 +334,7 @@
job = self.makeJob()
#test_publisher = SoyuzTestPublisher()
builder = MockBuilder("bob-de-bouwer")
- processorfamily = ProcessorFamilySet().getByProcessorName('386')
- builder.processor = processorfamily.processors[0]
+ builder.processor = getUtility(IProcessorSet).getByName('386')
job.setBuilder(builder, OkSlave())
logger = BufferLogger()
d = defer.maybeDeferred(job.dispatchBuildToSlave, "someid", logger)
=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipebuild.py'
--- lib/lp/code/model/tests/test_sourcepackagerecipebuild.py 2013-09-02 08:11:58 +0000
+++ lib/lp/code/model/tests/test_sourcepackagerecipebuild.py 2013-09-23 02:43:48 +0000
@@ -37,7 +37,7 @@
from lp.services.log.logger import BufferLogger
from lp.services.mail.sendmail import format_address
from lp.services.webapp.authorization import check_permission
-from lp.soyuz.model.processor import ProcessorFamily
+from lp.soyuz.interfaces.processor import IProcessorSet
from lp.testing import (
ANONYMOUS,
login,
@@ -62,7 +62,7 @@
person = self.factory.makePerson()
distroseries = self.factory.makeDistroSeries()
distroseries_i386 = distroseries.newArch(
- 'i386', ProcessorFamily.get(1), False, person,
+ 'i386', getUtility(IProcessorSet).getByName('386'), False, person,
supports_virtualized=True)
removeSecurityProxy(distroseries).nominatedarchindep = (
distroseries_i386)
@@ -110,8 +110,7 @@
# They do require specific environments.
self.assertNotEqual(None, bq.processor)
self.assertEqual(
- spb.distroseries.nominatedarchindep.default_processor,
- bq.processor)
+ spb.distroseries.nominatedarchindep.processor, bq.processor)
self.assertEqual(bq, spb.buildqueue_record)
def test_title(self):
=== modified file 'lib/lp/hardwaredb/doc/hwdb.txt'
--- lib/lp/hardwaredb/doc/hwdb.txt 2012-04-10 14:01:17 +0000
+++ lib/lp/hardwaredb/doc/hwdb.txt 2013-09-23 02:43:48 +0000
@@ -717,11 +717,11 @@
It is also possible to search for a distroseries and architecture.
- >>> from lp.soyuz.interfaces.processor import IProcessorFamilySet
- >>> amd64 = getUtility(IProcessorFamilySet).getByName('amd64')
+ >>> from lp.soyuz.interfaces.processor import IProcessorSet
+ >>> amd64 = getUtility(IProcessorSet).getByName('amd64')
>>> warty_amd64 = factory.makeDistroArchSeries(
... distroseries=warty, architecturetag='amd64',
- ... processorfamily=amd64)
+ ... processor=amd64)
>>> submission = factory.makeHWSubmission(distroarchseries=warty_amd64)
>>> for submission in hw_submission_set.search(distroseries=warty, architecture='amd64'):
... print '%s %s ' % (
=== modified file 'lib/lp/registry/browser/distribution.py'
--- lib/lp/registry/browser/distribution.py 2013-08-01 14:43:03 +0000
+++ lib/lp/registry/browser/distribution.py 2013-09-23 02:43:48 +0000
@@ -132,11 +132,11 @@
from lp.services.webapp.batching import BatchNavigator
from lp.services.webapp.breadcrumb import Breadcrumb
from lp.services.webapp.interfaces import ILaunchBag
-from lp.soyuz.browser.archive import EnableRestrictedFamiliesMixin
+from lp.soyuz.browser.archive import EnableRestrictedProcessorsMixin
from lp.soyuz.browser.packagesearch import PackageSearchViewBase
from lp.soyuz.enums import ArchivePurpose
from lp.soyuz.interfaces.archive import IArchiveSet
-from lp.soyuz.interfaces.processor import IProcessorFamilySet
+from lp.soyuz.interfaces.processor import IProcessorSet
class DistributionNavigation(
@@ -844,9 +844,8 @@
archive.require_virtualized = require_virtualized
-class DistributionAddView(LaunchpadFormView,
- RequireVirtualizedBuildersMixin,
- EnableRestrictedFamiliesMixin):
+class DistributionAddView(LaunchpadFormView, RequireVirtualizedBuildersMixin,
+ EnableRestrictedProcessorsMixin):
schema = IDistribution
label = "Register a new distribution"
@@ -864,7 +863,7 @@
"answers_usage",
]
custom_widget('require_virtualized', CheckBoxWidget)
- custom_widget('enabled_restricted_families', LabeledMultiCheckBoxWidget)
+ custom_widget('enabled_restricted_processors', LabeledMultiCheckBoxWidget)
@property
def page_title(self):
@@ -873,10 +872,9 @@
@property
def initial_values(self):
- proc_family_set = getUtility(IProcessorFamilySet)
- restricted_families = set(proc_family_set.getRestricted())
+ restricted_processors = getUtility(IProcessorSet).getRestricted()
return {
- 'enabled_restricted_families': restricted_families,
+ 'enabled_restricted_processors': restricted_processors,
'require_virtualized': False,
}
@@ -889,9 +887,9 @@
"""See `LaunchpadFormView`."""
LaunchpadFormView.setUpFields(self)
self.form_fields += self.createRequireVirtualized()
- self.form_fields += self.createEnabledRestrictedFamilies(
- u'The restricted architecture families on which the '
- "distribution's main archive can build.")
+ self.form_fields += self.createEnabledRestrictedProcessors(
+ u"The restricted architectures on which the distribution's main "
+ "archive can build.")
@action("Save", name='save')
def save_action(self, action, data):
@@ -909,8 +907,8 @@
archive = distribution.main_archive
self.updateRequireVirtualized(data['require_virtualized'], archive)
if archive.require_virtualized is True:
- archive.enabled_restricted_families = (
- data['enabled_restricted_families'])
+ archive.enabled_restricted_processors = data[
+ 'enabled_restricted_processors']
notify(ObjectCreatedEvent(distribution))
self.next_url = canonical_url(distribution)
@@ -918,7 +916,7 @@
class DistributionEditView(RegistryEditFormView,
RequireVirtualizedBuildersMixin,
- EnableRestrictedFamiliesMixin):
+ EnableRestrictedProcessorsMixin):
schema = IDistribution
field_names = [
@@ -944,7 +942,7 @@
custom_widget('logo', ImageChangeWidget, ImageChangeWidget.EDIT_STYLE)
custom_widget('mugshot', ImageChangeWidget, ImageChangeWidget.EDIT_STYLE)
custom_widget('require_virtualized', CheckBoxWidget)
- custom_widget('enabled_restricted_families', LabeledMultiCheckBoxWidget)
+ custom_widget('enabled_restricted_processors', LabeledMultiCheckBoxWidget)
@property
def label(self):
@@ -955,17 +953,17 @@
"""See `LaunchpadFormView`."""
RegistryEditFormView.setUpFields(self)
self.form_fields += self.createRequireVirtualized()
- self.form_fields += self.createEnabledRestrictedFamilies(
- u'The restricted architecture families on which the '
- "distribution's main archive can build.")
+ self.form_fields += self.createEnabledRestrictedProcessors(
+ u"The restricted architectures on which the distribution's main "
+ "archive can build.")
@property
def initial_values(self):
return {
'require_virtualized':
self.context.main_archive.require_virtualized,
- 'enabled_restricted_families':
- self.context.main_archive.enabled_restricted_families,
+ 'enabled_restricted_processors':
+ self.context.main_archive.enabled_restricted_processors,
}
def validate(self, data):
@@ -984,14 +982,14 @@
self.updateRequireVirtualized(
new_require_virtualized, self.context.main_archive)
del(data['require_virtualized'])
- new_enabled_restricted_families = data.get(
- 'enabled_restricted_families')
- if new_enabled_restricted_families is not None:
- if (set(self.context.main_archive.enabled_restricted_families) !=
- set(new_enabled_restricted_families)):
- self.context.main_archive.enabled_restricted_families = (
- new_enabled_restricted_families)
- del(data['enabled_restricted_families'])
+ new_enabled_restricted_processors = data.get(
+ 'enabled_restricted_processors')
+ if new_enabled_restricted_processors is not None:
+ if (set(self.context.main_archive.enabled_restricted_processors) !=
+ set(new_enabled_restricted_processors)):
+ self.context.main_archive.enabled_restricted_processors = (
+ new_enabled_restricted_processors)
+ del(data['enabled_restricted_processors'])
@action("Change", name='change')
def change_action(self, action, data):
=== modified file 'lib/lp/registry/browser/tests/distribution-views.txt'
--- lib/lp/registry/browser/tests/distribution-views.txt 2012-06-11 00:03:25 +0000
+++ lib/lp/registry/browser/tests/distribution-views.txt 2013-09-23 02:43:48 +0000
@@ -80,7 +80,7 @@
... 'field.domainname': 'youbuntu.me',
... 'field.members': 'landscape-developers',
... 'field.require_virtualized': 'on',
- ... 'field.enabled_restricted_families': [],
+ ... 'field.enabled_restricted_processors': [],
... 'field.actions.save': 'Save',
... }
>>> view = create_initialized_view(distributionset, '+add', form=form)
=== modified file 'lib/lp/registry/browser/tests/test_distribution_views.py'
--- lib/lp/registry/browser/tests/test_distribution_views.py 2013-09-12 02:29:55 +0000
+++ lib/lp/registry/browser/tests/test_distribution_views.py 2013-09-23 02:43:48 +0000
@@ -10,7 +10,7 @@
from lp.registry.browser.distribution import DistributionPublisherConfigView
from lp.registry.interfaces.distribution import IDistributionSet
from lp.services.webapp.servers import LaunchpadTestRequest
-from lp.soyuz.interfaces.processor import IProcessorFamilySet
+from lp.soyuz.interfaces.processor import IProcessorSet
from lp.testing import (
login,
login_celebrity,
@@ -105,8 +105,7 @@
self.simple_user = self.factory.makePerson()
self.admin = login_celebrity('admin')
self.distributionset = getUtility(IDistributionSet)
- proc_family_set = getUtility(IProcessorFamilySet)
- self.restricted_families = proc_family_set.getRestricted()
+ self.restricted_processors = getUtility(IProcessorSet).getRestricted()
def getDefaultAddDict(self):
return {
@@ -118,8 +117,8 @@
'field.domainname': 'newbuntu',
'field.members': self.simple_user.name,
'field.require_virtualized': '',
- 'field.enabled_restricted_families': [family.name
- for family in self.restricted_families],
+ 'field.enabled_restricted_processors': [processor.name
+ for processor in self.restricted_processors],
'field.actions.save': 'Save',
}
@@ -142,16 +141,16 @@
widget = view.widgets['require_virtualized']
self.assertEqual(False, widget._getCurrentValue())
- def test_add_distro_init_value_enabled_restricted_families(self):
+ def test_add_distro_init_value_enabled_restricted_processors(self):
view = create_initialized_view(
self.distributionset, '+add', principal=self.admin,
method='GET')
- widget = view.widgets['enabled_restricted_families']
- self.assertContentEqual(
- self.restricted_families, widget._getCurrentValue())
- self.assertContentEqual(
- self.restricted_families,
+ widget = view.widgets['enabled_restricted_processors']
+ self.assertContentEqual(
+ self.restricted_processors, widget._getCurrentValue())
+ self.assertContentEqual(
+ self.restricted_processors,
[item.value for item in widget.vocabulary])
def test_add_distro_require_virtualized(self):
@@ -166,16 +165,16 @@
False,
distribution.main_archive.require_virtualized)
- def test_add_distro_enabled_restricted_families(self):
+ def test_add_distro_enabled_restricted_processors(self):
creation_form = self.getDefaultAddDict()
- creation_form['field.enabled_restricted_families'] = []
+ creation_form['field.enabled_restricted_processors'] = []
create_initialized_view(
self.distributionset, '+add', principal=self.admin,
method='POST', form=creation_form)
distribution = self.distributionset.getByName('newbuntu')
self.assertContentEqual(
- [], distribution.main_archive.enabled_restricted_families)
+ [], distribution.main_archive.enabled_restricted_processors)
class TestDistroEditView(TestCaseWithFactory):
@@ -187,11 +186,7 @@
super(TestDistroEditView, self).setUp()
self.admin = login_celebrity('admin')
self.distribution = self.factory.makeDistribution()
- proc_family_set = getUtility(IProcessorFamilySet)
- self.restricted_families = proc_family_set.getRestricted()
- for family in self.restricted_families:
- if family.processors.is_empty():
- self.factory.makeProcessor(family=family)
+ self.restricted_processors = getUtility(IProcessorSet).getRestricted()
def test_edit_distro_init_value_require_virtualized(self):
view = create_initialized_view(
@@ -203,18 +198,18 @@
self.distribution.main_archive.require_virtualized,
widget._getCurrentValue())
- def test_edit_distro_init_value_enabled_restricted_families(self):
- self.distribution.main_archive.enabled_restricted_families = (
- self.restricted_families)
+ def test_edit_distro_init_value_enabled_restricted_processors(self):
+ self.distribution.main_archive.enabled_restricted_processors = (
+ self.restricted_processors)
view = create_initialized_view(
self.distribution, '+edit', principal=self.admin,
method='GET')
- widget = view.widgets['enabled_restricted_families']
- self.assertContentEqual(
- self.restricted_families, widget._getCurrentValue())
- self.assertContentEqual(
- self.restricted_families,
+ widget = view.widgets['enabled_restricted_processors']
+ self.assertContentEqual(
+ self.restricted_processors, widget._getCurrentValue())
+ self.assertContentEqual(
+ self.restricted_processors,
[item.value for item in widget.vocabulary])
def getDefaultEditDict(self):
@@ -224,8 +219,8 @@
'field.summary': 'newbuntu',
'field.description': 'newbuntu',
'field.require_virtualized.used': u'',
- 'field.enabled_restricted_families': [family.name
- for family in self.restricted_families],
+ 'field.enabled_restricted_processors': [processor.name
+ for processor in self.restricted_processors],
'field.actions.change': 'Change',
}
@@ -241,18 +236,18 @@
True,
self.distribution.main_archive.require_virtualized)
- def test_change_enabled_restricted_families(self):
+ def test_change_enabled_restricted_processors(self):
edit_form = self.getDefaultEditDict()
- edit_form['field.enabled_restricted_families'] = []
+ edit_form['field.enabled_restricted_processors'] = []
- self.distribution.main_archive.enabled_restricted_families = (
- self.restricted_families)
+ self.distribution.main_archive.enabled_restricted_processors = (
+ self.restricted_processors)
create_initialized_view(
self.distribution, '+edit', principal=self.admin,
method='POST', form=edit_form)
self.assertContentEqual(
- [], self.distribution.main_archive.enabled_restricted_families)
+ [], self.distribution.main_archive.enabled_restricted_processors)
def test_package_derivatives_email(self):
# Test that the edit form allows changing package_derivatives_email
=== modified file 'lib/lp/registry/doc/distroseries.txt'
--- lib/lp/registry/doc/distroseries.txt 2013-08-01 14:09:45 +0000
+++ lib/lp/registry/doc/distroseries.txt 2013-09-23 02:43:48 +0000
@@ -385,9 +385,9 @@
>>> for bin in bumpy_firefox_sp.currentrelease.binaries:
... print bin.id, bin.title, bin.build.distro_arch_series.title
- 27 mozilla-firefox-data-0.9 The Warty Warthog Release for i386 (x86)
+ 27 mozilla-firefox-data-0.9 The Warty Warthog Release for i386 (386)
26 mozilla-firefox-0.9 The Warty Warthog Release for hppa (hppa)
- 12 mozilla-firefox-0.9 The Warty Warthog Release for i386 (x86)
+ 12 mozilla-firefox-0.9 The Warty Warthog Release for i386 (386)
'builds' should be empty since it was built in parent (warty), not in this
=== modified file 'lib/lp/registry/interfaces/distroseries.py'
--- lib/lp/registry/interfaces/distroseries.py 2013-08-01 14:09:45 +0000
+++ lib/lp/registry/interfaces/distroseries.py 2013-09-23 02:43:48 +0000
@@ -767,7 +767,7 @@
:return: A new `PackageUpload`.
"""
- def newArch(architecturetag, processorfamily, official, owner,
+ def newArch(architecturetag, processor, official, owner,
supports_virtualized=False, enabled=True):
"""Create a new port or DistroArchSeries for this DistroSeries."""
=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py 2013-09-10 05:00:15 +0000
+++ lib/lp/registry/model/distroseries.py 2013-09-23 02:43:48 +0000
@@ -349,24 +349,18 @@
def getDistroArchSeriesByProcessor(self, processor):
"""See `IDistroSeries`."""
- # XXX: JRV 2010-01-14: This should ideally use storm to find the
- # distroarchseries rather than iterating over all of them, but
- # I couldn't figure out how to do that - and a trivial for loop
- # isn't expensive given there's generally less than a dozen
- # architectures.
- for architecture in self.architectures:
- if architecture.processorfamily == processor.family:
- return architecture
- return None
+ return Store.of(self).find(
+ DistroArchSeries,
+ DistroArchSeries.distroseriesID == self.id,
+ DistroArchSeries.processor_id == processor.id).one()
@property
def enabled_architectures(self):
- store = Store.of(self)
- results = store.find(
+ return Store.of(self).find(
DistroArchSeries,
DistroArchSeries.distroseries == self,
- DistroArchSeries.enabled == True)
- return results.order_by(DistroArchSeries.architecturetag)
+ DistroArchSeries.enabled == True).order_by(
+ DistroArchSeries.architecturetag)
@property
def buildable_architectures(self):
@@ -1109,13 +1103,12 @@
# results will only see DSBPs
return DecoratedResultSet(package_caches, result_to_dsbp)
- def newArch(self, architecturetag, processorfamily, official, owner,
+ def newArch(self, architecturetag, processor, official, owner,
supports_virtualized=False, enabled=True):
"""See `IDistroSeries`."""
distroarchseries = DistroArchSeries(
- architecturetag=architecturetag, processorfamily=processorfamily,
- processor=processorfamily.processors[0], official=official,
- distroseries=self, owner=owner,
+ architecturetag=architecturetag, processor=processor,
+ official=official, distroseries=self, owner=owner,
supports_virtualized=supports_virtualized, enabled=enabled)
return distroarchseries
=== modified file 'lib/lp/registry/stories/distribution/xx-distribution-launchpad-usage.txt'
--- lib/lp/registry/stories/distribution/xx-distribution-launchpad-usage.txt 2012-09-21 15:09:45 +0000
+++ lib/lp/registry/stories/distribution/xx-distribution-launchpad-usage.txt 2013-09-23 02:43:48 +0000
@@ -21,6 +21,12 @@
...
Unauthorized...
+Create a restricted processor.
+
+ >>> login('admin@xxxxxxxxxxxxx')
+ >>> ign = factory.makeProcessor(name='arm', restricted=True)
+ >>> logout()
+
The distribution's registrant can access the page and change the usage.
>>> registrant = setupBrowser(
@@ -42,7 +48,7 @@
>>> print registrant.getControl(name='field.require_virtualized').value
False
>>> print registrant.getControl(
- ... name='field.enabled_restricted_families').value
+ ... name='field.enabled_restricted_processors').value
[]
>>> registrant.getControl(name='field.translations_usage').value = [
=== modified file 'lib/lp/registry/tests/test_distroseries.py'
--- lib/lp/registry/tests/test_distroseries.py 2013-08-23 05:36:46 +0000
+++ lib/lp/registry/tests/test_distroseries.py 2013-09-23 02:43:48 +0000
@@ -34,7 +34,6 @@
IDistroSeriesSourcePackageRelease,
)
from lp.soyuz.interfaces.publishing import active_publishing_status
-from lp.soyuz.model.processor import ProcessorFamilySet
from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
from lp.testing import (
ANONYMOUS,
@@ -206,24 +205,23 @@
self.assertEqual(suite, distroseries.getSuite(pocket))
def test_getDistroArchSeriesByProcessor(self):
- # A IDistroArchSeries can be retrieved by processor
+ # A IDistroArchSeries can be retrieved by processor.
distroseries = self.factory.makeDistroSeries()
- processorfamily = ProcessorFamilySet().getByName('x86')
+ processor = self.factory.makeProcessor()
distroarchseries = self.factory.makeDistroArchSeries(
distroseries=distroseries, architecturetag='i386',
- processorfamily=processorfamily)
- self.assertEquals(distroarchseries,
- distroseries.getDistroArchSeriesByProcessor(
- processorfamily.processors[0]))
+ processor=processor)
+ self.assertEquals(
+ distroarchseries,
+ distroseries.getDistroArchSeriesByProcessor(processor))
def test_getDistroArchSeriesByProcessor_none(self):
# getDistroArchSeriesByProcessor returns None when no distroarchseries
# is found
distroseries = self.factory.makeDistroSeries()
- processorfamily = ProcessorFamilySet().getByName('x86')
- self.assertIs(None,
- distroseries.getDistroArchSeriesByProcessor(
- processorfamily.processors[0]))
+ processor = self.factory.makeProcessor()
+ self.assertIs(
+ None, distroseries.getDistroArchSeriesByProcessor(processor))
def test_getDerivedSeries(self):
dsp = self.factory.makeDistroSeriesParent()
=== modified file 'lib/lp/services/webservice/wadl-to-refhtml.xsl'
--- lib/lp/services/webservice/wadl-to-refhtml.xsl 2011-11-16 22:40:16 +0000
+++ lib/lp/services/webservice/wadl-to-refhtml.xsl 2013-09-23 02:43:48 +0000
@@ -399,10 +399,6 @@
<xsl:text>/+processors/</xsl:text>
<var><processor.name></var>
</xsl:when>
- <xsl:when test="@id = 'processor_family'">
- <xsl:text>/+processor-families/</xsl:text>
- <var><processor_family.name></var>
- </xsl:when>
<xsl:when test="@id = 'product_release'">
<xsl:text>/</xsl:text>
<var><product.name></var>
=== modified file 'lib/lp/soyuz/adapters/tests/test_buildarch.py'
--- lib/lp/soyuz/adapters/tests/test_buildarch.py 2013-05-31 04:27:26 +0000
+++ lib/lp/soyuz/adapters/tests/test_buildarch.py 2013-09-23 02:43:48 +0000
@@ -1,8 +1,9 @@
# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+__metaclass__ = type
+
from lp.soyuz.adapters.buildarch import determine_architectures_to_build
-from lp.soyuz.model.processor import ProcessorFamily
from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
from lp.testing import TestCaseWithFactory
from lp.testing.layers import LaunchpadZopelessLayer
@@ -18,11 +19,9 @@
super(TestDetermineArchitecturesToBuild, self).setUp()
self.publisher = SoyuzTestPublisher()
self.publisher.prepareBreezyAutotest()
- armel_family = ProcessorFamily.get(5)
- if not armel_family.processors:
- armel_family.addProcessor('armel', 'armel', 'armel')
+ armel = self.factory.makeProcessor('armel', 'armel', 'armel')
self.publisher.breezy_autotest.newArch(
- 'armel', armel_family, False, self.publisher.person)
+ 'armel', armel, False, self.publisher.person)
self.publisher.addFakeChroots()
def assertArchitecturesToBuild(self, expected_arch_tags, pub,
=== modified file 'lib/lp/soyuz/browser/archive.py'
--- lib/lp/soyuz/browser/archive.py 2013-05-24 01:28:22 +0000
+++ lib/lp/soyuz/browser/archive.py 2013-09-23 02:43:48 +0000
@@ -22,7 +22,7 @@
'ArchivePackagesView',
'ArchiveView',
'ArchiveViewBase',
- 'EnableRestrictedFamiliesMixin',
+ 'EnableRestrictedProcessorsMixin',
'make_archive_vocabulary',
'PackageCopyingMixin',
'traverse_named_ppa',
@@ -148,7 +148,7 @@
from lp.soyuz.interfaces.packagecopyjob import IPlainPackageCopyJobSource
from lp.soyuz.interfaces.packagecopyrequest import IPackageCopyRequestSet
from lp.soyuz.interfaces.packageset import IPackagesetSet
-from lp.soyuz.interfaces.processor import IProcessorFamilySet
+from lp.soyuz.interfaces.processor import IProcessorSet
from lp.soyuz.interfaces.publishing import (
active_publishing_status,
inactive_publishing_status,
@@ -2005,16 +2005,16 @@
return 'Edit %s' % self.context.displayname
-class EnableRestrictedFamiliesMixin:
- """A mixin that provides enabled_restricted_families field support"""
+class EnableRestrictedProcessorsMixin:
+ """A mixin that provides enabled_restricted_processors field support"""
- def createEnabledRestrictedFamilies(self, description=None):
- """Creates the 'enabled_restricted_families' field."""
+ def createEnabledRestrictedProcessors(self, description=None):
+ """Creates the 'enabled_restricted_processors' field."""
terms = []
- for family in getUtility(IProcessorFamilySet).getRestricted():
+ for processor in getUtility(IProcessorSet).getRestricted():
terms.append(SimpleTerm(
- family, token=family.name, title=family.title))
- old_field = IArchive['enabled_restricted_families']
+ processor, token=processor.name, title=processor.title))
+ old_field = IArchive['enabled_restricted_processors']
return form.Fields(
List(__name__=old_field.__name__,
title=old_field.title,
@@ -2025,7 +2025,7 @@
render_context=self.render_context)
-class ArchiveAdminView(BaseArchiveEditView, EnableRestrictedFamiliesMixin):
+class ArchiveAdminView(BaseArchiveEditView, EnableRestrictedProcessorsMixin):
field_names = [
'enabled',
@@ -2040,7 +2040,7 @@
'external_dependencies',
]
custom_widget('external_dependencies', TextAreaWidget, height=3)
- custom_widget('enabled_restricted_families', LabeledMultiCheckBoxWidget)
+ custom_widget('enabled_restricted_processors', LabeledMultiCheckBoxWidget)
page_title = 'Administer'
@property
@@ -2084,17 +2084,17 @@
@property
def initial_values(self):
return {
- 'enabled_restricted_families':
- self.context.enabled_restricted_families,
+ 'enabled_restricted_processors':
+ self.context.enabled_restricted_processors,
}
def setUpFields(self):
"""Override `LaunchpadEditFormView`.
- See `createEnabledRestrictedFamilies` method.
+ See `createEnabledRestrictedProcessors` method.
"""
super(ArchiveAdminView, self).setUpFields()
- self.form_fields += self.createEnabledRestrictedFamilies()
+ self.form_fields += self.createEnabledRestrictedProcessors()
class ArchiveDeleteView(LaunchpadFormView):
=== modified file 'lib/lp/soyuz/browser/configure.zcml'
--- lib/lp/soyuz/browser/configure.zcml 2013-05-10 05:30:11 +0000
+++ lib/lp/soyuz/browser/configure.zcml 2013-09-23 02:43:48 +0000
@@ -37,13 +37,6 @@
path_expression="string:+binarypub"
attribute_to_parent="archive"
urldata="lp.soyuz.browser.publishing.BinaryPublicationURL"/>
- <browser:url for="lp.soyuz.interfaces.processor.IProcessorFamilySet"
- path_expression="string:+processor-families"
- parent_utility="lp.services.webapp.interfaces.ILaunchpadRoot"/>
- <browser:url
- for="lp.soyuz.interfaces.processor.IProcessorFamily"
- path_expression="string:${name}"
- parent_utility="lp.soyuz.interfaces.processor.IProcessorFamilySet" />
<browser:url for="lp.soyuz.interfaces.processor.IProcessorSet"
path_expression="string:+processors"
parent_utility="lp.services.webapp.interfaces.ILaunchpadRoot"/>
@@ -232,7 +225,7 @@
classes="ArchiveNavigation" />
<browser:navigation
module="lp.soyuz.browser.processor"
- classes="ProcessorFamilySetNavigation ProcessorSetNavigation"/>
+ classes="ProcessorSetNavigation" />
<browser:url
for="lp.soyuz.interfaces.archive.IPPA"
path_expression="string:+archive"
=== modified file 'lib/lp/soyuz/browser/distroarchseries.py'
--- lib/lp/soyuz/browser/distroarchseries.py 2012-01-05 20:11:40 +0000
+++ lib/lp/soyuz/browser/distroarchseries.py 2013-09-23 02:43:48 +0000
@@ -93,8 +93,8 @@
class DistroArchSeriesAddView(LaunchpadFormView):
schema = IDistroArchSeries
- field_names = ['architecturetag', 'processorfamily', 'official',
- 'supports_virtualized']
+ field_names = [
+ 'architecturetag', 'processor', 'official', 'supports_virtualized']
@property
def label(self):
@@ -115,7 +115,7 @@
def create_action(self, action, data):
"""Create a new Port."""
distroarchseries = self.context.newArch(
- data['architecturetag'], data['processorfamily'],
+ data['architecturetag'], data['processor'],
data['official'], self.user, data['supports_virtualized'])
self.next_url = canonical_url(distroarchseries)
=== modified file 'lib/lp/soyuz/browser/processor.py'
--- lib/lp/soyuz/browser/processor.py 2012-01-01 02:58:52 +0000
+++ lib/lp/soyuz/browser/processor.py 2013-09-23 02:43:48 +0000
@@ -3,37 +3,19 @@
"""Navigation views for processors."""
-
__metaclass__ = type
__all__ = [
- 'ProcessorFamilySetNavigation',
'ProcessorSetNavigation',
]
-from lp.app.errors import NotFoundError
from lp.services.webapp import Navigation
-from lp.soyuz.interfaces.processor import (
- IProcessorFamilySet,
- IProcessorSet,
- )
-
-
-class ProcessorFamilySetNavigation(Navigation):
- """IProcessorFamilySet navigation."""
- usedfor = IProcessorFamilySet
-
- def traverse(self, name):
- family = self.context.getByName(name)
- # Raise NotFoundError on invalid processor family name.
- if family is None:
- raise NotFoundError(name)
- return family
+from lp.soyuz.interfaces.processor import IProcessorSet
class ProcessorSetNavigation(Navigation):
- """IProcessorFamilySet navigation."""
+ """IProcessorSet navigation."""
usedfor = IProcessorSet
def traverse(self, name):
=== modified file 'lib/lp/soyuz/browser/tests/test_archive_webservice.py'
--- lib/lp/soyuz/browser/tests/test_archive_webservice.py 2013-09-13 07:07:51 +0000
+++ lib/lp/soyuz/browser/tests/test_archive_webservice.py 2013-09-23 02:43:48 +0000
@@ -25,7 +25,6 @@
)
from lp.soyuz.interfaces.component import IComponentSet
from lp.soyuz.interfaces.packagecopyjob import IPlainPackageCopyJobSource
-from lp.soyuz.interfaces.processor import IProcessorFamilySet
from lp.soyuz.model.archivepermission import ArchivePermission
from lp.testing import (
celebrity_logged_in,
@@ -224,11 +223,11 @@
self.assertContentEqual([], ws_archive.dependencies)
-class TestProcessorFamilies(WebServiceTestCase):
- """Test the enabled_restricted_families property and methods."""
+class TestProcessors(WebServiceTestCase):
+ """Test the enabled_restricted_processors property and methods."""
- def test_erfNotAvailableInBeta(self):
- """The enabled_restricted_families property is not in beta."""
+ def test_erpNotAvailableInBeta(self):
+ """The enabled_restricted_processors property is not in beta."""
self.ws_version = 'beta'
archive = self.factory.makeArchive()
commercial = getUtility(ILaunchpadCelebrities).commercial_admin
@@ -237,117 +236,80 @@
ws_archive = self.wsObject(archive, user=commercial_admin)
expected_re = (
"(.|\n)*object has no attribute "
- "'enabled_restricted_families'(.|\n)*")
+ "'enabled_restricted_processors'(.|\n)*")
with ExpectedException(AttributeError, expected_re):
- ws_archive.enabled_restricted_families
+ ws_archive.enabled_restricted_processors
- def test_erfAvailableInDevel(self):
- """The enabled_restricted_families property is in devel."""
+ def test_erpAvailableInDevel(self):
+ """The enabled_restricted_processors property is in devel."""
self.ws_version = 'devel'
archive = self.factory.makeArchive()
commercial = getUtility(ILaunchpadCelebrities).commercial_admin
commercial_admin = self.factory.makePerson(member_of=[commercial])
transaction.commit()
ws_archive = self.wsObject(archive, user=commercial_admin)
- self.assertContentEqual([], ws_archive.enabled_restricted_families)
self.assertContentEqual([], ws_archive.enabled_restricted_processors)
- def test_getByName(self):
- """The getByName method returns a processor family."""
- self.ws_version = 'devel'
- transaction.commit()
- arm = self.service.processor_families.getByName(name='arm')
- self.assertEqual(u'arm', arm.name)
- self.assertEqual(u'ARM Processors', arm.title)
- self.assertEqual(
- u'The ARM and compatible processors', arm.description)
- self.assertEqual(True, arm.restricted)
-
def test_processors(self):
"""Attributes about processors are available."""
self.ws_version = 'devel'
- product_family_set = getUtility(IProcessorFamilySet)
- ws_arm = self.service.processor_families.getByName(name='arm')
- self.assertContentEqual([], ws_arm.processors)
- product_family_set = getUtility(IProcessorFamilySet)
- arm = product_family_set.getByName('arm')
- arm.addProcessor('new-arm', 'New ARM Title', 'New ARM Description')
+ self.factory.makeProcessor(
+ 'new-arm', 'New ARM Title', 'New ARM Description')
transaction.commit()
- ws_proc = ws_arm.processors[0]
+ ws_proc = self.service.processors.getByName(name='new-arm')
self.assertEqual('new-arm', ws_proc.name)
self.assertEqual('New ARM Title', ws_proc.title)
self.assertEqual('New ARM Description', ws_proc.description)
- def test_enableRestrictedFamily(self):
- """A new family can be added to the enabled restricted set."""
- self.ws_version = 'devel'
- archive = self.factory.makeArchive()
- commercial = getUtility(ILaunchpadCelebrities).commercial_admin
- commercial_admin = self.factory.makePerson(member_of=[commercial])
- arm_family = getUtility(IProcessorFamilySet).getByName('arm')
- self.factory.makeProcessor(family=arm_family)
- transaction.commit()
- ws_arm = self.service.processor_families.getByName(name='arm')
- ws_archive = self.wsObject(archive, user=commercial_admin)
- self.assertContentEqual([], ws_archive.enabled_restricted_families)
- ws_archive.enableRestrictedFamily(family=ws_arm)
- self.assertContentEqual(
- [ws_arm], ws_archive.enabled_restricted_families)
-
def test_enableRestrictedProcessor(self):
+ """A new processor can be added to the enabled restricted set."""
self.ws_version = 'devel'
archive = self.factory.makeArchive()
+ self.factory.makeProcessor(name='arm', restricted=True)
commercial = getUtility(ILaunchpadCelebrities).commercial_admin
commercial_admin = self.factory.makePerson(member_of=[commercial])
- arm = getUtility(IProcessorFamilySet).getByName('arm')
- arm.addProcessor('new-arm', 'New ARM Title', 'New ARM Description')
transaction.commit()
- ws_arm = self.service.processors.getByName(name='new-arm')
+ ws_arm = self.service.processors.getByName(name='arm')
ws_archive = self.wsObject(archive, user=commercial_admin)
self.assertContentEqual([], ws_archive.enabled_restricted_processors)
ws_archive.enableRestrictedProcessor(processor=ws_arm)
self.assertContentEqual(
[ws_arm], ws_archive.enabled_restricted_processors)
- def test_enableRestrictedFamily_owner(self):
- """A new family can be added to the enabled restricted set.
+ def test_enableRestrictedProcessor_owner(self):
+ """A new processor can be added to the enabled restricted set.
An unauthorized user, even the archive owner, is not allowed.
"""
self.ws_version = 'devel'
archive = self.factory.makeArchive()
+ self.factory.makeProcessor(name='arm', restricted=True)
transaction.commit()
- ws_arm = self.service.processor_families.getByName(name='arm')
+ ws_arm = self.service.processors.getByName(name='arm')
ws_archive = self.wsObject(archive, user=archive.owner)
- self.assertContentEqual([], ws_archive.enabled_restricted_families)
+ self.assertContentEqual([], ws_archive.enabled_restricted_processors)
expected_re = (
"(.|\n)*'launchpad\.Admin'(.|\n)*")
with ExpectedException(LRUnauthorized, expected_re):
- ws_archive.enableRestrictedFamily(family=ws_arm)
+ ws_archive.enableRestrictedProcessor(processor=ws_arm)
- def test_enableRestrictedFamily_nonPrivUser(self):
- """A new family can be added to the enabled restricted set.
+ def test_enableRestrictedProcessor_nonPrivUser(self):
+ """A new processor can be added to the enabled restricted set.
An unauthorized user, some regular user, is not allowed.
"""
self.ws_version = 'devel'
archive = self.factory.makeArchive()
+ self.factory.makeProcessor(name='arm', restricted=True)
just_some_guy = self.factory.makePerson()
transaction.commit()
- ws_arm = self.service.processor_families.getByName(name='arm')
+ ws_arm = self.service.processors.getByName(name='arm')
ws_archive = self.wsObject(archive, user=just_some_guy)
- self.assertContentEqual([], ws_archive.enabled_restricted_families)
+ self.assertContentEqual([], ws_archive.enabled_restricted_processors)
expected_re = (
"(.|\n)*'launchpad\.Admin'(.|\n)*")
with ExpectedException(LRUnauthorized, expected_re):
- ws_archive.enableRestrictedFamily(family=ws_arm)
-
- def test_defaultCollection(self):
- """getRestricted will return all of the restricted families."""
- self.ws_version = 'devel'
- ws_arm = self.service.processor_families.getByName(name='arm')
- self.assertContentEqual(
- [ws_arm], self.service.processor_families)
+ ws_archive.enableRestrictedProcessor(processor=ws_arm)
class TestCopyPackage(WebServiceTestCase):
=== modified file 'lib/lp/soyuz/browser/tests/test_processor.py'
--- lib/lp/soyuz/browser/tests/test_processor.py 2012-01-01 02:58:52 +0000
+++ lib/lp/soyuz/browser/tests/test_processor.py 2013-09-23 02:43:48 +0000
@@ -14,28 +14,14 @@
class TestProcessorNavigation(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
- def test_processor_family_url(self):
- family = self.factory.makeProcessorFamily('quantum')
- self.assertEquals(
- '/+processor-families/quantum',
- canonical_url(family, force_local_path=True))
-
def test_processor_url(self):
- family = self.factory.makeProcessorFamily('quantum')
- quantum = family.processors[0]
+ quantum = self.factory.makeProcessor('quantum')
self.assertEquals(
'/+processors/quantum',
canonical_url(quantum, force_local_path=True))
- def test_processor_family_navigation(self):
- family = self.factory.makeProcessorFamily('quantum')
- obj, view, request = test_traverse(
- 'http://api.launchpad.dev/devel/+processor-families/quantum')
- self.assertEquals(family, obj)
-
def test_processor_navigation(self):
- family = self.factory.makeProcessorFamily('quantum')
+ quantum = self.factory.makeProcessor('quantum')
obj, view, request = test_traverse(
- 'http://api.launchpad.dev/'
- 'devel/+processors/quantum')
- self.assertEquals(family.processors[0], obj)
+ 'http://api.launchpad.dev/devel/+processors/quantum')
+ self.assertEquals(quantum, obj)
=== modified file 'lib/lp/soyuz/browser/tests/test_publishing.py'
--- lib/lp/soyuz/browser/tests/test_publishing.py 2012-01-01 02:58:52 +0000
+++ lib/lp/soyuz/browser/tests/test_publishing.py 2013-09-23 02:43:48 +0000
@@ -45,11 +45,10 @@
self.admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
# Create everything we need to create builds, such as a
# DistroArchSeries and a builder.
- self.pf = self.factory.makeProcessorFamily()
- pf_proc = self.pf.addProcessor(self.factory.getUniqueString(), '', '')
+ self.processor = self.factory.makeProcessor()
self.distroseries = self.factory.makeDistroSeries()
self.das = self.factory.makeDistroArchSeries(
- distroseries=self.distroseries, processorfamily=self.pf,
+ distroseries=self.distroseries, processor=self.processor,
supports_virtualized=True)
self.archive = self.factory.makeArchive(
distribution=self.distroseries.distribution)
@@ -58,7 +57,7 @@
self.publisher.prepareBreezyAutotest()
self.distroseries.nominatedarchindep = self.das
self.publisher.addFakeChroots(distroseries=self.distroseries)
- self.builder = self.factory.makeBuilder(processor=pf_proc)
+ self.builder = self.factory.makeBuilder(processor=self.processor)
def test_view_with_source_package_recipe(self):
# When a SourcePackageRelease is linked to a
=== modified file 'lib/lp/soyuz/configure.zcml'
--- lib/lp/soyuz/configure.zcml 2013-07-26 11:18:27 +0000
+++ lib/lp/soyuz/configure.zcml 2013-09-23 02:43:48 +0000
@@ -369,20 +369,6 @@
permission="zope.Public"
set_schema="lp.soyuz.interfaces.processor.IProcessor"/>
</class>
- <class
- class="lp.soyuz.model.processor.ProcessorFamily">
- <allow
- interface="lp.soyuz.interfaces.processor.IProcessorFamily"/>
- <require
- permission="zope.Public"
- set_schema="lp.soyuz.interfaces.processor.IProcessorFamily"/>
- </class>
- <securedutility
- class="lp.soyuz.model.processor.ProcessorFamilySet"
- provides="lp.soyuz.interfaces.processor.IProcessorFamilySet">
- <allow
- interface="lp.soyuz.interfaces.processor.IProcessorFamilySet"/>
- </securedutility>
<securedutility
class="lp.soyuz.model.processor.ProcessorSet"
provides="lp.soyuz.interfaces.processor.IProcessorSet">
@@ -428,7 +414,7 @@
permission="launchpad.Admin"
interface="lp.soyuz.interfaces.archive.IArchiveAdmin"
set_attributes="authorized_size build_debug_symbols
- buildd_secret enabled_restricted_families
+ buildd_secret enabled_restricted_processors
external_dependencies name
permit_obsolete_series_uploads
private publish_debug_symbols
=== modified file 'lib/lp/soyuz/doc/distroarchseries.txt'
--- lib/lp/soyuz/doc/distroarchseries.txt 2013-02-06 09:22:35 +0000
+++ lib/lp/soyuz/doc/distroarchseries.txt 2013-09-23 02:43:48 +0000
@@ -299,7 +299,7 @@
>>> print_architectures(warty.architectures)
The Warty Warthog Release for hppa (hppa)
- The Warty Warthog Release for i386 (x86) (official, ppa)
+ The Warty Warthog Release for i386 (386) (official, ppa)
DistroArchSeries for which we support PPA building can be obtained via
another distroseries method called 'virtualized_architectures'.
@@ -312,16 +312,16 @@
>>> expected_ppa_archs = [arch for arch in warty.architectures
... if arch.supports_virtualized is True]
>>> print_architectures(expected_ppa_archs)
- The Warty Warthog Release for i386 (x86) (official, ppa)
+ The Warty Warthog Release for i386 (386) (official, ppa)
>>> print_architectures(warty.virtualized_architectures)
- The Warty Warthog Release for i386 (x86) (official, ppa)
+ The Warty Warthog Release for i386 (386) (official, ppa)
Let's activate ppa support for hoary/hppa and check if
'virtualized_architectures' will include it this time.
>>> print_architectures(hoary.virtualized_architectures)
- The Hoary Hedgehog Release for i386 (x86) (official, ppa)
+ The Hoary Hedgehog Release for i386 (386) (official, ppa)
>>> from lp.services.database.sqlbase import flush_database_updates
>>> login('foo.bar@xxxxxxxxxxxxx')
@@ -331,7 +331,7 @@
>>> print_architectures(hoary.virtualized_architectures)
The Hoary Hedgehog Release for hppa (hppa) (ppa)
- The Hoary Hedgehog Release for i386 (x86) (official, ppa)
+ The Hoary Hedgehog Release for i386 (386) (official, ppa)
There is also `DistroSeries.buildable_architectures` which returns a
`ResultSet` containing only the `DistroArchSeries` with available
@@ -373,4 +373,4 @@
>>> print_architectures(hoary.buildable_architectures)
The Hoary Hedgehog Release for hppa (hppa) (ppa)
- The Hoary Hedgehog Release for i386 (x86) (official, ppa)
+ The Hoary Hedgehog Release for i386 (386) (official, ppa)
=== modified file 'lib/lp/soyuz/doc/distroseriesqueue-translations.txt'
--- lib/lp/soyuz/doc/distroseriesqueue-translations.txt 2013-07-23 18:49:13 +0000
+++ lib/lp/soyuz/doc/distroseriesqueue-translations.txt 2013-09-23 02:43:48 +0000
@@ -6,7 +6,7 @@
>>> from lp.registry.model.gpgkey import GPGKey
>>> from lp.soyuz.model.component import Component
- >>> from lp.soyuz.model.processor import ProcessorFamily
+ >>> from lp.soyuz.interfaces.processor import IProcessorSet
>>> from lp.soyuz.model.section import Section
>>> from lp.soyuz.model.publishing import (
... SourcePackagePublishingHistory)
@@ -47,7 +47,8 @@
... 'Dapper', 'Dapper', '06.04', hoary, hoary.owner)
# And an AMD 64 arch series.
- >>> dapper_amd64 = dapper.newArch('amd64', ProcessorFamily.get(3), True,
+ >>> dapper_amd64 = dapper.newArch(
+ ... 'amd64', getUtility(IProcessorSet).getByName('amd64'), True,
... dapper.owner)
Only uploads to the RELEASE, UPDATES, SECURITY and PROPOSED pockets are
=== modified file 'lib/lp/soyuz/doc/gina-multiple-arch.txt'
--- lib/lp/soyuz/doc/gina-multiple-arch.txt 2013-09-20 05:25:18 +0000
+++ lib/lp/soyuz/doc/gina-multiple-arch.txt 2013-09-23 02:43:48 +0000
@@ -28,7 +28,7 @@
Create a distribution series and an arch series for dapper:
>>> from lp.soyuz.model.distroarchseries import DistroArchSeries
- >>> from lp.soyuz.model.processor import ProcessorFamily
+ >>> from lp.soyuz.interfaces.processor import IProcessorSet
>>> from lp.app.interfaces.launchpad import ILaunchpadCelebrities
>>> celebs = getUtility(ILaunchpadCelebrities)
>>> ubuntu = celebs.ubuntu
@@ -44,31 +44,20 @@
Check it was properly created and create its DistroArchSeriess.
>>> from lp.registry.model.distroseries import DistroSeries
- >>> dapper = DistroSeries.selectOneBy(name="dapper",
- ... distributionID=ubuntu.id)
- >>> pf = ProcessorFamily.selectOneBy(name="x86")
- >>> if pf is None:
- ... pf = ProcessorFamily(name="x86", title="X86",
- ... description="Intel X86")
- >>> dar = dapper.newArch(
- ... processorfamily=pf, architecturetag="i386", official=True,
- ... owner=celebs.launchpad_developers)
- >>> pf = ProcessorFamily.selectOneBy(name="amd64")
- >>> if pf is None:
- ... pf = ProcessorFamily(name="amd64", title="AMD64",
- ... description="AMD 64")
- >>> dar = dapper.newArch(
- ... processorfamily=pf, architecturetag="amd64", official=True,
- ... owner=celebs.launchpad_developers)
- >>> pf = ProcessorFamily.selectOneBy(name="powerpc")
- >>> if pf is None:
- ... pf = ProcessorFamily(name="powerpc", title="PowerPC",
- ... description="PowerPC")
- >>> from lp.soyuz.model.processor import Processor
- >>> p = Processor(name="powerpc", title="PowerPC", family=pf,
- ... description="The little processor that could")
- >>> dar = dapper.newArch(
- ... processorfamily=pf, architecturetag="powerpc", official=True,
+ >>> dapper = DistroSeries.selectOneBy(
+ ... name="dapper", distributionID=ubuntu.id)
+ >>> processor = getUtility(IProcessorSet).getByName('386')
+ >>> dar = dapper.newArch(
+ ... processor=processor, architecturetag="i386", official=True,
+ ... owner=celebs.launchpad_developers)
+ >>> processor = getUtility(IProcessorSet).getByName('amd64')
+ >>> dar = dapper.newArch(
+ ... processor=processor, architecturetag="amd64", official=True,
+ ... owner=celebs.launchpad_developers)
+ >>> processor = getUtility(IProcessorSet).new(
+ ... 'powerpc', 'PowerPC', 'PowerPC')
+ >>> dar = dapper.newArch(
+ ... processor=processor, architecturetag="powerpc", official=True,
... owner=celebs.launchpad_developers)
>>> import transaction
>>> transaction.commit()
@@ -88,14 +77,6 @@
>>> path = os.path.join(os.getcwd(), relative_path)
>>> os.symlink(path, '/tmp/gina_test_archive')
-Set up the processor, commit and run her again. Note that
-dapper-updates/universe doesn't include the powerpc architecture, but we
-just warn it and move right ahead.
-
- >>> p == Processor.selectOneBy(familyID=pf.id)
- True
- >>> transaction.commit()
-
>>> gina_proc = [sys.executable, 'scripts/gina.py', '-q',
... 'dapper', 'dapper-updates']
>>> proc = subprocess.Popen(gina_proc, stderr=subprocess.PIPE)
@@ -210,9 +191,9 @@
Check that we publishing bdftopcf into the correct distroarchseries:
- >>> pf = ProcessorFamily.selectOneBy(name="x86")
+ >>> processor = getUtility(IProcessorSet).getByName('386')
>>> dar = DistroArchSeries.selectOneBy(distroseriesID=dapper.id,
- ... processorfamilyID=pf.id, architecturetag="i386",
+ ... processor_id=processor.id, architecturetag="i386",
... official=True, ownerID=celebs.launchpad_developers.id)
>>> print dar.architecturetag
i386
=== modified file 'lib/lp/soyuz/doc/gina.txt'
--- lib/lp/soyuz/doc/gina.txt 2013-09-20 05:25:18 +0000
+++ lib/lp/soyuz/doc/gina.txt 2013-09-23 02:43:48 +0000
@@ -35,7 +35,7 @@
Create a distribution release and an arch release for breezy:
- >>> from lp.soyuz.model.processor import ProcessorFamily
+ >>> from lp.soyuz.interfaces.processor import IProcessorSet
>>> from lp.app.interfaces.launchpad import ILaunchpadCelebrities
>>> celebs = getUtility(ILaunchpadCelebrities)
>>> ubuntu = celebs.ubuntu
@@ -49,9 +49,9 @@
... hoary, celebs.launchpad_developers)
>>> login(ANONYMOUS)
- >>> pf = ProcessorFamily.selectOneBy(name="x86")
>>> breezy_i386 = breezy.newArch(
- ... processorfamily=pf, architecturetag="i386", official=True,
+ ... processor=getUtility(IProcessorSet).getByName('386'),
+ ... architecturetag="i386", official=True,
... owner=celebs.launchpad_developers)
>>> import transaction
>>> transaction.commit()
@@ -402,8 +402,8 @@
386
>>> print ed.build.status
Successfully built
- >>> print ed.build.distro_arch_series.processorfamily.name
- x86
+ >>> print ed.build.distro_arch_series.processor.name
+ 386
>>> print ed.build.distro_arch_series.architecturetag
i386
>>> print ed.priority
@@ -724,9 +724,9 @@
in production, i.e., just creating 'lenny' should suffice for the
source-only import to happen.
- >>> pf = ProcessorFamily.selectOneBy(name="x86")
>>> lenny_i386 = lenny.newArch(
- ... processorfamily=pf, architecturetag="i386", official=True,
+ ... processor=getUtility(IProcessorSet).getByName('386'),
+ ... architecturetag="i386", official=True,
... owner=celebs.launchpad_developers)
We will also store the number of binaries already published in debian
=== removed file 'lib/lp/soyuz/doc/processor.txt'
--- lib/lp/soyuz/doc/processor.txt 2009-04-28 12:59:43 +0000
+++ lib/lp/soyuz/doc/processor.txt 1970-01-01 00:00:00 +0000
@@ -1,39 +0,0 @@
-The `IProcessorFamilySet` utility allows the look-up of ProcessorFamily
-instances by name.
-
- >>> from zope.component import getUtility
- >>> from lp.soyuz.interfaces.processor import (
- ... IProcessorFamilySet)
-
- >>> pfs = getUtility(IProcessorFamilySet)
-
-The attempt to access a non-existing processor family yields None.
-
- >>> print pfs.getByName('this-processor-family-does-not-exist')
- None
-
-Conversely, accessing an existing processor family yields the instance.
-
- >>> family = pfs.getByName('x86')
- >>> family.name
- u'x86'
- >>> family.title
- u'Intel 386 compatible chips'
- >>> family.description
- u'Bring back the 8086!'
-
-It is also possible to get the processor family for a given processor.
-
- >>> family = pfs.getByProcessorName('386')
- >>> family.name
- u'x86'
- >>> family.title
- u'Intel 386 compatible chips'
- >>> family.description
- u'Bring back the 8086!'
-
-In case where the user specifies a non-existent processor name the return
-value will be None.
-
- >>> print pfs.getByProcessorName('wintel')
- None
=== modified file 'lib/lp/soyuz/doc/soyuz-set-of-uploads.txt'
--- lib/lp/soyuz/doc/soyuz-set-of-uploads.txt 2013-05-01 18:39:38 +0000
+++ lib/lp/soyuz/doc/soyuz-set-of-uploads.txt 2013-09-23 02:43:48 +0000
@@ -514,13 +514,11 @@
will need to build a new DistroArchSeries for powerpc in
ubuntutest/breezy.
- >>> from lp.soyuz.model.processor import (
- ... ProcessorFamily, Processor)
- >>> powerpc_pf = ProcessorFamily.selectOneBy(name='powerpc')
- >>> powerpc_proc = Processor(family=powerpc_pf, name='powerpc',
- ... title='PowerPC G3/G4', description='G3/G4')
+ >>> from lp.soyuz.model.processor import Processor
+ >>> powerpc = Processor(
+ ... name='powerpc', title='PowerPC G3/G4', description='G3/G4')
>>> powerpc_dar = breezy.newArch(
- ... 'powerpc', powerpc_pf, True, breezy.owner)
+ ... 'powerpc', powerpc, True, breezy.owner)
After having the respective DistroArchSeries in place we will submit a
binary upload for the last source in BACKPORTS. The ancestry should be
=== modified file 'lib/lp/soyuz/interfaces/archive.py'
--- lib/lp/soyuz/interfaces/archive.py 2013-09-13 07:07:25 +0000
+++ lib/lp/soyuz/interfaces/archive.py 2013-09-23 02:43:48 +0000
@@ -590,14 +590,14 @@
"context build.\n"
"NOTE: This is for migration of OEM PPAs only!")))
- enabled_restricted_families = exported(
+ enabled_restricted_processors = exported(
CollectionField(
- title=_("Enabled restricted families"),
+ title=_("Enabled restricted processors"),
description=_(
- "The restricted architecture families on which the archive "
+ "The restricted architectures on which the archive "
"can build."),
value_type=Reference(schema=Interface),
- # Really IProcessorFamily.
+ # Really IProcessor.
readonly=True),
as_of='devel')
@@ -1973,15 +1973,15 @@
"""Archive interface for operations restricted by commercial."""
@operation_parameters(
- family=Reference(schema=Interface, required=True),
- # Really IProcessorFamily.
+ processor=Reference(schema=Interface, required=True),
+ # Really IProcessor.
)
@export_write_operation()
@operation_for_version('devel')
- def enableRestrictedFamily(family):
- """Add the processor family to the set of enabled restricted families.
+ def enableRestrictedProcessor(processor):
+ """Add the processor to the set of enabled restricted processors.
- :param family: is an `IProcessorFamily` object.
+ :param processor: is an `IProcessor` object.
"""
@operation_parameters(
=== modified file 'lib/lp/soyuz/interfaces/archivearch.py'
--- lib/lp/soyuz/interfaces/archivearch.py 2013-09-10 05:00:15 +0000
+++ lib/lp/soyuz/interfaces/archivearch.py 2013-09-23 02:43:48 +0000
@@ -16,14 +16,11 @@
from lp import _
from lp.soyuz.interfaces.archive import IArchive
-from lp.soyuz.interfaces.processor import (
- IProcessor,
- IProcessorFamily,
- )
+from lp.soyuz.interfaces.processor import IProcessor
class IArchiveArch(Interface):
- """An interface for archive/processor family associations."""
+ """An interface for archive/processor associations."""
id = Int(title=_('ID'), required=True, readonly=True)
@@ -31,51 +28,45 @@
title=_("Archive"), schema=IArchive,
required=True, readonly=True,
description=_(
- "The archive associated with the processor family at hand."))
-
- processorfamily = Reference(
- title=_("Processor family"), schema=IProcessorFamily,
- required=True, readonly=True,
- description=_(
- "The processorfamily associated with the archive at hand."))
+ "The archive associated with the processor at hand."))
processor = Reference(
title=_("Processor"), schema=IProcessor,
- required=False, readonly=True,
+ required=True, readonly=True,
description=_(
"The processor associated with the archive at hand."))
class IArchiveArchSet(Interface):
- """An interface for sets of archive/processor family associations."""
- def new(archive, processorfamily):
- """Create a new archive/processor family association.
+ """An interface for sets of archive/processor associations."""
+ def new(archive, processor):
+ """Create a new archive/processor association.
:param archive: the archive to be associated.
- :param processorfamily: the processor family to be associated.
+ :param processor: the processor to be associated.
:return: a newly created `IArchiveArch`.
"""
- def getByArchive(archive, processorfamily=None):
- """Return associations that match the archive and processor family.
+ def getByArchive(archive, processor=None):
+ """Return associations that match the archive and processor.
- If no processor family is passed, all associations for 'archive' will
+ If no processor is passed, all associations for 'archive' will
be returned.
:param archive: The associated archive.
- :param processorfamily: An optional processor family; if passed only
+ :param processor: An optional processor; if passed only
associations in which it participates will be considered.
:return: A (potentially empty) result set of `IArchiveArch` instances.
"""
- def getRestrictedFamilies(archive):
- """All restricted processor families, paired with `ArchiveArch`
+ def getRestrictedProcessors(archive):
+ """All restricted processor, paired with `ArchiveArch`
instances if associated with `archive`.
- :return: A sequence containing a (`ProcessorFamily`, `ArchiveArch`)
- 2-tuple for each processor family.
+ :return: A sequence containing a (`Processor`, `ArchiveArch`)
+ 2-tuple for each processor.
The second value in the tuple will be None if the given `archive`
- is not associated with the `ProcessorFamily` yet.
+ is not associated with the `Processor` yet.
"""
=== modified file 'lib/lp/soyuz/interfaces/distroarchseries.py'
--- lib/lp/soyuz/interfaces/distroarchseries.py 2013-09-10 05:00:15 +0000
+++ lib/lp/soyuz/interfaces/distroarchseries.py 2013-09-23 02:43:48 +0000
@@ -56,11 +56,8 @@
IDistroSeries,
title=_("The context distroseries"),
required=False, readonly=False))
- processorfamily = Choice(
- title=_("Processor Family"),
- required=True, vocabulary='ProcessorFamily')
processor = Choice(
- title=_("Processor"), required=False, vocabulary='Processor')
+ title=_("Processor"), required=True, vocabulary='Processor')
architecturetag = exported(
TextLine(
title=_("Architecture Tag"),
@@ -129,12 +126,6 @@
'True if this distroarchseries is the NominatedArchIndep '
'one.')),
exported_as="is_nominated_arch_indep")
- default_processor = Attribute(
- "Return the DistroArchSeries default processor, by picking the "
- "first processor inside its processorfamily.")
- processors = Attribute(
- "The group of Processors for this DistroArchSeries.processorfamily."
- )
main_archive = exported(
Reference(
Interface, # Really IArchive, circular import fixed below.
=== modified file 'lib/lp/soyuz/interfaces/packagecloner.py'
--- lib/lp/soyuz/interfaces/packagecloner.py 2013-01-07 02:40:55 +0000
+++ lib/lp/soyuz/interfaces/packagecloner.py 2013-09-23 02:43:48 +0000
@@ -16,7 +16,7 @@
"""Copies publishing history data across archives."""
def clonePackages(origin, destination, distroarchseries_list=None,
- proc_families=None, sourcepackagenames=None,
+ processors=None, sourcepackagenames=None,
always_create=False):
"""Copy packages from origin to destination.
@@ -27,8 +27,7 @@
:param destination: the location to which the data is to be copied.
:param distroarchseries_list: the binary packages will be copied
for the distroarchseries pairs specified (if any).
- :param proc_families: the processor families that builds will be
- created for.
+ :param processors: the processors that builds will be created for.
:param sourcepackagenames: the source packages which are to be
copied.
:param always_create: if builds should always be created.
=== modified file 'lib/lp/soyuz/interfaces/processor.py'
--- lib/lp/soyuz/interfaces/processor.py 2013-09-10 05:00:15 +0000
+++ lib/lp/soyuz/interfaces/processor.py 2013-09-23 02:43:48 +0000
@@ -7,8 +7,6 @@
__all__ = [
'IProcessor',
- 'IProcessorFamily',
- 'IProcessorFamilySet',
'IProcessorSet',
'ProcessorNotFound',
]
@@ -23,10 +21,6 @@
operation_parameters,
operation_returns_entry,
)
-from lazr.restful.fields import (
- CollectionField,
- Reference,
- )
from zope.interface import (
Attribute,
Interface,
@@ -57,14 +51,6 @@
# 'devel' as their version.
export_as_webservice_entry(publish_web_link=False, as_of='beta')
id = Attribute("The Processor ID")
- family = exported(
- Reference(
- schema=Interface,
- # Really IProcessorFamily.
- required=True, readonly=True,
- title=_("Processor Family"),
- description=_("The Processor Family Reference")),
- as_of='devel', readonly=True)
name = exported(
TextLine(title=_("Name"),
description=_("The Processor Name")),
@@ -82,56 +68,6 @@
as_of='devel', readonly=True)
-class IProcessorFamily(Interface):
- """The SQLObject ProcessorFamily Interface"""
-
- # XXX: BradCrittenden 2011-06-20 bug=760849: The following use of 'beta'
- # is a work-around to allow the WADL to be generated. It is a bald-faced
- # lie, though. The class is being exported in 'devel' but in order to get
- # the WADL generation work it must be back-dated to the earliest version.
- # Note that individual attributes and methods can and must truthfully set
- # 'devel' as their version.
- export_as_webservice_entry(
- plural_name='processor_families',
- publish_web_link=False,
- as_of='beta')
-
- id = Attribute("The ProcessorFamily ID")
- name = exported(
- TextLine(
- title=_("Name"),
- description=_("The Processor Family Name")),
- as_of='devel', readonly=True)
- title = exported(
- TextLine(
- title=_("Title"),
- description=_("The Processor Family Title")),
- as_of='devel', readonly=True)
- description = exported(
- Text(
- title=_("Description"),
- description=_("The Processor Name Description")),
- as_of='devel', readonly=True)
- processors = exported(
- CollectionField(
- title=_("Processors"),
- description=_("The Processors in this family."),
- value_type=Reference(IProcessor)),
- as_of='devel', readonly=True)
- restricted = exported(
- Bool(title=_("Whether this family is restricted.")),
- as_of='devel', readonly=True)
-
- def addProcessor(name, title, description):
- """Add a new processor to this family.
-
- :param name: Name of the processor
- :param title: Title of the processor
- :param description: Description of the processor
- :return: A `IProcessor`
- """
-
-
class IProcessorSet(Interface):
"""Operations related to Processor instances."""
export_as_webservice_collection(IProcessor)
@@ -153,46 +89,15 @@
def getAll():
"""Return all the `IProcessor` known to Launchpad."""
-
-class IProcessorFamilySet(Interface):
- """Operations related to ProcessorFamily instances."""
-
- export_as_webservice_collection(IProcessorFamily)
-
- @operation_parameters(
- name=TextLine(required=True))
- @operation_returns_entry(IProcessorFamily)
- @export_read_operation()
- @operation_for_version('devel')
- def getByName(name):
- """Return the ProcessorFamily instance with the matching name.
-
- :param name: The name to look for.
-
- :return: A `IProcessorFamily` instance if found, None otherwise.
- """
-
- @collection_default_content()
def getRestricted():
- """Return a sequence of all restricted architectures.
-
- :return: A sequence of `IProcessorFamily` instances.
- """
-
- def getByProcessorName(name):
- """Given a processor name return the ProcessorFamily it belongs to.
-
- :param name: The name of the processor to look for.
-
- :return: A `IProcessorFamily` instance if found, None otherwise.
- """
+ """Return all restricted `IProcessor`s."""
def new(name, title, description, restricted):
- """Create a new processor family.
+ """Create a new processor.
- :param name: Name of the family.
- :param title: Title for the family.
- :param description: Extended description of the family
- :param restricted: Whether the processor family is restricted
- :return: a `IProcessorFamily`.
+ :param name: Name of the processor.
+ :param title: Title for the processor.
+ :param description: Extended description of the processor.
+ :param restricted: Whether the processor is restricted.
+ :return: a `IProcessor`.
"""
=== modified file 'lib/lp/soyuz/interfaces/webservice.py'
--- lib/lp/soyuz/interfaces/webservice.py 2013-09-13 07:07:25 +0000
+++ lib/lp/soyuz/interfaces/webservice.py 2013-09-23 02:43:48 +0000
@@ -33,8 +33,6 @@
'IPackageset',
'IPackagesetSet',
'IProcessor',
- 'IProcessorFamily',
- 'IProcessorFamilySet',
'IProcessorSet',
'ISourcePackagePublishingHistory',
'IncompatibleArguments',
@@ -96,8 +94,6 @@
)
from lp.soyuz.interfaces.processor import (
IProcessor,
- IProcessorFamily,
- IProcessorFamilySet,
IProcessorSet,
)
from lp.soyuz.interfaces.publishing import (
=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py 2013-09-13 07:07:25 +0000
+++ lib/lp/soyuz/model/archive.py 2013-09-23 02:43:48 +0000
@@ -1972,42 +1972,30 @@
LibraryFileContent.id == LibraryFileAlias.contentID).config(
distinct=True))
- def _getEnabledRestrictedFamilies(self):
- """Retrieve the restricted architecture families this archive can
- build on."""
- families = getUtility(IArchiveArchSet).getRestrictedFamilies(self)
+ def _getEnabledRestrictedProcessors(self):
+ """Retrieve the restricted architectures this archive can build on."""
+ processors = getUtility(IArchiveArchSet).getRestrictedProcessors(self)
return [
- family for (family, archive_arch) in families
+ processor for (processor, archive_arch) in processors
if archive_arch is not None]
- def _setEnabledRestrictedFamilies(self, value):
- """Set the restricted architecture families this archive can
- build on."""
+ def _setEnabledRestrictedProcessors(self, value):
+ """Set the restricted architectures this archive can build on."""
archive_arch_set = getUtility(IArchiveArchSet)
- restricted_families = archive_arch_set.getRestrictedFamilies(self)
- for (family, archive_arch) in restricted_families:
- if family in value and archive_arch is None:
- archive_arch_set.new(self, family)
- if family not in value and archive_arch is not None:
+ restricted_processors = archive_arch_set.getRestrictedProcessors(self)
+ for (processor, archive_arch) in restricted_processors:
+ if processor in value and archive_arch is None:
+ archive_arch_set.new(self, processor)
+ if processor not in value and archive_arch is not None:
Store.of(self).remove(archive_arch)
- enabled_restricted_families = property(_getEnabledRestrictedFamilies,
- _setEnabledRestrictedFamilies)
-
- @property
- def enabled_restricted_processors(self):
- return [
- family.processors[0]
- for family in self.enabled_restricted_families]
-
- def enableRestrictedFamily(self, family):
- """See `IArchive`."""
- restricted = set(self.enabled_restricted_families)
- restricted.add(family)
- self.enabled_restricted_families = restricted
+ enabled_restricted_processors = property(
+ _getEnabledRestrictedProcessors, _setEnabledRestrictedProcessors)
def enableRestrictedProcessor(self, processor):
- self.enableRestrictedFamily(processor.family)
+ """See `IArchive`."""
+ self.enabled_restricted_processors = set(
+ self.enabled_restricted_processors + [processor])
def getPockets(self):
"""See `IArchive`."""
=== modified file 'lib/lp/soyuz/model/archivearch.py'
--- lib/lp/soyuz/model/archivearch.py 2013-09-20 05:25:18 +0000
+++ lib/lp/soyuz/model/archivearch.py 2013-09-23 02:43:48 +0000
@@ -23,7 +23,7 @@
IArchiveArch,
IArchiveArchSet,
)
-from lp.soyuz.model.processor import ProcessorFamily
+from lp.soyuz.model.processor import Processor
class ArchiveArch(Storm):
@@ -34,47 +34,39 @@
archive_id = Int(name='archive', allow_none=False)
archive = Reference(archive_id, 'Archive.id')
- processorfamily_id = Int(name='processorfamily', allow_none=True)
- processorfamily = Reference(processorfamily_id, 'ProcessorFamily.id')
- processor_id = Int(name='processor', allow_none=True)
- processor = Reference(processor_id, 'Processor.id')
+ processor_id = Int(name='processor', allow_none=False)
+ processor = Reference(processor_id, Processor.id)
class ArchiveArchSet:
"""See `IArchiveArchSet`."""
implements(IArchiveArchSet)
- def new(self, archive, processorfamily):
+ def new(self, archive, processor):
"""See `IArchiveArchSet`."""
- processor = processorfamily.processors[0]
archivearch = ArchiveArch()
archivearch.archive = archive
- archivearch.processorfamily = processorfamily
archivearch.processor = processor
IStore(ArchiveArch).add(archivearch)
return archivearch
- def getByArchive(self, archive, processorfamily=None):
+ def getByArchive(self, archive, processor=None):
"""See `IArchiveArchSet`."""
- base_clauses = (ArchiveArch.archive == archive,)
- if processorfamily is not None:
- optional_clauses = (
- ArchiveArch.processorfamily == processorfamily,)
- else:
- optional_clauses = ()
-
- return IStore(ArchiveArch).find(
- ArchiveArch, *(base_clauses + optional_clauses)).order_by(
- ArchiveArch.id)
-
- def getRestrictedFamilies(self, archive):
+ clauses = [ArchiveArch.archive == archive]
+ if processor is not None:
+ clauses.append(ArchiveArch.processor == processor)
+
+ return IStore(ArchiveArch).find(ArchiveArch, *clauses).order_by(
+ ArchiveArch.id)
+
+ def getRestrictedProcessors(self, archive):
"""See `IArchiveArchSet`."""
origin = (
- ProcessorFamily,
+ Processor,
LeftJoin(
ArchiveArch,
And(ArchiveArch.archive == archive.id,
- ArchiveArch.processorfamily == ProcessorFamily.id)))
+ ArchiveArch.processor == Processor.id)))
return IStore(ArchiveArch).using(*origin).find(
- (ProcessorFamily, ArchiveArch),
- ProcessorFamily.restricted == True).order_by(ProcessorFamily.name)
+ (Processor, ArchiveArch),
+ Processor.restricted == True).order_by(Processor.name)
=== modified file 'lib/lp/soyuz/model/distroarchseries.py'
--- lib/lp/soyuz/model/distroarchseries.py 2013-09-10 05:00:15 +0000
+++ lib/lp/soyuz/model/distroarchseries.py 2013-09-23 02:43:48 +0000
@@ -68,9 +68,7 @@
distroseries = ForeignKey(dbName='distroseries',
foreignKey='DistroSeries', notNull=True)
- processorfamily = ForeignKey(dbName='processorfamily',
- foreignKey='ProcessorFamily', notNull=True)
- processor_id = Int(name='processor', allow_none=True)
+ processor_id = Int(name='processor', allow_none=False)
processor = Reference(processor_id, Processor.id)
architecturetag = StringCol(notNull=True)
official = BoolCol(notNull=True)
@@ -90,27 +88,10 @@
return self.getBinaryPackage(name)
@property
- def default_processor(self):
- """See `IDistroArchSeries`."""
- # XXX cprov 2005-08-31:
- # This could possibly be better designed; let's think about it in
- # the future. Pick the first processor we found for this
- # distroarchseries.processorfamily. The data model should
- # change to have a default processor for a processorfamily
- return self.processors[0]
-
- @property
- def processors(self):
- """See `IDistroArchSeries`."""
- return Processor.selectBy(family=self.processorfamily, orderBy='id')
-
- @property
def title(self):
"""See `IDistroArchSeries`."""
return '%s for %s (%s)' % (
- self.distroseries.title, self.architecturetag,
- self.processorfamily.name
- )
+ self.distroseries.title, self.architecturetag, self.processor.name)
@property
def displayname(self):
=== modified file 'lib/lp/soyuz/model/packagecloner.py'
--- lib/lp/soyuz/model/packagecloner.py 2013-06-20 05:50:00 +0000
+++ lib/lp/soyuz/model/packagecloner.py 2013-09-23 02:43:48 +0000
@@ -58,7 +58,7 @@
implements(IPackageCloner)
def clonePackages(self, origin, destination, distroarchseries_list=None,
- proc_families=None, sourcepackagenames=None,
+ processors=None, sourcepackagenames=None,
always_create=False):
"""Copies packages from origin to destination package location.
@@ -73,8 +73,8 @@
distroarchseries instances.
@param distroarchseries_list: the binary packages will be copied
for the distroarchseries pairs specified (if any).
- @param proc_families: the processor families to create builds for.
- @type proc_families: Iterable
+ @param processors: the processors to create builds for.
+ @type processors: Iterable
@param sourcepackagenames: the sourcepackages to copy to the
destination
@type sourcepackagenames: Iterable
@@ -94,22 +94,21 @@
origin, destination, origin_das, destination_das,
sourcepackagenames)
- if proc_families is None:
- proc_families = []
+ if processors is None:
+ processors = []
self._create_missing_builds(
destination.distroseries, destination.archive,
- distroarchseries_list, proc_families, always_create)
+ distroarchseries_list, processors, always_create)
- def _create_missing_builds(
- self, distroseries, archive, distroarchseries_list,
- proc_families, always_create):
+ def _create_missing_builds(self, distroseries, archive,
+ distroarchseries_list, processors,
+ always_create):
"""Create builds for all cloned source packages.
:param distroseries: the distro series for which to create builds.
:param archive: the archive for which to create builds.
- :param proc_families: the list of processor families for
- which to create builds.
+ :param processors: the list of processors for which to create builds.
"""
# Avoid circular imports.
from lp.soyuz.interfaces.publishing import active_publishing_status
@@ -119,9 +118,9 @@
architectures = list(distroseries.architectures)
# Filter the list of DistroArchSeries so that only the ones
- # specified in proc_families remain
+ # specified in processors remain.
architectures = [architecture for architecture in architectures
- if architecture.processorfamily in proc_families]
+ if architecture.processor in processors]
if len(architectures) == 0:
return
@@ -264,17 +263,13 @@
""" % sqlvalues(
PackagePublishingStatus.SUPERSEDED, UTC_NOW))
- def get_family(archivearch):
- """Extract the processor family from an `IArchiveArch`."""
- return removeSecurityProxy(archivearch).processorfamily
-
- proc_families = [
- get_family(archivearch) for archivearch
+ processors = [
+ removeSecurityProxy(archivearch).processor for archivearch
in getUtility(IArchiveArchSet).getByArchive(destination.archive)]
self._create_missing_builds(
destination.distroseries, destination.archive, (),
- proc_families, False)
+ processors, False)
def _compute_packageset_delta(self, origin):
"""Given a source/target archive find obsolete or missing packages.
=== modified file 'lib/lp/soyuz/model/processor.py'
--- lib/lp/soyuz/model/processor.py 2013-09-10 05:00:15 +0000
+++ lib/lp/soyuz/model/processor.py 2013-09-23 02:43:48 +0000
@@ -4,15 +4,10 @@
__metaclass__ = type
__all__ = [
'Processor',
- 'ProcessorFamily',
- 'ProcessorFamilySet'
+ 'ProcessorSet',
]
-from sqlobject import (
- ForeignKey,
- SQLMultipleJoin,
- StringCol,
- )
+from sqlobject import StringCol
from storm.locals import Bool
from zope.interface import implements
@@ -20,8 +15,6 @@
from lp.services.database.sqlbase import SQLBase
from lp.soyuz.interfaces.processor import (
IProcessor,
- IProcessorFamily,
- IProcessorFamilySet,
IProcessorSet,
ProcessorNotFound,
)
@@ -31,12 +24,10 @@
implements(IProcessor)
_table = 'Processor'
- family = ForeignKey(dbName='family', foreignKey='ProcessorFamily',
- notNull=True)
name = StringCol(dbName='name', notNull=True)
title = StringCol(dbName='title', notNull=True)
description = StringCol(dbName='description', notNull=True)
- restricted = Bool(allow_none=True, default=False)
+ restricted = Bool(allow_none=False, default=False)
def __repr__(self):
return "<Processor %r>" % self.title
@@ -58,54 +49,12 @@
"""See `IProcessorSet`."""
return IStore(Processor).find(Processor)
-
-class ProcessorFamily(SQLBase):
- implements(IProcessorFamily)
- _table = 'ProcessorFamily'
-
- name = StringCol(dbName='name', notNull=True)
- title = StringCol(dbName='title', notNull=True)
- description = StringCol(dbName='description', notNull=True)
-
- processors = SQLMultipleJoin('Processor', joinColumn='family')
- restricted = Bool(allow_none=False, default=False)
-
- def addProcessor(self, name, title, description):
- """See `IProcessorFamily`."""
- return Processor(family=self, name=name, title=title,
- description=description, restricted=self.restricted)
-
- def __repr__(self):
- return "<ProcessorFamily %r>" % self.title
-
-
-class ProcessorFamilySet:
- implements(IProcessorFamilySet)
-
- def getByName(self, name):
- """Please see `IProcessorFamilySet`."""
- # Please note that ProcessorFamily.name is unique i.e. the database
- # will return a result set that's either empty or contains just one
- # ProcessorFamily row.
- return IStore(ProcessorFamily).find(
- ProcessorFamily, ProcessorFamily.name == name).one()
-
def getRestricted(self):
- """See `IProcessorFamilySet`."""
- return IStore(ProcessorFamily).find(
- ProcessorFamily, ProcessorFamily.restricted == True)
-
- def getByProcessorName(self, name):
- """Please see `IProcessorFamilySet`."""
- # Each `Processor` is associated with exactly one `ProcessorFamily`
- # but there is also the possibility that the user specified a name for
- # a non-existent processor.
- return IStore(ProcessorFamily).find(
- ProcessorFamily,
- Processor.name == name,
- Processor.family == ProcessorFamily.id).one()
+ """See `IProcessorSet`."""
+ return IStore(Processor).find(Processor, Processor.restricted == True)
def new(self, name, title, description, restricted=False):
- """See `IProcessorFamily`."""
- return ProcessorFamily(name=name, title=title,
- description=description, restricted=restricted)
+ """See `IProcessorSet`."""
+ return Processor(
+ name=name, title=title, description=description,
+ restricted=restricted)
=== modified file 'lib/lp/soyuz/model/publishing.py'
--- lib/lp/soyuz/model/publishing.py 2013-07-16 08:10:32 +0000
+++ lib/lp/soyuz/model/publishing.py 2013-09-23 02:43:48 +0000
@@ -599,12 +599,12 @@
:param available_archs: Architectures to consider
:return: Sequence of `IDistroArch` instances.
"""
- # Return all distroarches with unrestricted processor families or with
- # processor families the archive is explicitly associated with.
+ # Return all distroarches with unrestricted processors or with
+ # processors the archive is explicitly associated with.
return [distroarch for distroarch in available_archs
- if not distroarch.processorfamily.restricted or
- distroarch.processorfamily in
- self.archive.enabled_restricted_families]
+ if not distroarch.processor.restricted or
+ distroarch.processor in
+ self.archive.enabled_restricted_processors]
def createMissingBuilds(self, architectures_available=None, logger=None):
"""See `ISourcePackagePublishingHistory`."""
=== modified file 'lib/lp/soyuz/model/sourcepackagerelease.py'
--- lib/lp/soyuz/model/sourcepackagerelease.py 2013-08-06 09:49:14 +0000
+++ lib/lp/soyuz/model/sourcepackagerelease.py 2013-09-23 02:43:48 +0000
@@ -357,11 +357,9 @@
def createBuild(self, distro_arch_series, pocket, archive, processor=None,
status=None):
"""See ISourcePackageRelease."""
- # Guess a processor if one is not provided
+ # If a processor is not provided, use the DAS' processor.
if processor is None:
- pf = distro_arch_series.processorfamily
- # We guess at the first processor in the family
- processor = shortlist(pf.processors)[0]
+ processor = distro_arch_series.processor
if status is None:
status = BuildStatus.NEEDSBUILD
=== modified file 'lib/lp/soyuz/scripts/gina/handlers.py'
--- lib/lp/soyuz/scripts/gina/handlers.py 2013-05-22 09:51:08 +0000
+++ lib/lp/soyuz/scripts/gina/handlers.py 2013-09-23 02:43:48 +0000
@@ -223,15 +223,7 @@
raise DataSetupError("Error finding distroarchseries for %s/%s"
% (self.distroseries.name, archtag))
- # XXX kiko 2005-11-07: Is this really a selectOneBy? Can't there
- # be multiple proessors per family?
- processor = Processor.selectOneBy(familyID=dar.processorfamily.id)
- if not processor:
- raise DataSetupError("Unable to find a processor from the "
- "processor family %s chosen from %s/%s"
- % (dar.processorfamily.name,
- self.distroseries.name, archtag))
-
+ processor = dar.processor
info = {'distroarchseries': dar, 'processor': processor}
self.archinfo[archtag] = info
=== modified file 'lib/lp/soyuz/scripts/initialize_distroseries.py'
--- lib/lp/soyuz/scripts/initialize_distroseries.py 2013-09-20 05:25:18 +0000
+++ lib/lp/soyuz/scripts/initialize_distroseries.py 2013-09-23 02:43:48 +0000
@@ -380,12 +380,12 @@
sqlvalues(self.arches))
self._store.execute("""
INSERT INTO DistroArchSeries
- (distroseries, processorfamily, processor, architecturetag, owner,
- official, supports_virtualized)
- SELECT %s, processorfamily, processor, architecturetag, %s,
+ (distroseries, processor, architecturetag, owner, official,
+ supports_virtualized)
+ SELECT %s, processor, architecturetag, %s,
bool_and(official), bool_or(supports_virtualized)
FROM DistroArchSeries WHERE enabled = TRUE %s
- GROUP BY processorfamily, processor, architecturetag
+ GROUP BY processor, architecturetag
""" % (sqlvalues(self.distroseries, self.distroseries.owner)
+ (das_filter, )))
self._store.flush()
@@ -531,15 +531,14 @@
destination = PackageLocation(
target_archive, self.distroseries.distribution,
self.distroseries, PackagePublishingPocket.RELEASE)
- proc_families = None
+ processors = None
if self.rebuild:
- proc_families = [
- das[1].processorfamily
- for das in distroarchseries_list]
+ processors = [
+ das[1].processor for das in distroarchseries_list]
distroarchseries_list = ()
getUtility(IPackageCloner).clonePackages(
origin, destination, distroarchseries_list,
- proc_families, spns, self.rebuild)
+ processors, spns, self.rebuild)
else:
# There is only one available pocket in an unreleased
# series.
=== modified file 'lib/lp/soyuz/scripts/populate_archive.py'
--- lib/lp/soyuz/scripts/populate_archive.py 2012-08-08 11:49:05 +0000
+++ lib/lp/soyuz/scripts/populate_archive.py 2013-09-23 02:43:48 +0000
@@ -11,7 +11,6 @@
from zope.component import getUtility
-from zope.security.proxy import removeSecurityProxy
from lp.app.errors import NotFoundError
from lp.app.validators.name import valid_name
@@ -23,7 +22,10 @@
from lp.soyuz.interfaces.component import IComponentSet
from lp.soyuz.interfaces.packagecloner import IPackageCloner
from lp.soyuz.interfaces.packagecopyrequest import IPackageCopyRequestSet
-from lp.soyuz.interfaces.processor import IProcessorFamilySet
+from lp.soyuz.interfaces.processor import (
+ IProcessorSet,
+ ProcessorNotFound,
+ )
from lp.soyuz.scripts.ftpmasterbase import (
SoyuzScript,
SoyuzScriptError,
@@ -90,25 +92,23 @@
copied to.
"""
- def loadProcessorFamilies(arch_tags):
- """Load processor families for specified arch tags."""
- proc_family_set = getUtility(IProcessorFamilySet)
- proc_families = set()
+ def loadProcessors(arch_tags):
+ """Load processors for specified arch tags."""
+ processors = set()
for name in arch_tags:
- proc_family = proc_family_set.getByProcessorName(name)
- if proc_family is None:
+ try:
+ processor = getUtility(IProcessorSet).getByName(name)
+ processors.add(processor)
+ except ProcessorNotFound:
raise SoyuzScriptError(
"Invalid architecture tag: '%s'" % name)
- else:
- proc_families.add(proc_family)
-
- return proc_families
-
- def set_archive_architectures(archive, proc_families):
- """Associate the archive with the processor families."""
+ return processors
+
+ def set_archive_architectures(archive, processors):
+ """Associate the archive with the processors."""
aa_set = getUtility(IArchiveArchSet)
- for proc_family in proc_families:
- aa_set.new(archive, proc_family)
+ for processor in processors:
+ aa_set.new(archive, processor)
def build_location(distro, suite, component, packageset_names=None):
"""Build and return package location."""
@@ -200,11 +200,11 @@
raise SoyuzScriptError(
"error: architecture tags not specified.")
- # First load the processor families for the specified arch tags
+ # First load the processors for the specified arch tags
# from the database. This will fail if an invalid arch tag
# name was specified on the command line; that's why it should be
# done before creating the copy archive.
- proc_families = loadProcessorFamilies(arch_tags)
+ processors = loadProcessors(arch_tags)
# The copy archive is created in disabled mode. This gives the
# archive owner the chance to tweak the build dependencies
@@ -218,9 +218,9 @@
description=reason, enabled=False,
require_virtualized=virtual)
the_destination.archive = copy_archive
- # Associate the newly created copy archive with the processor
- # families specified by the user.
- set_archive_architectures(copy_archive, proc_families)
+ # Associate the newly created copy archive with the processors
+ # specified by the user.
+ set_archive_architectures(copy_archive, processors)
else:
# Archive name clash! Creation requested for existing archive with
# the same name and distribution.
@@ -228,10 +228,9 @@
raise SoyuzScriptError(
"error: archive '%s' already exists for '%s'."
% (to_archive, the_destination.distribution.name))
- # The user is not supposed to specify processor families on the
- # command line for existing copy archives. The processor families
- # specified when the archive was created will be read from the
- # database instead.
+ # The user is not supposed to specify processors on the command
+ # line for existing copy archives. The processors specified when
+ # the archive was created will be read from the database instead.
if specified(arch_tags):
raise SoyuzScriptError(
"error: cannot specify architecture tags for *existing* "
@@ -241,12 +240,6 @@
raise SoyuzScriptError(
"error: cannot copy to disabled archive")
- # The copy archive exists already, get the associated processor
- # families.
- def get_family(archivearch):
- """Extract the processor family from an `IArchiveArch`."""
- return removeSecurityProxy(archivearch).processorfamily
-
# Now instantiate the package copy request that will capture the
# archive population parameters in the database.
pcr = getUtility(IPackageCopyRequestSet).new(
@@ -265,7 +258,7 @@
pkg_cloner.mergeCopy(the_origin, the_destination)
else:
pkg_cloner.clonePackages(
- the_origin, the_destination, proc_families=proc_families)
+ the_origin, the_destination, processors=processors)
# Mark the package copy request as completed.
pcr.markAsCompleted()
=== modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py'
--- lib/lp/soyuz/scripts/tests/test_copypackage.py 2013-06-20 17:24:46 +0000
+++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2013-09-23 02:43:48 +0000
@@ -1029,9 +1029,9 @@
nobby = self.factory.makeDistroSeries(
distribution=self.test_publisher.ubuntutest, name='nobby')
for arch in archs:
- pf = self.factory.makeProcessorFamily(name='my_%s' % arch)
+ processor = self.factory.makeProcessor(name='my_%s' % arch)
self.factory.makeDistroArchSeries(
- distroseries=nobby, architecturetag=arch, processorfamily=pf)
+ distroseries=nobby, architecturetag=arch, processor=processor)
nobby.nominatedarchindep = nobby[archs[0]]
self.test_publisher.addFakeChroots(nobby)
return nobby
@@ -1736,7 +1736,7 @@
for das in self.series.architectures:
self.factory.makeDistroArchSeries(
distroseries=new_series, architecturetag=das.architecturetag,
- processorfamily=das.processorfamily)
+ processor=das.processor)
new_series.nominatedarchindep = new_series[
self.series.nominatedarchindep.architecturetag]
new_das = self.factory.makeDistroArchSeries(distroseries=new_series)
=== modified file 'lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py'
--- lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py 2013-09-12 02:29:55 +0000
+++ lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py 2013-09-23 02:43:48 +0000
@@ -27,7 +27,10 @@
IPackagesetSet,
NoSuchPackageSet,
)
-from lp.soyuz.interfaces.processor import IProcessorFamilySet
+from lp.soyuz.interfaces.processor import (
+ IProcessorSet,
+ ProcessorNotFound,
+ )
from lp.soyuz.interfaces.publishing import PackagePublishingStatus
from lp.soyuz.interfaces.sourcepackageformat import (
ISourcePackageFormatSelectionSet,
@@ -49,13 +52,13 @@
# - setup/populate parents with packages;
# - initialize a child from parents.
- def setupDas(self, parent, proc, arch_tag):
- pf = getUtility(IProcessorFamilySet).getByName(proc)
- if pf.processors.is_empty():
- self.factory.makeProcessor(family=pf)
+ def setupDas(self, parent, processor_name, arch_tag):
+ try:
+ processor = getUtility(IProcessorSet).getByName(processor_name)
+ except ProcessorNotFound:
+ processor = self.factory.makeProcessor(name=processor_name)
parent_das = self.factory.makeDistroArchSeries(
- distroseries=parent, processorfamily=pf,
- architecturetag=arch_tag)
+ distroseries=parent, processor=processor, architecturetag=arch_tag)
lf = self.factory.makeLibraryFileAlias()
transaction.commit()
parent_das.addOrUpdateChroot(lf)
@@ -63,10 +66,8 @@
return parent_das
def setupParent(self, parent=None, packages=None, format_selection=None,
- distribution=None,
- pocket=PackagePublishingPocket.RELEASE,
- proc='x86', arch_tag='i386'
- ):
+ distribution=None, pocket=PackagePublishingPocket.RELEASE,
+ proc='386', arch_tag='i386'):
if parent is None:
parent = self.factory.makeDistroSeries(distribution)
parent_das = self.setupDas(parent, proc, arch_tag)
=== modified file 'lib/lp/soyuz/scripts/tests/test_populatearchive.py'
--- lib/lp/soyuz/scripts/tests/test_populatearchive.py 2012-09-27 02:53:00 +0000
+++ lib/lp/soyuz/scripts/tests/test_populatearchive.py 2013-09-23 02:43:48 +0000
@@ -463,7 +463,7 @@
exception_type=SoyuzScriptError,
exception_text="Invalid origin archive name: '//'")
- def testInvalidProcessorFamilyName(self):
+ def testInvalidProcessorName(self):
"""Try copy archive population with an invalid architecture tag.
This test should provoke a `SoyuzScriptError` exception.
@@ -474,11 +474,11 @@
exception_type=SoyuzScriptError,
exception_text="Invalid architecture tag: 'wintel'")
- def testFamiliesForExistingArchives(self):
- """Try specifying processor family names for existing archive.
+ def testProcessorsForExistingArchives(self):
+ """Try specifying processor names for existing archive.
- The user is not supposed to specify processor families on the command
- line for existing copy archives. The processor families will be read
+ The user is not supposed to specify processor on the command
+ line for existing copy archives. The processor will be read
from the database instead. Please see also the end of the
testMultipleArchTags test.
@@ -549,7 +549,7 @@
exception_text=(
"error: archive 'hello-1' already exists for 'ubuntu'."))
- def testMissingProcessorFamily(self):
+ def testMissingProcessor(self):
"""Try copy archive population without a single architecture tag.
This test should provoke a `SoyuzScriptError` exception.
=== modified file 'lib/lp/soyuz/security.py'
--- lib/lp/soyuz/security.py 2011-07-14 21:49:37 +0000
+++ lib/lp/soyuz/security.py 2013-09-23 02:43:48 +0000
@@ -6,21 +6,12 @@
__metaclass__ = type
__all__ = [
'ViewProcessor',
- 'ViewProcessorFamily',
]
from lp.app.security import AnonymousAuthorization
-from lp.soyuz.interfaces.processor import (
- IProcessor,
- IProcessorFamily,
- )
+from lp.soyuz.interfaces.processor import IProcessor
class ViewProcessor(AnonymousAuthorization):
"""Anyone can view an `IProcessor`."""
usedfor = IProcessor
-
-
-class ViewProcessorFamily(AnonymousAuthorization):
- """Anyone can view an `IProcessorFamily`."""
- usedfor = IProcessorFamily
=== modified file 'lib/lp/soyuz/stories/distroseries/add-architecture.txt'
--- lib/lp/soyuz/stories/distroseries/add-architecture.txt 2011-03-16 07:59:26 +0000
+++ lib/lp/soyuz/stories/distroseries/add-architecture.txt 2013-09-23 02:43:48 +0000
@@ -16,11 +16,11 @@
<Link text='Cancel' url='http://launchpad.dev/ubuntu/hoary'>
To register a new architecture one has to specify the architecture tag, the
-processor family and whether or not that architecture is officially supported
+processor and whether or not that architecture is officially supported
and/or has PPA support.
>>> admin_browser.getControl('Architecture Tag').value = 'ia64'
- >>> admin_browser.getControl('Processor Family').value = ['amd64']
+ >>> admin_browser.getControl('Processor:').value = ['amd64']
>>> admin_browser.getControl('Official Support').selected = True
>>> admin_browser.getControl('PPA support available').selected = True
>>> admin_browser.getControl('Continue').click()
=== modified file 'lib/lp/soyuz/stories/ppa/xx-copy-packages.txt'
--- lib/lp/soyuz/stories/ppa/xx-copy-packages.txt 2013-05-03 16:43:19 +0000
+++ lib/lp/soyuz/stories/ppa/xx-copy-packages.txt 2013-09-23 02:43:48 +0000
@@ -112,7 +112,7 @@
>>> login('foo.bar@xxxxxxxxxxxxx')
>>> from lp.services.librarian.interfaces import ILibraryFileAliasSet
>>> from lp.registry.interfaces.distribution import IDistributionSet
- >>> from lp.soyuz.model.processor import ProcessorFamily
+ >>> from lp.soyuz.interfaces.processor import IProcessorSet
>>> fake_chroot = getUtility(ILibraryFileAliasSet)[1]
@@ -128,7 +128,7 @@
>>> cprov = person_set.getByName('cprov')
>>> grumpy = ubuntu.getSeries('grumpy')
>>> grumpy_i386 = grumpy.newArch(
- ... 'i386', ProcessorFamily.get(1), False, cprov,
+ ... 'i386', getUtility(IProcessorSet).getByName('386'), False, cprov,
... supports_virtualized=True)
>>> grumpy.nominatedarchindep = grumpy_i386
>>> trash = grumpy_i386.addOrUpdateChroot(fake_chroot)
=== modified file 'lib/lp/soyuz/stories/soyuz/xx-distroarchseries.txt'
--- lib/lp/soyuz/stories/soyuz/xx-distroarchseries.txt 2013-07-22 17:02:19 +0000
+++ lib/lp/soyuz/stories/soyuz/xx-distroarchseries.txt 2013-09-23 02:43:48 +0000
@@ -28,7 +28,7 @@
This archive contains 5 software packages.
Details for Ubuntu Warty i386
Architecture tag: i386
- Processor family: Intel 386 compatible chips
+ Processor: Intel 386
Port registrant: Mark Shuttleworth
5 binary packages
@@ -208,7 +208,7 @@
(unofficial)
>>> admin_browser.getControl("Architecture Tag").value = 'i386'
- >>> admin_browser.getControl("Processor Family").value = ['x86']
+ >>> admin_browser.getControl("Processor:").value = ['386']
>>> admin_browser.getControl("Official Support").selected = True
>>> admin_browser.getControl("PPA support available").selected = True
@@ -217,7 +217,7 @@
traceback. Although It's not a big problem because this form is very
restricted and rarely used.
- admin_browser.getControl("Add").click()
+ admin_browser.getControl("Continue").click()
Traceback (most recent call last):
...
RetryPsycopgIntegrityError: ERROR: duplicate key violates unique
@@ -240,7 +240,7 @@
>>> admin_browser.getLink("Add architecture").click()
>>> admin_browser.getControl("Architecture Tag").value = 'amd64'
- >>> admin_browser.getControl("Processor Family").value = ['amd64']
+ >>> admin_browser.getControl("Processor:").value = ['amd64']
>>> admin_browser.getControl("Official Support").selected = True
>>> admin_browser.getControl("PPA support available").selected = True
>>> admin_browser.getControl("Continue").click()
=== modified file 'lib/lp/soyuz/stories/webservice/xx-archive.txt'
--- lib/lp/soyuz/stories/webservice/xx-archive.txt 2013-09-16 04:14:56 +0000
+++ lib/lp/soyuz/stories/webservice/xx-archive.txt 2013-09-23 02:43:48 +0000
@@ -44,7 +44,6 @@
description: u'packages to help my friends.'
displayname: u'PPA for Celso Providelo'
distribution_link: u'http://.../ubuntu'
- enabled_restricted_families_collection_link: u'http://.../~cprov/+archive/ppa/enabled_restricted_families'
enabled_restricted_processors_collection_link: u'http://.../~cprov/+archive/ppa/enabled_restricted_processors'
external_dependencies: None
name: u'ppa'
=== modified file 'lib/lp/soyuz/stories/webservice/xx-distroarchseries.txt'
--- lib/lp/soyuz/stories/webservice/xx-distroarchseries.txt 2013-05-01 21:32:12 +0000
+++ lib/lp/soyuz/stories/webservice/xx-distroarchseries.txt 2013-09-23 02:43:48 +0000
@@ -45,7 +45,7 @@
resource_type_link: u'http://.../#distro_arch_series'
self_link: u'http://.../ubuntu/hoary/i386'
supports_virtualized: True
- title: u'The Hoary Hedgehog Release for i386 (x86)'
+ title: u'The Hoary Hedgehog Release for i386 (386)'
web_link: u'http://launchpad.../ubuntu/hoary/i386'
DistroArchSeries.enabled is published in the API devel version.
@@ -67,5 +67,5 @@
resource_type_link: u'http://.../#distro_arch_series'
self_link: u'http://.../ubuntu/hoary/i386'
supports_virtualized: True
- title: u'The Hoary Hedgehog Release for i386 (x86)'
+ title: u'The Hoary Hedgehog Release for i386 (386)'
web_link: u'http://launchpad.../ubuntu/hoary/i386'
=== modified file 'lib/lp/soyuz/templates/distroarchseries-portlet-details.pt'
--- lib/lp/soyuz/templates/distroarchseries-portlet-details.pt 2012-07-06 06:02:33 +0000
+++ lib/lp/soyuz/templates/distroarchseries-portlet-details.pt 2013-09-23 02:43:48 +0000
@@ -13,8 +13,8 @@
ARCHTAG
</a><br />
- <b>Processor family:</b><br />
- <span tal:replace="context/processorfamily/title" /><br />
+ <b>Processor:</b><br />
+ <span tal:replace="context/processor/title" /><br />
<b>Port registrant:</b><br />
<a tal:replace="structure context/owner/fmt:link" /><br />
=== modified file 'lib/lp/soyuz/tests/test_archive.py'
--- lib/lp/soyuz/tests/test_archive.py 2013-09-12 02:29:55 +0000
+++ lib/lp/soyuz/tests/test_archive.py 2013-09-23 02:43:48 +0000
@@ -72,7 +72,7 @@
from lp.soyuz.interfaces.binarypackagename import IBinaryPackageNameSet
from lp.soyuz.interfaces.component import IComponentSet
from lp.soyuz.interfaces.packagecopyjob import IPlainPackageCopyJobSource
-from lp.soyuz.interfaces.processor import IProcessorFamilySet
+from lp.soyuz.interfaces.processor import IProcessorSet
from lp.soyuz.model.archive import (
Archive,
validate_ppa,
@@ -994,7 +994,7 @@
class TestEnabledRestrictedBuilds(TestCaseWithFactory):
- """Ensure that restricted architecture family builds can be allowed and
+ """Ensure that restricted architectures builds can be allowed and
disallowed correctly."""
layer = LaunchpadZopelessLayer
@@ -1006,47 +1006,47 @@
self.publisher.prepareBreezyAutotest()
self.archive = self.factory.makeArchive()
self.archive_arch_set = getUtility(IArchiveArchSet)
- self.arm = getUtility(IProcessorFamilySet).getByName('arm')
- self.factory.makeProcessor(family=self.arm)
+ self.arm = self.factory.makeProcessor(name='arm', restricted=True)
def test_default(self):
"""By default, ARM builds are not allowed as ARM is restricted."""
self.assertEqual(0,
self.archive_arch_set.getByArchive(
self.archive, self.arm).count())
- self.assertContentEqual([], self.archive.enabled_restricted_families)
+ self.assertContentEqual([], self.archive.enabled_restricted_processors)
def test_get_uses_archivearch(self):
"""Adding an entry to ArchiveArch for ARM and an archive will
- enable enabled_restricted_families for arm for that archive."""
- self.assertContentEqual([], self.archive.enabled_restricted_families)
+ enable enabled_restricted_processors for arm for that archive."""
+ self.assertContentEqual([], self.archive.enabled_restricted_processors)
self.archive_arch_set.new(self.archive, self.arm)
- self.assertEqual([self.arm],
- list(self.archive.enabled_restricted_families))
+ self.assertEqual(
+ [self.arm], list(self.archive.enabled_restricted_processors))
def test_get_returns_restricted_only(self):
"""Adding an entry to ArchiveArch for something that is not
- restricted does not make it show up in enabled_restricted_families.
+ restricted does not make it show up in enabled_restricted_processors.
"""
- self.assertContentEqual([], self.archive.enabled_restricted_families)
- self.archive_arch_set.new(self.archive,
- getUtility(IProcessorFamilySet).getByName('amd64'))
- self.assertContentEqual([], self.archive.enabled_restricted_families)
+ self.assertContentEqual([], self.archive.enabled_restricted_processors)
+ self.archive_arch_set.new(
+ self.archive, getUtility(IProcessorSet).getByName('amd64'))
+ self.assertContentEqual([], self.archive.enabled_restricted_processors)
def test_set(self):
"""The property remembers its value correctly and sets ArchiveArch."""
- self.archive.enabled_restricted_families = [self.arm]
- allowed_restricted_families = self.archive_arch_set.getByArchive(
+ self.archive.enabled_restricted_processors = [self.arm]
+ allowed_restricted_processors = self.archive_arch_set.getByArchive(
self.archive, self.arm)
- self.assertEqual(1, allowed_restricted_families.count())
- self.assertEqual(
- self.arm, allowed_restricted_families[0].processorfamily)
- self.assertEqual([self.arm], self.archive.enabled_restricted_families)
- self.archive.enabled_restricted_families = []
- self.assertEqual(0,
- self.archive_arch_set.getByArchive(
- self.archive, self.arm).count())
- self.assertContentEqual([], self.archive.enabled_restricted_families)
+ self.assertEqual(1, allowed_restricted_processors.count())
+ self.assertEqual(
+ self.arm, allowed_restricted_processors[0].processor)
+ self.assertEqual(
+ [self.arm], self.archive.enabled_restricted_processors)
+ self.archive.enabled_restricted_processors = []
+ self.assertEqual(
+ 0,
+ self.archive_arch_set.getByArchive(self.archive, self.arm).count())
+ self.assertContentEqual([], self.archive.enabled_restricted_processors)
class TestBuilddSecret(TestCaseWithFactory):
=== modified file 'lib/lp/soyuz/tests/test_archivearch.py'
--- lib/lp/soyuz/tests/test_archivearch.py 2013-09-12 02:29:55 +0000
+++ lib/lp/soyuz/tests/test_archivearch.py 2013-09-23 02:43:48 +0000
@@ -8,7 +8,6 @@
from lp.registry.interfaces.distribution import IDistributionSet
from lp.registry.interfaces.person import IPersonSet
from lp.soyuz.interfaces.archivearch import IArchiveArchSet
-from lp.soyuz.interfaces.processor import IProcessorFamilySet
from lp.testing import TestCaseWithFactory
from lp.testing.layers import LaunchpadZopelessLayer
@@ -25,48 +24,39 @@
self.ppa = getUtility(IPersonSet).getByName('cprov').archive
ubuntu = getUtility(IDistributionSet)['ubuntu']
self.ubuntu_archive = ubuntu.main_archive
- pss = getUtility(IProcessorFamilySet)
- self.cell_proc = pss.new(
+ self.cell_proc = self.factory.makeProcessor(
'cell-proc', 'PS cell processor', 'Screamingly faaaaaaaaaaaast',
True)
- self.cell_proc.addProcessor('Cell', '', '')
- self.omap = pss.new(
+ self.omap = self.factory.makeProcessor(
'omap', 'Multimedia applications processor',
'Does all your sound & video', True)
- self.omap.addProcessor('Omap', '', '')
- def test_getRestrictedFamilies_no_restricted_associations(self):
- # Our archive is not associated with any restricted processor
- # families yet.
+ def test_getRestrictedProcessors_no_restricted_associations(self):
+ # Our archive is not associated with any restricted processors yet.
result_set = list(
- self.archive_arch_set.getRestrictedFamilies(self.ppa))
+ self.archive_arch_set.getRestrictedProcessors(self.ppa))
archivearches = [row[1] for row in result_set]
self.assertTrue(all(aa is None for aa in archivearches))
- def test_getRestrictedFamilies_single_restricted_association(self):
- # Our archive is now associated with one of the restricted processor
- # families.
+ def test_getRestrictedProcessors_single_restricted_association(self):
+ # Our archive is now associated with one of the restricted processors.
self.archive_arch_set.new(self.ppa, self.cell_proc)
result_set = list(
- self.archive_arch_set.getRestrictedFamilies(self.ppa))
+ self.archive_arch_set.getRestrictedProcessors(self.ppa))
results = dict(
(row[0].name, row[1] is not None) for row in result_set)
- self.assertEqual(
- {'arm': False, 'cell-proc': True, 'omap': False},
- results)
+ self.assertEqual({'cell-proc': True, 'omap': False}, results)
- def test_getRestrictedFamilies_archive_only(self):
+ def test_getRestrictedProcessors_archive_only(self):
# Test that only the associated archs for the archive itself are
# returned.
self.archive_arch_set.new(self.ppa, self.cell_proc)
self.archive_arch_set.new(self.ubuntu_archive, self.omap)
result_set = list(
- self.archive_arch_set.getRestrictedFamilies(self.ppa))
+ self.archive_arch_set.getRestrictedProcessors(self.ppa))
results = dict(
(row[0].name, row[1] is not None) for row in result_set)
- self.assertEqual(
- {'arm': False, 'cell-proc': True, 'omap': False},
- results)
+ self.assertEqual({'cell-proc': True, 'omap': False}, results)
def test_getByArchive_no_other_archives(self):
# Test ArchiveArchSet.getByArchive returns no other archives.
@@ -75,7 +65,7 @@
result_set = list(self.archive_arch_set.getByArchive(self.ppa))
self.assertEqual(1, len(result_set))
self.assertEqual(self.ppa, result_set[0].archive)
- self.assertEqual(self.cell_proc, result_set[0].processorfamily)
+ self.assertEqual(self.cell_proc, result_set[0].processor)
def test_getByArchive_follows_creation_order(self):
# The result of ArchiveArchSet.getByArchive follows the order in
@@ -85,9 +75,9 @@
result_set = list(self.archive_arch_set.getByArchive(self.ppa))
self.assertEqual(2, len(result_set))
self.assertEqual(self.ppa, result_set[0].archive)
- self.assertEqual(self.cell_proc, result_set[0].processorfamily)
+ self.assertEqual(self.cell_proc, result_set[0].processor)
self.assertEqual(self.ppa, result_set[1].archive)
- self.assertEqual(self.omap, result_set[1].processorfamily)
+ self.assertEqual(self.omap, result_set[1].processor)
def test_getByArchive_specific_architecture(self):
# ArchiveArchSet.getByArchive can query for a specific architecture
@@ -98,4 +88,4 @@
self.archive_arch_set.getByArchive(self.ppa, self.cell_proc))
self.assertEqual(1, len(result_set))
self.assertEqual(self.ppa, result_set[0].archive)
- self.assertEqual(self.cell_proc, result_set[0].processorfamily)
+ self.assertEqual(self.cell_proc, result_set[0].processor)
=== modified file 'lib/lp/soyuz/tests/test_binarypackagebuild.py'
--- lib/lp/soyuz/tests/test_binarypackagebuild.py 2013-08-29 18:34:59 +0000
+++ lib/lp/soyuz/tests/test_binarypackagebuild.py 2013-09-23 02:43:48 +0000
@@ -33,7 +33,6 @@
from lp.soyuz.interfaces.component import IComponentSet
from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
from lp.soyuz.model.buildpackagejob import BuildPackageJob
-from lp.soyuz.model.processor import ProcessorFamilySet
from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
from lp.testing import (
api_url,
@@ -420,13 +419,7 @@
self.build_set = getUtility(IBinaryPackageBuildSet)
# Create a 386 builder
- owner = self.factory.makePerson()
- processor_family = ProcessorFamilySet().getByProcessorName('386')
- processor = processor_family.processors[0]
-
- self.builder = self.factory.makeBuilder(
- processor, 'http://example.com', 'Newbob', 'New Bob the Builder',
- owner=owner)
+ self.builder = self.factory.makeBuilder()
# Ensure that our builds were all built by the test builder.
for build in self.builds:
=== modified file 'lib/lp/soyuz/tests/test_build.py'
--- lib/lp/soyuz/tests/test_build.py 2013-03-28 08:06:22 +0000
+++ lib/lp/soyuz/tests/test_build.py 2013-09-23 02:43:48 +0000
@@ -42,18 +42,17 @@
def setUp(self):
super(TestBuild, self).setUp()
self.admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
- self.pf = self.factory.makeProcessorFamily()
- pf_proc = self.pf.addProcessor(self.factory.getUniqueString(), '', '')
+ self.processor = self.factory.makeProcessor()
self.distroseries = self.factory.makeDistroSeries()
self.das = self.factory.makeDistroArchSeries(
- distroseries=self.distroseries, processorfamily=self.pf,
+ distroseries=self.distroseries, processor=self.processor,
supports_virtualized=True)
with person_logged_in(self.admin):
self.publisher = SoyuzTestPublisher()
self.publisher.prepareBreezyAutotest()
self.distroseries.nominatedarchindep = self.das
self.publisher.addFakeChroots(distroseries=self.distroseries)
- self.builder = self.factory.makeBuilder(processor=pf_proc)
+ self.builder = self.factory.makeBuilder(processor=self.processor)
self.now = datetime.now(pytz.UTC)
def test_title(self):
@@ -162,7 +161,7 @@
# Builds can not be retried for released distroseries
distroseries = self.factory.makeDistroSeries()
das = self.factory.makeDistroArchSeries(
- distroseries=distroseries, processorfamily=self.pf,
+ distroseries=distroseries, processor=self.processor,
supports_virtualized=True)
with person_logged_in(self.admin):
distroseries.nominatedarchindep = das
@@ -180,7 +179,7 @@
# released.
distroseries = self.factory.makeDistroSeries()
das = self.factory.makeDistroArchSeries(
- distroseries=distroseries, processorfamily=self.pf,
+ distroseries=distroseries, processor=self.processor,
supports_virtualized=True)
archive = self.factory.makeArchive(
purpose=ArchivePurpose.PARTNER,
=== modified file 'lib/lp/soyuz/tests/test_build_depwait.py'
--- lib/lp/soyuz/tests/test_build_depwait.py 2013-01-22 02:06:59 +0000
+++ lib/lp/soyuz/tests/test_build_depwait.py 2013-09-23 02:43:48 +0000
@@ -31,11 +31,10 @@
self.admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
# Create everything we need to create builds, such as a
# DistroArchSeries and a builder.
- self.pf = self.factory.makeProcessorFamily()
- pf_proc = self.pf.addProcessor(self.factory.getUniqueString(), '', '')
+ self.processor = self.factory.makeProcessor()
self.distroseries = self.factory.makeDistroSeries()
self.das = self.factory.makeDistroArchSeries(
- distroseries=self.distroseries, processorfamily=self.pf,
+ distroseries=self.distroseries, processor=self.processor,
supports_virtualized=True)
self.archive = self.factory.makeArchive(
distribution=self.distroseries.distribution,
@@ -45,7 +44,7 @@
self.publisher.prepareBreezyAutotest()
self.distroseries.nominatedarchindep = self.das
self.publisher.addFakeChroots(distroseries=self.distroseries)
- self.builder = self.factory.makeBuilder(processor=pf_proc)
+ self.builder = self.factory.makeBuilder(processor=self.processor)
def test_update_dependancies(self):
# Calling .updateDependencies() on a build will remove those which
=== modified file 'lib/lp/soyuz/tests/test_build_notify.py'
--- lib/lp/soyuz/tests/test_build_notify.py 2013-01-24 05:50:23 +0000
+++ lib/lp/soyuz/tests/test_build_notify.py 2013-09-23 02:43:48 +0000
@@ -35,11 +35,10 @@
super(TestBuildNotify, self).setUp()
self.admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
# Create all of the items we need to create builds
- self.pf = self.factory.makeProcessorFamily()
- pf_proc = self.pf.addProcessor(self.factory.getUniqueString(), '', '')
+ self.processor = self.factory.makeProcessor()
self.distroseries = self.factory.makeDistroSeries()
self.das = self.factory.makeDistroArchSeries(
- distroseries=self.distroseries, processorfamily=self.pf,
+ distroseries=self.distroseries, processor=self.processor,
supports_virtualized=True)
self.creator = self.factory.makePerson(email='test@xxxxxxxxxxx')
self.gpgkey = self.factory.makeGPGKey(owner=self.creator)
@@ -55,7 +54,7 @@
self.publisher.prepareBreezyAutotest()
self.distroseries.nominatedarchindep = self.das
self.publisher.addFakeChroots(distroseries=self.distroseries)
- self.builder = self.factory.makeBuilder(processor=pf_proc)
+ self.builder = self.factory.makeBuilder(processor=self.processor)
for member in buildd_admins.activemembers:
self.buildd_admins_email.append(member.preferredemail.email)
self.builds = []
=== modified file 'lib/lp/soyuz/tests/test_build_privacy.py'
--- lib/lp/soyuz/tests/test_build_privacy.py 2012-01-01 02:58:52 +0000
+++ lib/lp/soyuz/tests/test_build_privacy.py 2013-09-23 02:43:48 +0000
@@ -25,18 +25,17 @@
super(TestBuildPrivacy, self).setUp()
# Add everything we need to create builds.
self.admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
- pf = self.factory.makeProcessorFamily()
- pf_proc = pf.addProcessor(self.factory.getUniqueString(), '', '')
+ processor = self.factory.makeProcessor()
distroseries = self.factory.makeDistroSeries()
das = self.factory.makeDistroArchSeries(
- distroseries=distroseries, processorfamily=pf,
+ distroseries=distroseries, processor=processor,
supports_virtualized=True)
with person_logged_in(self.admin):
publisher = SoyuzTestPublisher()
publisher.prepareBreezyAutotest()
distroseries.nominatedarchindep = das
publisher.addFakeChroots(distroseries=distroseries)
- self.factory.makeBuilder(processor=pf_proc)
+ self.factory.makeBuilder(processor=processor)
self.public_archive = self.factory.makeArchive()
self.private_archive = self.factory.makeArchive(private=True)
# Create one public and one private build.
=== modified file 'lib/lp/soyuz/tests/test_build_set.py'
--- lib/lp/soyuz/tests/test_build_set.py 2013-02-06 10:44:24 +0000
+++ lib/lp/soyuz/tests/test_build_set.py 2013-09-23 02:43:48 +0000
@@ -3,7 +3,6 @@
__metaclass__ = type
-from storm.store import EmptyResultSet
from zope.component import getUtility
from zope.security.proxy import removeSecurityProxy
@@ -31,19 +30,15 @@
def setUp(self):
super(TestBuildSet, self).setUp()
self.admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
- self.pf_one = self.factory.makeProcessorFamily()
- pf_proc_1 = self.pf_one.addProcessor(
- self.factory.getUniqueString(), '', '')
- self.pf_two = self.factory.makeProcessorFamily()
- pf_proc_2 = self.pf_two.addProcessor(
- self.factory.getUniqueString(), '', '')
+ self.processor_one = self.factory.makeProcessor()
+ self.processor_two = self.factory.makeProcessor()
self.distroseries = self.factory.makeDistroSeries()
self.distribution = self.distroseries.distribution
self.das_one = self.factory.makeDistroArchSeries(
- distroseries=self.distroseries, processorfamily=self.pf_one,
+ distroseries=self.distroseries, processor=self.processor_one,
supports_virtualized=True)
self.das_two = self.factory.makeDistroArchSeries(
- distroseries=self.distroseries, processorfamily=self.pf_two,
+ distroseries=self.distroseries, processor=self.processor_two,
supports_virtualized=True)
self.archive = self.factory.makeArchive(
distribution=self.distroseries.distribution,
@@ -53,8 +48,10 @@
self.publisher.prepareBreezyAutotest()
self.distroseries.nominatedarchindep = self.das_one
self.publisher.addFakeChroots(distroseries=self.distroseries)
- self.builder_one = self.factory.makeBuilder(processor=pf_proc_1)
- self.builder_two = self.factory.makeBuilder(processor=pf_proc_2)
+ self.builder_one = self.factory.makeBuilder(
+ processor=self.processor_one)
+ self.builder_two = self.factory.makeBuilder(
+ processor=self.processor_two)
self.builds = []
self.spphs = []
=== modified file 'lib/lp/soyuz/tests/test_build_start_estimation.py'
--- lib/lp/soyuz/tests/test_build_start_estimation.py 2013-09-12 02:29:55 +0000
+++ lib/lp/soyuz/tests/test_build_start_estimation.py 2013-09-23 02:43:48 +0000
@@ -41,8 +41,7 @@
self.distroseries = self.factory.makeDistroSeries()
self.bob = getUtility(IBuilderSet).getByName(BOB_THE_BUILDER_NAME)
das = self.factory.makeDistroArchSeries(
- distroseries=self.distroseries,
- processorfamily=self.bob.processor.family,
+ distroseries=self.distroseries, processor=self.bob.processor,
architecturetag='i386', supports_virtualized=True)
with person_logged_in(self.admin):
self.distroseries.nominatedarchindep = das
=== modified file 'lib/lp/soyuz/tests/test_buildpackagejob.py'
--- lib/lp/soyuz/tests/test_buildpackagejob.py 2013-09-02 04:46:27 +0000
+++ lib/lp/soyuz/tests/test_buildpackagejob.py 2013-09-23 02:43:48 +0000
@@ -32,9 +32,9 @@
SCORE_BY_POCKET,
SCORE_BY_URGENCY,
)
+from lp.soyuz.interfaces.processor import IProcessorSet
from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
from lp.soyuz.model.buildpackagejob import BuildPackageJob
-from lp.soyuz.model.processor import ProcessorFamilySet
from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
from lp.testing import (
anonymous_logged_in,
@@ -93,12 +93,11 @@
self.i8 = self.factory.makeBuilder(name='i386-n-8', virtualized=False)
self.i9 = self.factory.makeBuilder(name='i386-n-9', virtualized=False)
- processor_fam = ProcessorFamilySet().getByName('hppa')
- proc = processor_fam.processors[0]
+ processor = getUtility(IProcessorSet).getByName('hppa')
self.h6 = self.factory.makeBuilder(
- name='hppa-n-6', processor=proc, virtualized=False)
+ name='hppa-n-6', processor=processor, virtualized=False)
self.h7 = self.factory.makeBuilder(
- name='hppa-n-7', processor=proc, virtualized=False)
+ name='hppa-n-7', processor=processor, virtualized=False)
self.builders = dict()
# x86 native
=== modified file 'lib/lp/soyuz/tests/test_hasbuildrecords.py'
--- lib/lp/soyuz/tests/test_hasbuildrecords.py 2013-06-20 05:50:00 +0000
+++ lib/lp/soyuz/tests/test_hasbuildrecords.py 2013-09-23 02:43:48 +0000
@@ -24,7 +24,6 @@
IHasBuildRecords,
IncompatibleArguments,
)
-from lp.soyuz.model.processor import ProcessorFamilySet
from lp.soyuz.model.publishing import SourcePackagePublishingHistory
from lp.soyuz.tests.test_binarypackagebuild import BaseTestCaseWithThreeBuilds
from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
@@ -80,19 +79,15 @@
self.admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
# Create the machinery we need to create builds, such as
# DistroArchSeries and builders.
- self.pf_one = self.factory.makeProcessorFamily()
- pf_proc_1 = self.pf_one.addProcessor(
- self.factory.getUniqueString(), '', '')
- self.pf_two = self.factory.makeProcessorFamily()
- pf_proc_2 = self.pf_two.addProcessor(
- self.factory.getUniqueString(), '', '')
+ self.processor_one = self.factory.makeProcessor()
+ self.processor_two = self.factory.makeProcessor()
self.distroseries = self.factory.makeDistroSeries()
self.distribution = self.distroseries.distribution
self.das_one = self.factory.makeDistroArchSeries(
- distroseries=self.distroseries, processorfamily=self.pf_one,
+ distroseries=self.distroseries, processor=self.processor_one,
supports_virtualized=True)
self.das_two = self.factory.makeDistroArchSeries(
- distroseries=self.distroseries, processorfamily=self.pf_two,
+ distroseries=self.distroseries, processor=self.processor_two,
supports_virtualized=True)
self.archive = self.factory.makeArchive(
distribution=self.distroseries.distribution,
@@ -103,8 +98,10 @@
self.publisher.prepareBreezyAutotest()
self.distroseries.nominatedarchindep = self.das_one
self.publisher.addFakeChroots(distroseries=self.distroseries)
- self.builder_one = self.factory.makeBuilder(processor=pf_proc_1)
- self.builder_two = self.factory.makeBuilder(processor=pf_proc_2)
+ self.builder_one = self.factory.makeBuilder(
+ processor=self.processor_one)
+ self.builder_two = self.factory.makeBuilder(
+ processor=self.processor_two)
self.builds = []
self.createBuilds()
@@ -202,12 +199,7 @@
super(TestBuilderHasBuildRecords, self).setUp()
# Create a 386 builder
- owner = self.factory.makePerson()
- processor_family = ProcessorFamilySet().getByProcessorName('386')
- processor = processor_family.processors[0]
- self.context = self.factory.makeBuilder(
- processor, 'http://example.com', 'Newbob', 'New Bob the Builder',
- owner=owner)
+ self.context = self.factory.makeBuilder()
# Ensure that our builds were all built by the test builder.
for build in self.builds:
@@ -313,18 +305,17 @@
# Set up a distroseries and related bits, so we can create builds.
source_name = self.factory.getUniqueString()
spn = self.factory.makeSourcePackageName(name=source_name)
- pf = self.factory.makeProcessorFamily()
- pf_proc = pf.addProcessor(self.factory.getUniqueString(), '', '')
+ processor = self.factory.makeProcessor()
distroseries = self.factory.makeDistroSeries()
das = self.factory.makeDistroArchSeries(
- distroseries=distroseries, processorfamily=pf,
+ distroseries=distroseries, processor=processor,
supports_virtualized=True)
with person_logged_in(admin):
publisher = SoyuzTestPublisher()
publisher.prepareBreezyAutotest()
publisher.addFakeChroots(distroseries=distroseries)
distroseries.nominatedarchindep = das
- self.factory.makeBuilder(processor=pf_proc)
+ self.factory.makeBuilder(processor=processor)
spph = self.factory.makeSourcePackagePublishingHistory(
sourcepackagename=spn, distroseries=distroseries)
spph.createMissingBuilds()
=== modified file 'lib/lp/soyuz/tests/test_initializedistroseriesjob.py'
--- lib/lp/soyuz/tests/test_initializedistroseriesjob.py 2013-09-12 02:29:55 +0000
+++ lib/lp/soyuz/tests/test_initializedistroseriesjob.py 2013-09-23 02:43:48 +0000
@@ -20,7 +20,10 @@
InitializationPending,
)
from lp.soyuz.interfaces.packageset import IPackagesetSet
-from lp.soyuz.interfaces.processor import IProcessorFamilySet
+from lp.soyuz.interfaces.processor import (
+ IProcessorSet,
+ ProcessorNotFound,
+ )
from lp.soyuz.interfaces.publishing import PackagePublishingStatus
from lp.soyuz.interfaces.sourcepackageformat import (
ISourcePackageFormatSelectionSet,
@@ -229,11 +232,10 @@
def create_child(factory):
- pf = factory.makeProcessorFamily()
- pf.addProcessor('x86', '', '')
+ processor = factory.makeProcessor()
parent = factory.makeDistroSeries()
parent_das = factory.makeDistroArchSeries(
- distroseries=parent, processorfamily=pf)
+ distroseries=parent, processor=processor)
lf = factory.makeLibraryFileAlias()
# Since the LFA needs to be in the librarian, commit.
transaction.commit()
@@ -272,13 +274,13 @@
def job_source(self):
return getUtility(IInitializeDistroSeriesJobSource)
- def setupDas(self, parent, proc, arch_tag):
- pf = getUtility(IProcessorFamilySet).getByName(proc)
- if pf.processors.is_empty():
- self.factory.makeProcessor(family=pf)
+ def setupDas(self, parent, processor_name, arch_tag):
+ try:
+ processor = getUtility(IProcessorSet).getByName(processor_name)
+ except ProcessorNotFound:
+ processor = self.factory.makeProcessor(name=processor_name)
parent_das = self.factory.makeDistroArchSeries(
- distroseries=parent, processorfamily=pf,
- architecturetag=arch_tag)
+ distroseries=parent, processor=processor, architecturetag=arch_tag)
lf = self.factory.makeLibraryFileAlias()
transaction.commit()
parent_das.addOrUpdateChroot(lf)
=== modified file 'lib/lp/soyuz/tests/test_packagecloner.py'
--- lib/lp/soyuz/tests/test_packagecloner.py 2012-04-26 21:23:33 +0000
+++ lib/lp/soyuz/tests/test_packagecloner.py 2013-09-23 02:43:48 +0000
@@ -17,11 +17,11 @@
from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet
from lp.soyuz.interfaces.component import IComponentSet
from lp.soyuz.interfaces.packagecloner import IPackageCloner
+from lp.soyuz.interfaces.processor import IProcessorSet
from lp.soyuz.interfaces.publishing import (
active_publishing_status,
IPublishingSet,
)
-from lp.soyuz.model.processor import ProcessorFamilySet
from lp.testing import TestCaseWithFactory
from lp.testing.layers import LaunchpadZopelessLayer
@@ -78,7 +78,7 @@
distribution=distro, name=distroseries_name)
das = self.factory.makeDistroArchSeries(
distroseries=distroseries, architecturetag="i386",
- processorfamily=ProcessorFamilySet().getByName("x86"),
+ processor=getUtility(IProcessorSet).getByName('386'),
supports_virtualized=True)
distroseries.nominatedarchindep = das
return distroseries
@@ -114,7 +114,7 @@
def makeCopyArchive(self, package_infos, component="main",
source_pocket=None, target_pocket=None,
- proc_families=None):
+ processors=None):
"""Make a copy archive based on a new distribution."""
distroseries = self.createSourceDistribution(package_infos)
copy_archive = self.getTargetArchive(distroseries.distribution)
@@ -122,7 +122,7 @@
self.copyArchive(
copy_archive, distroseries, from_pocket=source_pocket,
to_pocket=target_pocket, to_component=to_component,
- proc_families=proc_families)
+ processors=processors)
return (copy_archive, distroseries)
def checkBuilds(self, archive, package_infos):
@@ -145,7 +145,7 @@
def copyArchive(self, to_archive, to_distroseries, from_archive=None,
from_distroseries=None, from_pocket=None, to_pocket=None,
- to_component=None, packagesets=None, proc_families=None):
+ to_component=None, packagesets=None, processors=None):
"""Use a PackageCloner to copy an archive."""
if from_distroseries is None:
from_distroseries = to_distroseries
@@ -169,7 +169,7 @@
cloner = getUtility(IPackageCloner)
cloner.clonePackages(
origin, destination, distroarchseries_list=None,
- proc_families=proc_families)
+ processors=processors)
return cloner
def testCopiesPublished(self):
@@ -318,8 +318,8 @@
self.checkCopiedSources(
copy_archive, distroseries, [package_info])
- def testCreatesNoBuildsWithNoProcFamilies(self):
- """Test that no builds are created if we specify no proc families."""
+ def testCreatesNoBuildsWithNoProcessors(self):
+ """Test that no builds are created if we specify no processors."""
package_info = PackageInfo(
"bzr", "2.1", status=PackagePublishingStatus.PUBLISHED)
copy_archive, distroseries = self.makeCopyArchive([package_info])
@@ -329,71 +329,71 @@
"""Test that a copy archive creates builds for the copied packages."""
package_info = PackageInfo(
"bzr", "2.1", status=PackagePublishingStatus.PUBLISHED)
- # This is the processor family for the DAS that the source has,
- # so we expect to get builds.
- proc_families = [ProcessorFamilySet().getByName("x86")]
+ # This is the processor for the DAS that the source has, so we expect
+ # to get builds.
+ processors = [getUtility(IProcessorSet).getByName('386')]
copy_archive, distroseries = self.makeCopyArchive(
- [package_info], proc_families=proc_families)
+ [package_info], processors=processors)
self.checkBuilds(copy_archive, [package_info])
- def testNoBuildsIfProcFamilyNotInSource(self):
- """Test that no builds are created for a proc family without a DAS."""
+ def testNoBuildsIfProcessorNotInSource(self):
+ """Test that no builds are created for a processor without a DAS."""
package_info = PackageInfo(
"bzr", "2.1", status=PackagePublishingStatus.PUBLISHED)
- # This is a processor family without a DAS in the source, so
- # we expect no builds.
- family = self.factory.makeProcessorFamily(name="armel")
- proc_families = [family]
+ # This is a processor without a DAS in the source, so we expect no
+ # builds.
+ processors = [self.factory.makeProcessor(name="armel")]
copy_archive, distroseries = self.makeCopyArchive(
- [package_info], proc_families=proc_families)
+ [package_info], processors=processors)
self.checkBuilds(copy_archive, [])
- def testBuildsOnlyForProcFamiliesInSource(self):
- """Test that builds are only created for proc families in source."""
+ def testBuildsOnlyForProcessorsInSource(self):
+ """Test that builds are only created for processors in source."""
package_info = PackageInfo(
"bzr", "2.1", status=PackagePublishingStatus.PUBLISHED)
- # One of these processor families has a DAS in the source, so
- # we expect one set of builds
- family = self.factory.makeProcessorFamily(name="armel")
- proc_families = [family, ProcessorFamilySet().getByName("x86")]
+ # One of these processors has a DAS in the source, so we expect one
+ # set of builds.
+ processors = [
+ self.factory.makeProcessor(name="armel"),
+ getUtility(IProcessorSet).getByName('386')]
copy_archive, distroseries = self.makeCopyArchive(
- [package_info], proc_families=proc_families)
+ [package_info], processors=processors)
self.checkBuilds(copy_archive, [package_info])
def testCreatesSubsetOfBuilds(self):
- """Test that builds are only created for requested families."""
+ """Test that builds are only created for requested processors."""
package_info = PackageInfo(
"bzr", "2.1", status=PackagePublishingStatus.PUBLISHED)
distroseries = self.createSourceDistribution([package_info])
- # Create a DAS for a second family
+ # Create a DAS for a second processor.
self.factory.makeDistroArchSeries(
distroseries=distroseries, architecturetag="amd64",
- processorfamily=ProcessorFamilySet().getByName("amd64"),
+ processor=getUtility(IProcessorSet).getByName('amd64'),
supports_virtualized=True)
- # The request builds for only one of the families, so we
- # expect just one build for each source
- proc_families = [ProcessorFamilySet().getByName("x86")]
+ # The request builds for only one of the processors, so we
+ # expect just one build for each source.
+ processors = [getUtility(IProcessorSet).getByName('386')]
copy_archive = self.getTargetArchive(distroseries.distribution)
self.copyArchive(
- copy_archive, distroseries, proc_families=proc_families)
+ copy_archive, distroseries, processors=processors)
self.checkBuilds(copy_archive, [package_info])
def testCreatesMultipleBuilds(self):
- """Test that multiple families result in mutiple builds."""
+ """Test that multiple processors result in mutiple builds."""
package_info = PackageInfo(
"bzr", "2.1", status=PackagePublishingStatus.PUBLISHED)
distroseries = self.createSourceDistribution([package_info])
- # Create a DAS for a second family
- amd64_family = ProcessorFamilySet().getByName("amd64")
+ # Create a DAS for a second processor.
+ amd64 = getUtility(IProcessorSet).getByName('amd64')
self.factory.makeDistroArchSeries(
distroseries=distroseries, architecturetag="amd64",
- processorfamily=amd64_family, supports_virtualized=True)
- # The request builds for both families, so we expect two builds
+ processor=amd64, supports_virtualized=True)
+ # The request builds for both processors, so we expect two builds
# per source.
- proc_families = [ProcessorFamilySet().getByName("x86"), amd64_family]
+ processors = [getUtility(IProcessorSet).getByName('386'), amd64]
copy_archive = self.getTargetArchive(distroseries.distribution)
self.copyArchive(
- copy_archive, distroseries, proc_families=proc_families)
+ copy_archive, distroseries, processors=processors)
self.checkBuilds(copy_archive, [package_info, package_info])
def diffArchives(self, target_archive, target_distroseries,
@@ -590,11 +590,11 @@
self.checkCopiedSources(
copy_archive, distroseries, [package_infos[1]] + package_infos2)
- def setArchiveArchitectures(self, archive, proc_families):
- """Associate the archive with the processor families."""
+ def setArchiveArchitectures(self, archive, processors):
+ """Associate the archive with the processors."""
aa_set = getUtility(IArchiveArchSet)
- for proc_family in proc_families:
- aa_set.new(archive, proc_family)
+ for processor in processors:
+ aa_set.new(archive, processor)
def testMergeCopyCreatesBuilds(self):
package_infos = [
@@ -603,10 +603,10 @@
PackageInfo(
"apt", "1.2", status=PackagePublishingStatus.PUBLISHED),
]
- proc_families = [ProcessorFamilySet().getByName("x86")]
+ processors = [getUtility(IProcessorSet).getByName('386')]
copy_archive, distroseries = self.makeCopyArchive(
- package_infos, proc_families=proc_families)
- self.setArchiveArchitectures(copy_archive, proc_families)
+ package_infos, processors=processors)
+ self.setArchiveArchitectures(copy_archive, processors)
package_infos2 = [
PackageInfo(
"bzr", "2.2", status=PackagePublishingStatus.PUBLISHED),
@@ -624,16 +624,16 @@
PackageInfo(
"bzr", "2.1", status=PackagePublishingStatus.PUBLISHED),
]
- # We specify no processor families at creation time
+ # We specify no processors at creation time.
copy_archive, distroseries = self.makeCopyArchive(
- package_infos, proc_families=[])
+ package_infos, processors=[])
package_infos2 = [
PackageInfo(
"bzr", "2.2", status=PackagePublishingStatus.PUBLISHED),
]
self.createSourcePublications(package_infos2, distroseries)
self.mergeCopy(copy_archive, distroseries)
- # And so we get no builds at merge time
+ # And so we get no builds at merge time.
self.checkBuilds(copy_archive, [])
def testMergeCopyCreatesBuildsForMultipleArchitectures(self):
@@ -644,18 +644,18 @@
"apt", "1.2", status=PackagePublishingStatus.PUBLISHED),
]
distroseries = self.createSourceDistribution(package_infos)
- # Create a DAS for a second family
- amd64_family = ProcessorFamilySet().getByName("amd64")
+ # Create a DAS for a second processor.
+ amd64 = getUtility(IProcessorSet).getByName('amd64')
self.factory.makeDistroArchSeries(
distroseries=distroseries, architecturetag="amd64",
- processorfamily=amd64_family, supports_virtualized=True)
- # The request builds for both families, so we expect two builds
+ processor=amd64, supports_virtualized=True)
+ # The request builds for both processors, so we expect two builds
# per source.
- proc_families = [ProcessorFamilySet().getByName("x86"), amd64_family]
+ processors = [getUtility(IProcessorSet).getByName('386'), amd64]
copy_archive = self.getTargetArchive(distroseries.distribution)
- self.setArchiveArchitectures(copy_archive, proc_families)
+ self.setArchiveArchitectures(copy_archive, processors)
self.copyArchive(
- copy_archive, distroseries, proc_families=proc_families)
+ copy_archive, distroseries, processors=processors)
package_infos2 = [
PackageInfo(
"bzr", "2.2", status=PackagePublishingStatus.PUBLISHED),
=== modified file 'lib/lp/soyuz/tests/test_processor.py'
--- lib/lp/soyuz/tests/test_processor.py 2013-06-20 05:50:00 +0000
+++ lib/lp/soyuz/tests/test_processor.py 2013-09-23 02:43:48 +0000
@@ -1,15 +1,13 @@
# Copyright 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
-"""Test Processor and ProcessorFamily features."""
+"""Test Processor features."""
from zope.component import getUtility
from lp.services.database.interfaces import IStore
from lp.soyuz.interfaces.processor import (
IProcessor,
- IProcessorFamily,
- IProcessorFamilySet,
IProcessorSet,
ProcessorNotFound,
)
@@ -19,53 +17,17 @@
logout,
TestCaseWithFactory,
)
-from lp.testing.layers import (
- DatabaseFunctionalLayer,
- LaunchpadZopelessLayer,
- )
+from lp.testing.layers import DatabaseFunctionalLayer
from lp.testing.pages import LaunchpadWebServiceCaller
-class ProcessorFamilyTests(TestCaseWithFactory):
- """Test ProcessorFamily."""
-
- layer = LaunchpadZopelessLayer
-
- def test_create(self):
- """Test adding a new ProcessorFamily."""
- family = getUtility(IProcessorFamilySet).new("avr", "Atmel AVR",
- "The Modified Harvard architecture 8-bit RISC processors.")
- self.assertProvides(family, IProcessorFamily)
-
- def test_add_processor(self):
- """Test adding a new Processor to a ProcessorFamily."""
- family = getUtility(IProcessorFamilySet).new("avr", "Atmel AVR",
- "The Modified Harvard architecture 8-bit RISC processors.")
- proc = family.addProcessor(
- "avr2001", "The 2001 AVR", "Fast as light.")
- self.assertProvides(proc, IProcessor)
- self.assertEquals(family, proc.family)
-
- def test_get_restricted(self):
- """Test retrieving all restricted processors."""
- family_set = getUtility(IProcessorFamilySet)
- normal_family = getUtility(IProcessorFamilySet).new(
- "avr", "Atmel AVR",
- "The Modified Harvard architecture 8-bit RISC processors.")
- restricted_family = getUtility(IProcessorFamilySet).new(
- "5051", "5051", "Another small processor family",
- restricted=True)
- self.assertFalse(normal_family in family_set.getRestricted())
- self.assertTrue(restricted_family in family_set.getRestricted())
-
-
class ProcessorSetTests(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def test_getByName(self):
processor_set = getUtility(IProcessorSet)
- q1 = self.factory.makeProcessorFamily(name='q1')
- self.assertEquals(q1.processors[0], processor_set.getByName('q1'))
+ q1 = self.factory.makeProcessor(name='q1')
+ self.assertEquals(q1, processor_set.getByName('q1'))
def test_getByName_not_found(self):
processor_set = getUtility(IProcessorSet)
@@ -77,15 +39,20 @@
# Make it easy to filter out sample data
store = IStore(Processor)
store.execute("UPDATE Processor SET name = 'sample_data_' || name")
- self.factory.makeProcessorFamily(name='q1')
- self.factory.makeProcessorFamily(name='i686')
- self.factory.makeProcessorFamily(name='g4')
+ self.factory.makeProcessor(name='q1')
+ self.factory.makeProcessor(name='i686')
+ self.factory.makeProcessor(name='g4')
self.assertEquals(
['g4', 'i686', 'q1'],
sorted(
processor.name for processor in processor_set.getAll()
if not processor.name.startswith('sample_data_')))
+ def test_new(self):
+ proc = getUtility(IProcessorSet).new(
+ "avr2001", "The 2001 AVR", "Fast as light.")
+ self.assertProvides(proc, IProcessor)
+
class ProcessorSetWebServiceTests(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
@@ -95,22 +62,21 @@
self.webservice = LaunchpadWebServiceCaller()
def test_getByName(self):
- self.factory.makeProcessorFamily(name='transmeta')
+ self.factory.makeProcessor(name='transmeta')
logout()
processor = self.webservice.named_get(
'/+processors', 'getByName', name='transmeta',
- api_version='devel',
- ).jsonBody()
+ api_version='devel').jsonBody()
self.assertEquals('transmeta', processor['name'])
def test_default_collection(self):
# Make it easy to filter out sample data
store = IStore(Processor)
store.execute("UPDATE Processor SET name = 'sample_data_' || name")
- self.factory.makeProcessorFamily(name='q1')
- self.factory.makeProcessorFamily(name='i686')
- self.factory.makeProcessorFamily(name='g4')
+ self.factory.makeProcessor(name='q1')
+ self.factory.makeProcessor(name='i686')
+ self.factory.makeProcessor(name='g4')
logout()
=== modified file 'lib/lp/soyuz/tests/test_publishing.py'
--- lib/lp/soyuz/tests/test_publishing.py 2013-06-20 17:24:46 +0000
+++ lib/lp/soyuz/tests/test_publishing.py 2013-09-23 02:43:48 +0000
@@ -38,6 +38,7 @@
from lp.soyuz.interfaces.archivearch import IArchiveArchSet
from lp.soyuz.interfaces.binarypackagename import IBinaryPackageNameSet
from lp.soyuz.interfaces.component import IComponentSet
+from lp.soyuz.interfaces.processor import IProcessorSet
from lp.soyuz.interfaces.publishing import (
DeletionError,
IPublishingSet,
@@ -49,7 +50,6 @@
from lp.soyuz.interfaces.section import ISectionSet
from lp.soyuz.model.distroseriesdifferencejob import find_waiting_jobs
from lp.soyuz.model.distroseriespackagecache import DistroSeriesPackageCache
-from lp.soyuz.model.processor import ProcessorFamily
from lp.soyuz.model.publishing import (
BinaryPackagePublishingHistory,
SourcePackagePublishingHistory,
@@ -118,13 +118,14 @@
self.breezy_autotest_i386 = self.breezy_autotest['i386']
except NotFoundError:
self.breezy_autotest_i386 = self.breezy_autotest.newArch(
- 'i386', ProcessorFamily.get(1), False, self.person,
- supports_virtualized=True)
+ 'i386', getUtility(IProcessorSet).getByName('386'), False,
+ self.person, supports_virtualized=True)
try:
self.breezy_autotest_hppa = self.breezy_autotest['hppa']
except NotFoundError:
self.breezy_autotest_hppa = self.breezy_autotest.newArch(
- 'hppa', ProcessorFamily.get(4), False, self.person)
+ 'hppa', getUtility(IProcessorSet).getByName('hppa'), False,
+ self.person)
self.breezy_autotest.nominatedarchindep = self.breezy_autotest_i386
fake_chroot = self.addMockFile('fake_chroot.tar.gz')
self.breezy_autotest_i386.addOrUpdateChroot(fake_chroot)
@@ -837,17 +838,14 @@
self.distroseries = self.factory.makeDistroSeries(
distribution=self.distro, name="crazy")
self.archive = self.factory.makeArchive()
- self.avr_family = self.factory.makeProcessorFamily(
- name="avr", restricted=True)
- self.factory.makeProcessor(self.avr_family, "avr2001")
+ self.avr = self.factory.makeProcessor(name="avr2001", restricted=True)
self.avr_distroarch = self.factory.makeDistroArchSeries(
- architecturetag='avr', processorfamily=self.avr_family,
+ architecturetag='avr', processor=self.avr,
distroseries=self.distroseries, supports_virtualized=True)
- self.sparc_family = self.factory.makeProcessorFamily(name="sparc",
- restricted=False)
- self.factory.makeProcessor(self.sparc_family, "sparc64")
+ self.sparc = self.factory.makeProcessor(
+ name="sparc64", restricted=False)
self.sparc_distroarch = self.factory.makeDistroArchSeries(
- architecturetag='sparc', processorfamily=self.sparc_family,
+ architecturetag='sparc', processor=self.sparc,
distroseries=self.distroseries, supports_virtualized=True)
self.distroseries.nominatedarchindep = self.sparc_distroarch
self.addFakeChroots(self.distroseries)
@@ -883,7 +881,7 @@
an explicit ArchiveArch association with the archive.
"""
available_archs = [self.sparc_distroarch, self.avr_distroarch]
- getUtility(IArchiveArchSet).new(self.archive, self.avr_family)
+ getUtility(IArchiveArchSet).new(self.archive, self.avr)
pubrec = self.getPubSource(architecturehintlist='any')
self.assertEqual(
[self.sparc_distroarch, self.avr_distroarch],
@@ -922,7 +920,7 @@
architecture to architectures that are unrestricted or
explicitly associated with the archive.
"""
- getUtility(IArchiveArchSet).new(self.archive, self.avr_family)
+ getUtility(IArchiveArchSet).new(self.archive, self.avr)
pubrec = self.getPubSource(architecturehintlist='any')
builds = pubrec.createMissingBuilds()
self.assertEqual(2, len(builds))
=== modified file 'lib/lp/soyuz/tests/test_sourcepackagerelease.py'
--- lib/lp/soyuz/tests/test_sourcepackagerelease.py 2013-07-26 14:03:23 +0000
+++ lib/lp/soyuz/tests/test_sourcepackagerelease.py 2013-09-23 02:43:48 +0000
@@ -249,7 +249,7 @@
# archtag as the parent.
das_derived = self.factory.makeDistroArchSeries(
dsp.derived_series, architecturetag=das.architecturetag,
- processorfamily=das.processorfamily, supports_virtualized=True)
+ processor=das.processor, supports_virtualized=True)
# Now copy the package to the derived series, with binary.
derived_archive = dsp.derived_series.main_archive
getUtility(ISourcePackageFormatSelectionSet).add(
=== modified file 'lib/lp/soyuz/vocabularies.py'
--- lib/lp/soyuz/vocabularies.py 2013-07-22 15:14:38 +0000
+++ lib/lp/soyuz/vocabularies.py 2013-09-23 02:43:48 +0000
@@ -10,7 +10,6 @@
'FilteredDistroArchSeriesVocabulary',
'PackageReleaseVocabulary',
'PPAVocabulary',
- 'ProcessorFamilyVocabulary',
'ProcessorVocabulary',
]
@@ -36,10 +35,7 @@
from lp.soyuz.model.archive import Archive
from lp.soyuz.model.component import Component
from lp.soyuz.model.distroarchseries import DistroArchSeries
-from lp.soyuz.model.processor import (
- Processor,
- ProcessorFamily,
- )
+from lp.soyuz.model.processor import Processor
from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
@@ -159,9 +155,3 @@
displayname = 'Select a processor'
_table = Processor
_orderBy = 'name'
-
-
-class ProcessorFamilyVocabulary(NamedSQLObjectVocabulary):
- displayname = 'Select a processor family'
- _table = ProcessorFamily
- _orderBy = 'name'
=== modified file 'lib/lp/soyuz/vocabularies.zcml'
--- lib/lp/soyuz/vocabularies.zcml 2011-12-24 17:49:30 +0000
+++ lib/lp/soyuz/vocabularies.zcml 2013-09-23 02:43:48 +0000
@@ -68,17 +68,4 @@
<allow interface="lp.services.webapp.vocabulary.IHugeVocabulary"/>
</class>
-
- <securedutility
- name="ProcessorFamily"
- component="lp.soyuz.vocabularies.ProcessorFamilyVocabulary"
- provides="zope.schema.interfaces.IVocabularyFactory"
- >
- <allow interface="zope.schema.interfaces.IVocabularyFactory"/>
- </securedutility>
-
- <class class="lp.soyuz.vocabularies.ProcessorFamilyVocabulary">
- <allow interface="lp.services.webapp.vocabulary.IHugeVocabulary"/>
- </class>
-
</configure>
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2013-08-29 06:27:28 +0000
+++ lib/lp/testing/factory.py 2013-09-23 02:43:48 +0000
@@ -289,7 +289,7 @@
)
from lp.soyuz.interfaces.packagecopyjob import IPlainPackageCopyJobSource
from lp.soyuz.interfaces.packageset import IPackagesetSet
-from lp.soyuz.interfaces.processor import IProcessorFamilySet
+from lp.soyuz.interfaces.processor import IProcessorSet
from lp.soyuz.interfaces.publishing import IPublishingSet
from lp.soyuz.interfaces.queue import IPackageUploadSet
from lp.soyuz.interfaces.section import ISectionSet
@@ -302,7 +302,6 @@
SourcePackageReleaseFile,
)
from lp.soyuz.model.packagediff import PackageDiff
-from lp.soyuz.model.processor import ProcessorFamilySet
from lp.testing import (
admin_logged_in,
ANONYMOUS,
@@ -888,51 +887,24 @@
productseries=productseries, distroseries=distroseries,
name=name, active=active, dateexpected=dateexpected))
- def makeProcessor(self, family=None, name=None, title=None,
- description=None):
+ def makeProcessor(self, name=None, title=None, description=None,
+ restricted=False):
"""Create a new processor.
- :param family: Family of the processor
:param name: Name of the processor
:param title: Optional title
:param description: Optional description
+ :param restricted: If the processor is restricted.
:return: A `IProcessor`
"""
if name is None:
name = self.getUniqueString()
- if family is None:
- family = self.makeProcessorFamily()
if title is None:
title = "The %s processor" % name
if description is None:
- description = "The %s and processor and compatible processors"
- return family.addProcessor(name, title, description)
-
- def makeProcessorFamily(self, name=None, title=None, description=None,
- restricted=False):
- """Create a new processor family.
-
- A default processor for the family will be created with the
- same name as the family.
-
- :param name: Name of the family (e.g. x86)
- :param title: Optional title of the family
- :param description: Optional extended description
- :param restricted: Whether the processor family is restricted
- :return: A `IProcessorFamily`
- """
- if name is None:
- name = self.getUniqueString()
- if description is None:
- description = "Description of the %s processor family" % name
- if title is None:
- title = "%s and compatible processors." % name
- family = getUtility(IProcessorFamilySet).new(
- name, title, description, restricted=restricted)
- # Make sure there's at least one processor in the family, so that
- # other things can have a default processor.
- self.makeProcessor(name=name, family=family)
- return family
+ description = "The %s processor and compatible processors" % name
+ return getUtility(IProcessorSet).new(
+ name, title, description, restricted)
def makeProductRelease(self, milestone=None, product=None,
productseries=None):
@@ -2651,24 +2623,24 @@
component)
def makeDistroArchSeries(self, distroseries=None,
- architecturetag=None, processorfamily=None,
+ architecturetag=None, processor=None,
official=True, owner=None,
supports_virtualized=False, enabled=True):
"""Create a new distroarchseries"""
if distroseries is None:
distroseries = self.makeDistroSeries()
- if processorfamily is None:
- processorfamily = self.makeProcessorFamily()
+ if processor is None:
+ processor = self.makeProcessor()
if owner is None:
owner = self.makePerson()
- # XXX: architecturetag & processorfamily are tightly coupled. It's
+ # XXX: architecturetag & processor are tightly coupled. It's
# wrong to just make a fresh architecture tag without also making a
- # processor family to go with it (ideally with processors!)
+ # processor to go with it.
if architecturetag is None:
architecturetag = self.getUniqueString('arch')
return distroseries.newArch(
- architecturetag, processorfamily, official, owner,
+ architecturetag, processor, official, owner,
supports_virtualized, enabled)
def makeComponent(self, name=None):
@@ -2783,8 +2755,7 @@
test environment.
"""
if processor is None:
- processor_fam = ProcessorFamilySet().getByName('x86')
- processor = processor_fam.processors[0]
+ processor = getUtility(IProcessorSet).getByName('386')
if url is None:
url = 'http://%s:8221/' % self.getUniqueString()
if name is None:
@@ -3625,8 +3596,7 @@
else:
distroseries = self.makeDistroSeries()
distroarchseries = self.makeDistroArchSeries(
- distroseries=distroseries,
- processorfamily=processor.family)
+ distroseries=distroseries, processor=processor)
if archive is None:
if source_package_release is None:
archive = distroarchseries.main_archive
=== modified file 'lib/lp/translations/model/translationtemplatesbuild.py'
--- lib/lp/translations/model/translationtemplatesbuild.py 2013-06-20 05:50:00 +0000
+++ lib/lp/translations/model/translationtemplatesbuild.py 2013-09-23 02:43:48 +0000
@@ -127,7 +127,7 @@
# default processor architecture. This stops the buildfarm from
# accidentally dispatching the jobs to private builders.
ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
- return ubuntu.currentseries.nominatedarchindep.default_processor
+ return ubuntu.currentseries.nominatedarchindep.processor
@classmethod
def create(cls, branch):
=== modified file 'lib/lp/translations/tests/test_translationtemplatesbuildjob.py'
--- lib/lp/translations/tests/test_translationtemplatesbuildjob.py 2013-09-02 08:11:58 +0000
+++ lib/lp/translations/tests/test_translationtemplatesbuildjob.py 2013-09-23 02:43:48 +0000
@@ -91,10 +91,9 @@
buildqueue = queueset.get(job_id)
ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
- expected_processor = (
- ubuntu.currentseries.nominatedarchindep.default_processor)
-
- self.assertEquals(expected_processor, buildqueue.processor)
+ self.assertEquals(
+ ubuntu.currentseries.nominatedarchindep.processor,
+ buildqueue.processor)
def test_score(self):
# For now, these jobs always score themselves at 2510. In the
=== modified file 'utilities/soyuz-sampledata-setup.py'
--- utilities/soyuz-sampledata-setup.py 2013-09-20 05:25:18 +0000
+++ utilities/soyuz-sampledata-setup.py 2013-09-23 02:43:48 +0000
@@ -46,7 +46,7 @@
from lp.services.scripts.base import LaunchpadScript
from lp.soyuz.enums import SourcePackageFormat
from lp.soyuz.interfaces.component import IComponentSet
-from lp.soyuz.interfaces.processor import IProcessorFamilySet
+from lp.soyuz.interfaces.processor import IProcessorSet
from lp.soyuz.interfaces.section import ISectionSet
from lp.soyuz.interfaces.sourcepackageformat import (
ISourcePackageFormatSelectionSet,
@@ -146,11 +146,11 @@
# Avoid circular import.
from lp.soyuz.model.distroarchseries import DistroArchSeries
- family = getUtility(IProcessorFamilySet).getByName(architecture_name)
+ processor = getUtility(IProcessorSet).getByName(architecture_name)
archseries = DistroArchSeries(
- distroseries=distroseries, processorfamily=family,
- processor=family.processors[0], owner=distroseries.owner,
- official=True, architecturetag=architecture_name)
+ distroseries=distroseries, processor=processor,
+ owner=distroseries.owner, official=True,
+ architecturetag=architecture_name)
IMasterStore(DistroArchSeries).add(archseries)