← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/rebuild-support-ids into lp:launchpad/devel

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/rebuild-support-ids into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


This branch adds rebuild support to InitialiseDistroSeries. It will still create the DistroArchSeries for the new distroseries, but fools clone_packages() into not copying any binaries to the child distroseries.

I have added a test, and drove-by a change to _full_initialise() which makes the arches check shorter.
-- 
https://code.launchpad.net/~stevenk/launchpad/rebuild-support-ids/+merge/36108
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/rebuild-support-ids into lp:launchpad/devel.
=== modified file 'lib/lp/soyuz/scripts/initialise_distroseries.py'
--- lib/lp/soyuz/scripts/initialise_distroseries.py	2010-09-09 17:02:33 +0000
+++ lib/lp/soyuz/scripts/initialise_distroseries.py	2010-09-21 07:33:45 +0000
@@ -59,10 +59,11 @@
       in the initialisation of a derivative.
     """
 
-    def __init__(self, distroseries, arches=()):
+    def __init__(self, distroseries, arches=(), rebuild=False):
         self.distroseries = distroseries
         self.parent = self.distroseries.parent_series
         self.arches = arches
+        self.rebuild = rebuild
         self._store = IMasterStore(DistroSeries)
 
     def check(self):
@@ -194,6 +195,8 @@
             destination = PackageLocation(
                 target_archive, self.distroseries.distribution,
                 self.distroseries, PackagePublishingPocket.RELEASE)
+            if self.rebuild is True:
+                distroarchseries_list = ()
             clone_packages(origin, destination, distroarchseries_list)
 
     def _copy_component_section_and_format_selections(self):

=== modified file 'lib/lp/soyuz/scripts/tests/test_initialise_distroseries.py'
--- lib/lp/soyuz/scripts/tests/test_initialise_distroseries.py	2010-09-09 17:02:33 +0000
+++ lib/lp/soyuz/scripts/tests/test_initialise_distroseries.py	2010-09-21 07:33:45 +0000
@@ -124,11 +124,11 @@
             foobuntu.isSourcePackageFormatPermitted(
             SourcePackageFormat.FORMAT_1_0))
 
-    def _full_initialise(self):
+    def _full_initialise(self, arches=(), rebuild=False):
         foobuntu = self._create_distroseries(self.hoary)
         self._set_pending_to_failed(self.hoary)
         transaction.commit()
-        ids = InitialiseDistroSeries(foobuntu)
+        ids = InitialiseDistroSeries(foobuntu, arches, rebuild)
         ids.check()
         ids.initialise()
         return foobuntu
@@ -141,12 +141,7 @@
     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()
+        foobuntu = self._full_initialise(arches=('i386',))
         self.assertDistroSeriesInitialisedCorrectly(foobuntu)
         das = list(IStore(DistroArchSeries).find(
             DistroArchSeries, distroseries = foobuntu))
@@ -240,6 +235,13 @@
                 foobuntu.main_archive, 'pmount', uploader,
                 distroseries=foobuntu))
 
+    def test_rebuild_flag(self):
+        # No binaries will get copied if we specify rebuild=True
+        foobuntu = self._full_initialise(rebuild=True)
+        foobuntu.updatePackageCount()
+        self.assertTrue(foobuntu.sourcecount > 0)
+        self.assertEqual(foobuntu.binarycount, 0)
+
     def test_script(self):
         # Do an end-to-end test using the command-line tool
         uploader = self.factory.makePerson()