launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #01256
[Merge] lp:~stevenk/launchpad/db-ids-enabled-dases into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/db-ids-enabled-dases into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
This branch makes a small change to InitialiseDistroSeries to not copy disabled DistroArchSerieses (!) when we copy them into the child distroseries. I've added a test, and as a bonus, it doesn't use sampledata.
--
https://code.launchpad.net/~stevenk/launchpad/db-ids-enabled-dases/+merge/36823
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/db-ids-enabled-dases into lp:launchpad.
=== modified file 'lib/lp/soyuz/scripts/initialise_distroseries.py'
--- lib/lp/soyuz/scripts/initialise_distroseries.py 2010-09-22 06:42:40 +0000
+++ lib/lp/soyuz/scripts/initialise_distroseries.py 2010-09-28 07:37:42 +0000
@@ -134,7 +134,8 @@
INSERT INTO DistroArchSeries
(distroseries, processorfamily, architecturetag, owner, official)
SELECT %s, processorfamily, architecturetag, %s, official
- FROM DistroArchSeries WHERE distroseries = %s %s
+ FROM DistroArchSeries WHERE distroseries = %s
+ AND enabled = TRUE %s
""" % (sqlvalues(self.distroseries, self.distroseries.owner,
self.parent) + (include,)))
=== modified file 'lib/lp/soyuz/scripts/tests/test_initialise_distroseries.py'
--- lib/lp/soyuz/scripts/tests/test_initialise_distroseries.py 2010-09-22 06:42:40 +0000
+++ lib/lp/soyuz/scripts/tests/test_initialise_distroseries.py 2010-09-28 07:37:42 +0000
@@ -246,6 +246,27 @@
self.assertEqual(foobuntu.binarycount, 0)
self.assertEqual(builds.count(), 5)
+ def test_do_not_copy_disabled_dases(self):
+ # DASes that are disabled in the parent will not be copied
+ i386 = self.factory.makeProcessorFamily()
+ ppc = self.factory.makeProcessorFamily()
+ parent = self.factory.makeDistroSeries()
+ i386_das = self.factory.makeDistroArchSeries(
+ distroseries=parent, processorfamily=i386)
+ ppc_das = self.factory.makeDistroArchSeries(
+ distroseries=parent, processorfamily=ppc)
+ ppc_das.enabled = False
+ parent.nominatedarchindep = i386_das
+ foobuntu = self._create_distroseries(parent)
+ ids = InitialiseDistroSeries(foobuntu)
+ ids.check()
+ ids.initialise()
+ das = list(IStore(DistroArchSeries).find(
+ DistroArchSeries, distroseries = foobuntu))
+ self.assertEqual(len(das), 1)
+ self.assertEqual(
+ das[0].architecturetag, i386_das.architecturetag)
+
def test_script(self):
# Do an end-to-end test using the command-line tool
uploader = self.factory.makePerson()