launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #01480
[Merge] lp:~stevenk/launchpad/db-add-parameters-to-idsjob into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/db-add-parameters-to-idsjob into lp:launchpad with lp:~stevenk/launchpad/ids-limit-packagesets as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
This branch allows creators of InitialiseDistroSeriesJob to specify (if needed) the architecutures and the packagesets to limit copying to, and if all source packages are to be rebuilt.
--
https://code.launchpad.net/~stevenk/launchpad/db-add-parameters-to-idsjob/+merge/38188
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/db-add-parameters-to-idsjob into lp:launchpad.
=== modified file 'lib/lp/soyuz/interfaces/distributionjob.py'
--- lib/lp/soyuz/interfaces/distributionjob.py 2010-09-16 01:38:42 +0000
+++ lib/lp/soyuz/interfaces/distributionjob.py 2010-10-12 08:08:00 +0000
@@ -58,7 +58,7 @@
class IInitialiseDistroSeriesJobSource(IJobSource):
"""An interface for acquiring IDistributionJobs."""
- def create(distroseries):
+ def create(distroseries, arches, packagesets, rebuild):
"""Create a new initialisation job for a distroseries."""
=== modified file 'lib/lp/soyuz/model/initialisedistroseriesjob.py'
--- lib/lp/soyuz/model/initialisedistroseriesjob.py 2010-09-16 01:38:42 +0000
+++ lib/lp/soyuz/model/initialisedistroseriesjob.py 2010-10-12 08:08:00 +0000
@@ -33,16 +33,34 @@
classProvides(IInitialiseDistroSeriesJobSource)
@classmethod
- def create(cls, distroseries):
+ def create(
+ cls, distroseries, arches=(), packagesets=(), rebuild=False):
"""See `IInitialiseDistroSeriesJob`."""
+ metadata = {
+ 'arches': arches, 'packagesets': packagesets,
+ 'rebuild': rebuild}
job = DistributionJob(
distroseries.distribution, distroseries, cls.class_job_type,
- ())
+ metadata)
IMasterStore(DistributionJob).add(job)
return cls(job)
+ @property
+ def arches(self):
+ return tuple(self.metadata['arches'])
+
+ @property
+ def packagesets(self):
+ return tuple(self.metadata['packagesets'])
+
+ @property
+ def rebuild(self):
+ return self.metadata['rebuild']
+
def run(self):
"""See `IRunnableJob`."""
- ids = InitialiseDistroSeries(self.distroseries)
+ ids = InitialiseDistroSeries(
+ self.distroseries, self.arches, self.packagesets,
+ self.rebuild)
ids.check()
ids.initialise()
=== modified file 'lib/lp/soyuz/scripts/tests/test_initialise_distroseries.py'
--- lib/lp/soyuz/scripts/tests/test_initialise_distroseries.py 2010-10-12 08:07:58 +0000
+++ lib/lp/soyuz/scripts/tests/test_initialise_distroseries.py 2010-10-12 08:08:00 +0000
@@ -272,7 +272,6 @@
self.assertEqual(child.binarycount, 0)
self.assertEqual(builds.count(), self.parent.sourcecount)
-<<<<<<< TREE
def test_do_not_copy_disabled_dases(self):
# DASes that are disabled in the parent will not be copied
ppc_das = self.factory.makeDistroArchSeries(
@@ -285,7 +284,6 @@
self.assertEqual(
das[0].architecturetag, self.parent_das.architecturetag)
-=======
def test_limit_packagesets_rebuild_and_one_das(self):
# We can limit the source packages copied, and only builds
# for the copied source will be created
@@ -315,7 +313,6 @@
self.assertEqual(
das[0].architecturetag, self.parent_das.architecturetag)
->>>>>>> MERGE-SOURCE
def test_script(self):
# Do an end-to-end test using the command-line tool
uploader = self.factory.makePerson()
=== modified file 'lib/lp/soyuz/tests/test_initialisedistroseriesjob.py'
--- lib/lp/soyuz/tests/test_initialisedistroseriesjob.py 2010-09-16 01:38:42 +0000
+++ lib/lp/soyuz/tests/test_initialisedistroseriesjob.py 2010-10-12 08:08:00 +0000
@@ -72,3 +72,19 @@
# returns an InitialisationError, then it's good.
self.assertRaisesWithContent(
InitialisationError, "Parent series required.", job.run)
+
+ def test_arguments(self):
+ """Test that InitialiseDistroSeriesJob specified with arguments can
+ be gotten out again."""
+ distroseries = self.factory.makeDistroSeries()
+ arches = (u'i386', u'amd64')
+ packagesets = (u'foo', u'bar', u'baz')
+
+ job = getUtility(IInitialiseDistroSeriesJobSource).create(
+ distroseries, arches, packagesets)
+
+ naked_job = removeSecurityProxy(job)
+ self.assertEqual(naked_job.distroseries, distroseries)
+ self.assertEqual(naked_job.arches, arches)
+ self.assertEqual(naked_job.packagesets, packagesets)
+ self.assertEqual(naked_job.rebuild, False)