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

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 13520
Proposed branch: lp:~rvb/launchpad/bug-815751
Merge into: lp:launchpad
Prerequisite: lp:~rvb/launchpad/use-copier-first-init-bug-814643
Diff against target: 101 lines (+32/-10)
2 files modified
lib/lp/soyuz/scripts/initialize_distroseries.py (+8/-3)
lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py (+24/-7)
To merge this branch: bzr merge lp:~rvb/launchpad/bug-815751
Reviewer Review Type Date Requested Status
Benji York (community) code Approve
Review via email: mp+69120@code.launchpad.net

Commit message

[r=benji][bug=815751] First-initialization copies package from RELEASE, UPDATES and SECURITY.

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Benji York (benji) wrote :

This branch looks good to me.

review: Approve (code)
Revision history for this message
Raphaël Badin (rvb) wrote :

Thanks for review!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/scripts/initialize_distroseries.py'
2--- lib/lp/soyuz/scripts/initialize_distroseries.py 2011-07-25 16:01:36 +0000
3+++ lib/lp/soyuz/scripts/initialize_distroseries.py 2011-07-25 16:01:38 +0000
4@@ -432,9 +432,14 @@
5 else:
6 # There is only one available pocket in an unreleased
7 # series.
8- pocket = PackagePublishingPocket.RELEASE
9+ target_pocket = PackagePublishingPocket.RELEASE
10+ pockets_to_copy = (
11+ PackagePublishingPocket.RELEASE,
12+ PackagePublishingPocket.UPDATES,
13+ PackagePublishingPocket.SECURITY)
14 sources = archive.getPublishedSources(
15- distroseries=parent, pocket=pocket, name=spns)
16+ distroseries=parent, pocket=pockets_to_copy,
17+ name=spns)
18 # XXX: rvb 2011-06-23 bug=801112: do_copy is atomic (all
19 # or none of the sources will be copied). This might
20 # lead to a partially initialised series if there is a
21@@ -442,7 +447,7 @@
22 try:
23 sources_published = do_copy(
24 sources, target_archive, self.distroseries,
25- pocket, include_binaries=not self.rebuild,
26+ target_pocket, include_binaries=not self.rebuild,
27 check_permissions=False, strict_binaries=False,
28 close_bugs=False, create_dsd_job=False)
29 if self.rebuild:
30
31=== modified file 'lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py'
32--- lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py 2011-07-25 16:01:36 +0000
33+++ lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py 2011-07-25 16:01:38 +0000
34@@ -59,7 +59,9 @@
35 # - initialize a child from parents.
36
37 def setupParent(self, packages=None, format_selection=None,
38- distribution=None):
39+ distribution=None,
40+ pocket=PackagePublishingPocket.RELEASE,
41+ ):
42 parent = self.factory.makeDistroSeries(distribution)
43 pf = getUtility(IProcessorFamilySet).getByName('x86')
44 parent_das = self.factory.makeDistroArchSeries(
45@@ -75,10 +77,11 @@
46 getUtility(ISourcePackageFormatSelectionSet).add(
47 parent, format_selection)
48 parent.backports_not_automatic = True
49- self._populate_parent(parent, parent_das, packages)
50+ self._populate_parent(parent, parent_das, packages, pocket)
51 return parent, parent_das
52
53- def _populate_parent(self, parent, parent_das, packages=None):
54+ def _populate_parent(self, parent, parent_das, packages=None,
55+ pocket=PackagePublishingPocket.RELEASE):
56 if packages is None:
57 packages = {'udev': '0.1-1', 'libc6': '2.8-1',
58 'postgresql': '9.0-1', 'chromium': '3.6'}
59@@ -87,8 +90,7 @@
60 spph = self.factory.makeSourcePackagePublishingHistory(
61 sourcepackagename=spn, version=packages[package],
62 distroseries=parent,
63- pocket=PackagePublishingPocket.RELEASE,
64- status=PackagePublishingStatus.PUBLISHED)
65+ pocket=pocket, status=PackagePublishingStatus.PUBLISHED)
66 status = BuildStatus.FULLYBUILT
67 if package is 'chromium':
68 status = BuildStatus.FAILEDTOBUILD
69@@ -104,8 +106,7 @@
70 self.factory.makeBinaryPackagePublishingHistory(
71 binarypackagerelease=bpr,
72 distroarchseries=parent_das,
73- pocket=PackagePublishingPocket.RELEASE,
74- status=PackagePublishingStatus.PUBLISHED)
75+ pocket=pocket, status=PackagePublishingStatus.PUBLISHED)
76 self.factory.makeBinaryPackageFile(binarypackagerelease=bpr)
77
78 def _fullInitialize(self, parents, child=None, previous_series=None,
79@@ -174,6 +175,22 @@
80 InitializationError, "Parent series has pending builds.",
81 ids.check)
82
83+ def test_success_with_updates_packages(self):
84+ # Initialization copies all the package from the UPDATES pocket.
85+ self.parent, self.parent_das = self.setupParent(
86+ pocket=PackagePublishingPocket.UPDATES)
87+ child = self._fullInitialize([self.parent])
88+ self.assertDistroSeriesInitializedCorrectly(
89+ child, self.parent, self.parent_das)
90+
91+ def test_success_with_security_packages(self):
92+ # Initialization copies all the package from the SECURITY pocket.
93+ self.parent, self.parent_das = self.setupParent(
94+ pocket=PackagePublishingPocket.SECURITY)
95+ child = self._fullInitialize([self.parent])
96+ self.assertDistroSeriesInitializedCorrectly(
97+ child, self.parent, self.parent_das)
98+
99 def test_success_with_pending_builds(self):
100 # If the parent series has pending builds, and the child's
101 # distribution is different, we can initialize.