launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00673
[Merge] lp:~stevenk/launchpad/limit-arches-ifp into lp:launchpad/devel
Steve Kowalik has proposed merging lp:~stevenk/launchpad/limit-arches-ifp into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
This branch adds a feature to InitialiseDistroSeries and scripts/ftpmaster-tools/initialise-from-parent.py that allows the requestor to only copy a sub-set of architectures from the parent distroseries to the child distroseries, which is required by the derived distroseries work.
--
https://code.launchpad.net/~stevenk/launchpad/limit-arches-ifp/+merge/33102
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/limit-arches-ifp into lp:launchpad/devel.
=== modified file 'lib/lp/soyuz/scripts/initialise_distroseries.py'
--- lib/lp/soyuz/scripts/initialise_distroseries.py 2010-08-12 11:17:32 +0000
+++ lib/lp/soyuz/scripts/initialise_distroseries.py 2010-08-19 13:05:59 +0000
@@ -54,9 +54,10 @@
in the initialisation of a derivative.
"""
- def __init__(self, distroseries):
+ def __init__(self, distroseries, arches=()):
self.distroseries = distroseries
self.parent = self.distroseries.parent_series
+ self.arches = arches
self._store = getUtility(
IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
@@ -121,13 +122,16 @@
self._copy_packagesets()
def _copy_architectures(self):
+ include = ''
+ if self.arches:
+ include = "AND architecturetag IN %s" % sqlvalues(self.arches)
self._store.execute("""
INSERT INTO DistroArchSeries
(distroseries, processorfamily, architecturetag, owner, official)
SELECT %s, processorfamily, architecturetag, %s, official
- FROM DistroArchSeries WHERE distroseries = %s
- """ % sqlvalues(self.distroseries, self.distroseries.owner,
- self.parent))
+ FROM DistroArchSeries WHERE distroseries = %s %s
+ """ % (sqlvalues(self.distroseries, self.distroseries.owner,
+ self.parent) + (include,)))
self.distroseries.nominatedarchindep = self.distroseries[
self.parent.nominatedarchindep.architecturetag]
@@ -140,6 +144,8 @@
# shall be copied.
distroarchseries_list = []
for arch in self.distroseries.architectures:
+ if self.arches and (arch.architecturetag not in self.arches):
+ continue
parent_arch = self.parent[arch.architecturetag]
distroarchseries_list.append((parent_arch, arch))
# Now copy source and binary packages.
=== modified file 'lib/lp/soyuz/scripts/tests/test_initialise_distroseries.py'
--- lib/lp/soyuz/scripts/tests/test_initialise_distroseries.py 2010-08-12 12:48:17 +0000
+++ lib/lp/soyuz/scripts/tests/test_initialise_distroseries.py 2010-08-19 13:05:59 +0000
@@ -15,6 +15,7 @@
from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.soyuz.interfaces.packageset import IPackagesetSet
from lp.soyuz.interfaces.sourcepackageformat import SourcePackageFormat
+from lp.soyuz.model.distroarchseries import DistroArchSeries
from lp.soyuz.scripts.initialise_distroseries import (
InitialiseDistroSeries, InitialisationError)
from lp.testing import TestCaseWithFactory
@@ -22,6 +23,8 @@
from canonical.config import config
from canonical.launchpad.interfaces import IDistributionSet
from canonical.launchpad.ftests import login
+from canonical.launchpad.webapp.interfaces import (
+ IStoreSelector, MAIN_STORE, MASTER_FLAVOR)
from canonical.testing.layers import LaunchpadZopelessLayer
@@ -129,6 +132,21 @@
foobuntu = self._full_initialise()
self.assertDistroSeriesInitialisedCorrectly(foobuntu)
+ def test_initialise_only_i386(self):
+ # Test a full initialise with no errors, but only copy i386 to
+ # the child
+ foobuntu = self._create_distroseries(self.hoary)
+ self._set_pending_to_failed(self.hoary)
+ transaction.commit()
+ ids = InitialiseDistroSeries(foobuntu, ('i386',))
+ ids.check()
+ ids.initialise()
+ self.assertDistroSeriesInitialisedCorrectly(foobuntu)
+ store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+ das = list(store.find(DistroArchSeries, distroseries = foobuntu))
+ self.assertEqual(len(das), 1)
+ self.assertEqual(das[0].architecturetag, 'i386')
+
def test_check_no_builds(self):
# Test that there is no build for pmount 0.1-2 in the
# newly-initialised series.
=== modified file 'scripts/ftpmaster-tools/initialise-from-parent.py'
--- scripts/ftpmaster-tools/initialise-from-parent.py 2010-08-06 14:29:36 +0000
+++ scripts/ftpmaster-tools/initialise-from-parent.py 2010-08-19 13:05:59 +0000
@@ -36,6 +36,11 @@
default="ubuntu",
help="Distribution name")
+ parser.add_option(
+ "-a", "--arches", dest="arches",
+ help="A comma-seperated list of arches to limit the child "
+ "distroseries to inheriting")
+
(options, args) = parser.parse_args()
log = logger(options, "initialise")
@@ -69,7 +74,10 @@
log.debug('Check for no pending builds in parentseries')
log.debug('Copying distroarchseries from parent '
'and setting nominatedarchindep.')
- ids = InitialiseDistroSeries(distroseries)
+ arches = ()
+ if options.arches is not None:
+ arches = tuple(options.arches.split(','))
+ ids = InitialiseDistroSeries(distroseries, arches)
ids.check()
log.debug('initialising from parent, copying publishing records.')
ids.initialise()