← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/launchpad/bug-815751 into lp:launchpad

 

Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/bug-815751 into lp:launchpad with lp:~rvb/launchpad/use-copier-first-init-bug-814643 as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #815751 in Launchpad itself: "In initialize_series, the package copier copy method should be called with all the packages from pockets RELEASED, UPDATES, SECURITY."
  https://bugs.launchpad.net/launchpad/+bug/815751

For more details, see:
https://code.launchpad.net/~rvb/launchpad/bug-815751/+merge/69120

This branches fixes the call to the package copier in initialize_series so that the packages from the pockets UPDATES and SECURITY will also be copied into the child series.

= Tests =

./bin/test -vvc test_initialize_distroseries test_success_with_security_packages
./bin/test -vvc test_initialize_distroseries test_success_with_updates_packages

= QA =

First-initialize (https://dev.launchpad.net/LEP/DerivativeDistributions#Vocabulary) a series with packages in the UPDATES and SECURITY pockets and make sure that these packages end up in the child series.
-- 
https://code.launchpad.net/~rvb/launchpad/bug-815751/+merge/69120
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/bug-815751 into lp:launchpad.
=== modified file 'lib/lp/soyuz/scripts/initialize_distroseries.py'
--- lib/lp/soyuz/scripts/initialize_distroseries.py	2011-07-25 16:01:36 +0000
+++ lib/lp/soyuz/scripts/initialize_distroseries.py	2011-07-25 16:01:38 +0000
@@ -432,9 +432,14 @@
                 else:
                     # There is only one available pocket in an unreleased
                     # series.
-                    pocket = PackagePublishingPocket.RELEASE
+                    target_pocket = PackagePublishingPocket.RELEASE
+                    pockets_to_copy = (
+                        PackagePublishingPocket.RELEASE,
+                        PackagePublishingPocket.UPDATES,
+                        PackagePublishingPocket.SECURITY)
                     sources = archive.getPublishedSources(
-                        distroseries=parent, pocket=pocket, name=spns)
+                        distroseries=parent, pocket=pockets_to_copy,
+                        name=spns)
                     # XXX: rvb 2011-06-23 bug=801112: do_copy is atomic (all
                     # or none of the sources will be copied). This might
                     # lead to a partially initialised series if there is a
@@ -442,7 +447,7 @@
                     try:
                         sources_published = do_copy(
                             sources, target_archive, self.distroseries,
-                            pocket, include_binaries=not self.rebuild,
+                            target_pocket, include_binaries=not self.rebuild,
                             check_permissions=False, strict_binaries=False,
                             close_bugs=False, create_dsd_job=False)
                         if self.rebuild:

=== modified file 'lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py'
--- lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py	2011-07-25 16:01:36 +0000
+++ lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py	2011-07-25 16:01:38 +0000
@@ -59,7 +59,9 @@
     # - initialize a child from parents.
 
     def setupParent(self, packages=None, format_selection=None,
-                    distribution=None):
+                    distribution=None,
+                    pocket=PackagePublishingPocket.RELEASE,
+                    ):
         parent = self.factory.makeDistroSeries(distribution)
         pf = getUtility(IProcessorFamilySet).getByName('x86')
         parent_das = self.factory.makeDistroArchSeries(
@@ -75,10 +77,11 @@
         getUtility(ISourcePackageFormatSelectionSet).add(
             parent, format_selection)
         parent.backports_not_automatic = True
-        self._populate_parent(parent, parent_das, packages)
+        self._populate_parent(parent, parent_das, packages, pocket)
         return parent, parent_das
 
-    def _populate_parent(self, parent, parent_das, packages=None):
+    def _populate_parent(self, parent, parent_das, packages=None,
+                         pocket=PackagePublishingPocket.RELEASE):
         if packages is None:
             packages = {'udev': '0.1-1', 'libc6': '2.8-1',
                 'postgresql': '9.0-1', 'chromium': '3.6'}
@@ -87,8 +90,7 @@
             spph = self.factory.makeSourcePackagePublishingHistory(
                 sourcepackagename=spn, version=packages[package],
                 distroseries=parent,
-                pocket=PackagePublishingPocket.RELEASE,
-                status=PackagePublishingStatus.PUBLISHED)
+                pocket=pocket, status=PackagePublishingStatus.PUBLISHED)
             status = BuildStatus.FULLYBUILT
             if package is 'chromium':
                 status = BuildStatus.FAILEDTOBUILD
@@ -104,8 +106,7 @@
                 self.factory.makeBinaryPackagePublishingHistory(
                     binarypackagerelease=bpr,
                     distroarchseries=parent_das,
-                    pocket=PackagePublishingPocket.RELEASE,
-                    status=PackagePublishingStatus.PUBLISHED)
+                    pocket=pocket, status=PackagePublishingStatus.PUBLISHED)
                 self.factory.makeBinaryPackageFile(binarypackagerelease=bpr)
 
     def _fullInitialize(self, parents, child=None, previous_series=None,
@@ -174,6 +175,22 @@
             InitializationError, "Parent series has pending builds.",
             ids.check)
 
+    def test_success_with_updates_packages(self):
+        # Initialization copies all the package from the UPDATES pocket.
+        self.parent, self.parent_das = self.setupParent(
+            pocket=PackagePublishingPocket.UPDATES)
+        child = self._fullInitialize([self.parent])
+        self.assertDistroSeriesInitializedCorrectly(
+            child, self.parent, self.parent_das)
+
+    def test_success_with_security_packages(self):
+        # Initialization copies all the package from the SECURITY pocket.
+        self.parent, self.parent_das = self.setupParent(
+            pocket=PackagePublishingPocket.SECURITY)
+        child = self._fullInitialize([self.parent])
+        self.assertDistroSeriesInitializedCorrectly(
+            child, self.parent, self.parent_das)
+
     def test_success_with_pending_builds(self):
         # If the parent series has pending builds, and the child's
         # distribution is different, we can initialize.