Merge lp:~julian-edwards/launchpad/publish-copy-archives-bug-520520 into lp:launchpad

Proposed by Julian Edwards
Status: Merged
Merged at revision: not available
Proposed branch: lp:~julian-edwards/launchpad/publish-copy-archives-bug-520520
Merge into: lp:launchpad
Diff against target: 289 lines (+71/-64)
2 files modified
lib/lp/soyuz/adapters/archivedependencies.py (+35/-28)
lib/lp/soyuz/doc/archive-dependencies.txt (+36/-36)
To merge this branch: bzr merge lp:~julian-edwards/launchpad/publish-copy-archives-bug-520520
Reviewer Review Type Date Requested Status
Paul Hummer (community) code Approve
Review via email: mp+19621@code.launchpad.net

Commit message

Change the ordering of the dependencies for builds to something that makes more sense.

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

= Summary =
Change the ordering of the dependencies for builds to something that makes
more sense.

== Proposed fix ==
When we send builds to the build slaves, we tell the chroot exactly what
sources.list it needs to install before pulling in build dependencies. The
ordering of that file has a bearing on what packages get installed if two
repos have the same version of something.

This branch makes that ordering sensible and determinate.

== Pre-implementation notes ==
This is the first part of the fix for bug 520520.

== Implementation details ==
The entries are returned in the order that is most useful;
  1. the context archive itself
  2. external dependencies
  3. user-selected archive dependencies
  4. the default primary archive

This is a simple fix in the get_sources_list_for_building() function.

== Tests ==
bin/test -cvvt archive-dependencies.txt

== Demo and Q/A ==

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/soyuz/doc/archive-dependencies.txt
  lib/lp/soyuz/adapters/archivedependencies.py

== Pylint notices ==

lib/lp/soyuz/adapters/archivedependencies.py
    43: [F0401] Unable to import 'lazr.uri' (No module named uri)

Revision history for this message
Paul Hummer (rockstar) wrote :

This all looks good. Thanks for the branch!

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/adapters/archivedependencies.py'
2--- lib/lp/soyuz/adapters/archivedependencies.py 2010-01-15 04:03:26 +0000
3+++ lib/lp/soyuz/adapters/archivedependencies.py 2010-02-18 15:35:24 +0000
4@@ -119,23 +119,40 @@
5 def get_sources_list_for_building(build, distroarchseries, sourcepackagename):
6 """Return the sources_list entries required to build the given item.
7
8+ The entries are returned in the order that is most useful;
9+ 1. the context archive itself
10+ 2. external dependencies
11+ 3. user-selected archive dependencies
12+ 4. the default primary archive
13+
14 :param build: a context `IBuild`.
15 :param distroarchseries: A `IDistroArchSeries`
16 :param sourcepackagename: A source package name (as text)
17 :return: a deb sources_list entries (lines).
18 """
19 deps = []
20-
21- # Consider primary archive dependency override. Add the default
22- # primary archive dependencies if it's not present.
23- if build.archive.getArchiveDependency(
24- build.archive.distribution.main_archive) is None:
25- primary_dependencies = _get_default_primary_dependencies(build)
26- deps.extend(primary_dependencies)
27+ sources_list_lines = []
28+
29+ # Add implicit self-dependency for non-primary contexts.
30+ if build.archive.purpose in ALLOW_RELEASE_BUILDS:
31+ self_dep = [(
32+ build.archive, PackagePublishingPocket.RELEASE,
33+ get_components_for_building(build))]
34+ sources_list_lines = _get_sources_list_for_dependencies(
35+ self_dep, distroarchseries)
36+
37+ # Append external sources_list lines for this archive if it's
38+ # specified in the configuration.
39+ dependencies = build.archive.external_dependencies
40+ if dependencies is not None:
41+ for archive_dep in dependencies.splitlines():
42+ line = archive_dep % (
43+ {'series': distroarchseries.distroseries.name})
44+ sources_list_lines.append(line)
45
46 # Consider user-selected archive dependencies.
47- primary_component = get_primary_current_component(build.archive,
48- build.distroseries, sourcepackagename)
49+ primary_component = get_primary_current_component(
50+ build.archive, build.distroseries, sourcepackagename)
51 for archive_dependency in build.archive.dependencies:
52 # When the dependency component is undefined, we should use
53 # the component where the source is published in the primary
54@@ -151,25 +168,15 @@
55 (archive_dependency.dependency, pocket, components)
56 )
57
58- # Add implicit self-dependency for non-primary contexts.
59- if build.archive.purpose in ALLOW_RELEASE_BUILDS:
60- deps.append(
61- (build.archive, PackagePublishingPocket.RELEASE,
62- get_components_for_building(build))
63- )
64-
65- sources_list_lines = _get_sources_list_for_dependencies(
66- deps, distroarchseries)
67-
68- # Append external sources_list lines for this archive if it's
69- # specified in the configuration.
70- dependencies = build.archive.external_dependencies
71- if dependencies is not None:
72- for archive_dep in dependencies.splitlines():
73- line = archive_dep % (
74- {'series': distroarchseries.distroseries.name})
75- sources_list_lines.append(line)
76-
77+ # Consider primary archive dependency override. Add the default
78+ # primary archive dependencies if it's not present.
79+ if build.archive.getArchiveDependency(
80+ build.archive.distribution.main_archive) is None:
81+ primary_dependencies = _get_default_primary_dependencies(build)
82+ deps.extend(primary_dependencies)
83+
84+ sources_list_lines.extend(
85+ _get_sources_list_for_dependencies(deps, distroarchseries))
86 return sources_list_lines
87
88 def _has_published_binaries(archive, distroarchseries, pocket):
89
90=== modified file 'lib/lp/soyuz/doc/archive-dependencies.txt'
91--- lib/lp/soyuz/doc/archive-dependencies.txt 2010-01-16 09:41:17 +0000
92+++ lib/lp/soyuz/doc/archive-dependencies.txt 2010-02-18 15:35:24 +0000
93@@ -207,7 +207,7 @@
94 >>> def print_building_sources_list(candidate):
95 ... sources_list = get_sources_list_for_building(candidate,
96 ... candidate.distroarchseries, candidate.sourcepackagerelease.name)
97- ... for line in sorted(sources_list):
98+ ... for line in sources_list:
99 ... print line
100
101 Note that only the default ubuntu dependencies for a public PPA will be
102@@ -240,13 +240,13 @@
103 ... status=PackagePublishingStatus.PUBLISHED)
104
105 >>> print_building_sources_list(a_build)
106+ deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
107 deb http://ftpmaster.internal/ubuntu hoary
108 main restricted universe multiverse
109 deb http://ftpmaster.internal/ubuntu hoary-security
110 main restricted universe multiverse
111 deb http://ftpmaster.internal/ubuntu hoary-updates
112 main restricted universe multiverse
113- deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
114
115 Similarly, populated PPA dependencies are listed in the building
116 'sources_list'.
117@@ -261,14 +261,14 @@
118 ... getUtility(IComponentSet)['main'])
119
120 >>> print_building_sources_list(a_build)
121- deb http://ftpmaster.internal/ubuntu hoary
122- main restricted universe multiverse
123- deb http://ftpmaster.internal/ubuntu hoary-security
124- main restricted universe multiverse
125- deb http://ftpmaster.internal/ubuntu hoary-updates
126- main restricted universe multiverse
127 deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
128 deb http://ppa.launchpad.dev/mark/ppa/ubuntu hoary main
129+ deb http://ftpmaster.internal/ubuntu hoary
130+ main restricted universe multiverse
131+ deb http://ftpmaster.internal/ubuntu hoary-security
132+ main restricted universe multiverse
133+ deb http://ftpmaster.internal/ubuntu hoary-updates
134+ main restricted universe multiverse
135
136 The authentication information gets added for private PPA
137 dependencies.
138@@ -277,6 +277,7 @@
139 >>> mark.archive.private = True
140
141 >>> print_building_sources_list(a_build)
142+ deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
143 deb http://buildd:not-so-secret@private-ppa.launchpad.dev/mark/ppa/ubuntu
144 hoary main
145 deb http://ftpmaster.internal/ubuntu hoary
146@@ -285,7 +286,6 @@
147 main restricted universe multiverse
148 deb http://ftpmaster.internal/ubuntu hoary-updates
149 main restricted universe multiverse
150- deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
151
152 Good enough, let's delete the archive dependency on Mark's PPA.
153
154@@ -306,13 +306,13 @@
155 dependencies.
156
157 >>> print_building_sources_list(a_build)
158+ deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
159 deb http://ftpmaster.internal/ubuntu hoary
160 main restricted universe multiverse
161 deb http://ftpmaster.internal/ubuntu hoary-security
162 main restricted universe multiverse
163 deb http://ftpmaster.internal/ubuntu hoary-updates
164 main restricted universe multiverse
165- deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
166
167 The default build behaviour will remain unchanged when we override the
168 default primary archive dependencies with exactly the same values.
169@@ -322,13 +322,13 @@
170 ... getUtility(IComponentSet)['multiverse'])
171
172 >>> print_building_sources_list(a_build)
173+ deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
174 deb http://ftpmaster.internal/ubuntu hoary
175 main restricted universe multiverse
176 deb http://ftpmaster.internal/ubuntu hoary-security
177 main restricted universe multiverse
178 deb http://ftpmaster.internal/ubuntu hoary-updates
179 main restricted universe multiverse
180- deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
181
182 >>> cprov.archive.removeArchiveDependency(ubuntu.main_archive)
183
184@@ -349,11 +349,11 @@
185 universe
186
187 >>> print_building_sources_list(a_build)
188+ deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
189 deb http://ftpmaster.internal/ubuntu hoary
190 main universe
191 deb http://ftpmaster.internal/ubuntu hoary-security
192 main universe
193- deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
194
195 >>> cprov.archive.removeArchiveDependency(ubuntu.main_archive)
196
197@@ -366,8 +366,8 @@
198 ... getUtility(IComponentSet)['restricted'])
199
200 >>> print_building_sources_list(a_build)
201+ deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
202 deb http://ftpmaster.internal/ubuntu hoary main restricted
203- deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
204
205 >>> cprov.archive.removeArchiveDependency(ubuntu.main_archive)
206
207@@ -379,15 +379,15 @@
208 ... getUtility(IComponentSet)['multiverse'])
209
210 >>> print_building_sources_list(a_build)
211+ deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
212 deb http://ftpmaster.internal/ubuntu hoary
213 main restricted universe multiverse
214+ deb http://ftpmaster.internal/ubuntu hoary-security
215+ main restricted universe multiverse
216+ deb http://ftpmaster.internal/ubuntu hoary-updates
217+ main restricted universe multiverse
218 deb http://ftpmaster.internal/ubuntu hoary-proposed
219 main restricted universe multiverse
220- deb http://ftpmaster.internal/ubuntu hoary-security
221- main restricted universe multiverse
222- deb http://ftpmaster.internal/ubuntu hoary-updates
223- main restricted universe multiverse
224- deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
225
226 >>> cprov.archive.removeArchiveDependency(ubuntu.main_archive)
227
228@@ -398,15 +398,15 @@
229 ... getUtility(IComponentSet)['multiverse'])
230
231 >>> print_building_sources_list(a_build)
232+ deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
233 deb http://ftpmaster.internal/ubuntu hoary
234 main restricted universe multiverse
235+ deb http://ftpmaster.internal/ubuntu hoary-security
236+ main restricted universe multiverse
237+ deb http://ftpmaster.internal/ubuntu hoary-updates
238+ main restricted universe multiverse
239 deb http://ftpmaster.internal/ubuntu hoary-backports
240 main restricted universe multiverse
241- deb http://ftpmaster.internal/ubuntu hoary-security
242- main restricted universe multiverse
243- deb http://ftpmaster.internal/ubuntu hoary-updates
244- main restricted universe multiverse
245- deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
246
247 >>> cprov.archive.removeArchiveDependency(ubuntu.main_archive)
248
249@@ -432,13 +432,13 @@
250 >>> [partner_build] = pub_source.createMissingBuilds()
251
252 >>> print_building_sources_list(partner_build)
253- deb http://ftpmaster.internal/ubuntu hoary
254- main restricted universe multiverse
255- deb http://ftpmaster.internal/ubuntu hoary-security
256- main restricted universe multiverse
257- deb http://ftpmaster.internal/ubuntu hoary-updates
258- main restricted universe multiverse
259 deb http://ftpmaster.internal/ubuntu-partner hoary partner
260+ deb http://ftpmaster.internal/ubuntu hoary
261+ main restricted universe multiverse
262+ deb http://ftpmaster.internal/ubuntu hoary-security
263+ main restricted universe multiverse
264+ deb http://ftpmaster.internal/ubuntu hoary-updates
265+ main restricted universe multiverse
266
267
268 == External build dependencies ==
269@@ -466,14 +466,14 @@
270 Now builds in Celso's PPA will use the external dependencies.
271
272 >>> print_building_sources_list(a_build)
273- deb http://ftpmaster.internal/ubuntu hoary
274- main restricted universe multiverse
275- deb http://ftpmaster.internal/ubuntu hoary-security
276- main restricted universe multiverse
277- deb http://ftpmaster.internal/ubuntu hoary-updates
278- main restricted universe multiverse
279 deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
280+ deb http://user:pass@repository zoing everything
281 deb http://user:pass@repository hoary public private
282 deb http://user:pass@repository hoary-extra public
283- deb http://user:pass@repository zoing everything
284+ deb http://ftpmaster.internal/ubuntu hoary
285+ main restricted universe multiverse
286+ deb http://ftpmaster.internal/ubuntu hoary-security
287+ main restricted universe multiverse
288+ deb http://ftpmaster.internal/ubuntu hoary-updates
289+ main restricted universe multiverse
290