Merge lp:~wgrant/launchpad/per-archive-build-debug-symbols into lp:launchpad/db-devel

Proposed by William Grant
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: no longer in the source branch.
Merged at revision: 9624
Proposed branch: lp:~wgrant/launchpad/per-archive-build-debug-symbols
Merge into: lp:launchpad/db-devel
Diff against target: 280 lines (+70/-20)
10 files modified
database/schema/comments.sql (+1/-0)
database/schema/patch-2207-77-0.sql (+7/-0)
lib/lp/buildmaster/tests/test_manager.py (+2/-1)
lib/lp/soyuz/browser/archive.py (+4/-4)
lib/lp/soyuz/configure.zcml (+3/-3)
lib/lp/soyuz/interfaces/archive.py (+11/-6)
lib/lp/soyuz/model/archive.py (+3/-0)
lib/lp/soyuz/model/binarypackagebuildbehavior.py (+3/-4)
lib/lp/soyuz/tests/test_archive.py (+34/-2)
lib/lp/testing/sampledata.py (+2/-0)
To merge this branch: bzr merge lp:~wgrant/launchpad/per-archive-build-debug-symbols
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle Approve
Stuart Bishop (community) db Approve
Robert Collins (community) Approve
Review via email: mp+29671@code.launchpad.net

Commit message

Allow debug package creation to be toggled on a per-archive basis.

Description of the change

As part of PPA debug symbol support (bug #156575), we need to be able to switch debug package building on for just some archives. launchpad-buildd and pkg-create-dbgsym already have support for this, so we just need to pass 'build_debug_symbols' to the slave when we want them.

Eventually we probably want to allow PPA users to configure this themselves, but I think it's wise to restrict it to admins for now until we work out expiration policies some other stuff. So it's launchpad.Commercial, like the other similar attributes.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

Please add a column comment, other feedback given on IRC. With that change, bine by me - stub can allocate a db patch id for you.

review: Approve
Revision history for this message
Stuart Bishop (stub) wrote :

You forgot the NOT NULL clause in the ALTER TABLE statement, and a comment in comments.sql. Add these and you are good to go.

patch-2207-77-0.sql

review: Approve (db)
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Code changes look fine to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'database/schema/comments.sql'
2--- database/schema/comments.sql 2010-08-04 00:03:20 +0000
3+++ database/schema/comments.sql 2010-08-05 02:36:53 +0000
4@@ -1992,6 +1992,7 @@
5 COMMENT ON COLUMN Archive.relative_build_score IS 'A delta to the build score that is applied to all builds in this archive.';
6 COMMENT ON COLUMN Archive.external_dependencies IS 'Newline-separated list of repositories to be used to retrieve any external build dependencies when building packages in this archive, in the format: deb http[s]://[user:pass@]<host>[/path] %(series)s[-pocket] [components] The series variable is replaced with the series name of the context build. This column is specifically and only intended for OEM migration to Launchpad and should be re-examined in October 2010 to see if it is still relevant.';
7 COMMENT ON COLUMN Archive.commercial IS 'Whether this archive is a commercial Archive and should appear in the Software Center.';
8+COMMENT ON COLUMN Archive.build_debug_symbols IS 'Whether builds for this archive should create debug symbol packages.';
9
10 -- ArchiveAuthToken
11
12
13=== added file 'database/schema/patch-2207-77-0.sql'
14--- database/schema/patch-2207-77-0.sql 1970-01-01 00:00:00 +0000
15+++ database/schema/patch-2207-77-0.sql 2010-08-05 02:36:53 +0000
16@@ -0,0 +1,7 @@
17+-- Copyright 2009 Canonical Ltd. This software is licensed under the
18+-- GNU Affero General Public License version 3 (see the file LICENSE).
19+
20+ALTER TABLE Archive
21+ ADD COLUMN build_debug_symbols boolean NOT NULL DEFAULT false;
22+
23+INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 77, 0);
24
25=== modified file 'lib/lp/buildmaster/tests/test_manager.py'
26--- lib/lp/buildmaster/tests/test_manager.py 2010-07-28 09:56:24 +0000
27+++ lib/lp/buildmaster/tests/test_manager.py 2010-08-05 02:36:53 +0000
28@@ -648,6 +648,7 @@
29 'archive_purpose': 'PRIMARY',
30 'archives':
31 ['deb http://ftpmaster.internal/ubuntu hoary main'],
32+ 'build_debug_symbols': False,
33 'ogrecomponent': 'main',
34 'suite': u'hoary'}))],
35 slave.calls, "Job was not properly dispatched.")
36@@ -886,7 +887,7 @@
37 polled a total of poll_repeat+1 times. The default values create a
38 total poll time of 11 seconds. The BuilddManager logs
39 "scanning cycles" every 5 seconds so these settings should see an
40- increase if the process is logging to this file.
41+ increase if the process is logging to this file.
42 """
43 last_size = None
44 for poll in range(poll_repeat+1):
45
46=== modified file 'lib/lp/soyuz/browser/archive.py'
47--- lib/lp/soyuz/browser/archive.py 2010-08-04 16:13:16 +0000
48+++ lib/lp/soyuz/browser/archive.py 2010-08-05 02:36:53 +0000
49@@ -919,7 +919,7 @@
50 'status': status_names[current_status.title],
51 'status_class': current_status.title,
52 'duration': duration,
53- 'builds': builds
54+ 'builds': builds,
55 })
56
57 return latest_updates_list
58@@ -1871,8 +1871,8 @@
59 class ArchiveAdminView(BaseArchiveEditView):
60
61 field_names = ['enabled', 'private', 'commercial', 'require_virtualized',
62- 'buildd_secret', 'authorized_size', 'relative_build_score',
63- 'external_dependencies']
64+ 'build_debug_symbols', 'buildd_secret', 'authorized_size',
65+ 'relative_build_score', 'external_dependencies']
66
67 custom_widget('external_dependencies', TextAreaWidget, height=3)
68
69@@ -1917,7 +1917,7 @@
70 'Do not specify for non-private archives')
71
72 # Check the external_dependencies field.
73- ext_deps = data.get('external_dependencies')
74+ ext_deps = data.get('external_dependencies')
75 if ext_deps is not None:
76 errors = self.validate_external_dependencies(ext_deps)
77 if len(errors) != 0:
78
79=== modified file 'lib/lp/soyuz/configure.zcml'
80--- lib/lp/soyuz/configure.zcml 2010-06-30 17:35:36 +0000
81+++ lib/lp/soyuz/configure.zcml 2010-08-05 02:36:53 +0000
82@@ -405,9 +405,9 @@
83 set_attributes="description displayname publish status"/>
84 <require
85 permission="launchpad.Commercial"
86- set_attributes="authorized_size buildd_secret
87- enabled_restricted_families
88- commercial external_dependencies private
89+ set_attributes="authorized_size build_debug_symbols buildd_secret
90+ commercial enabled_restricted_families
91+ external_dependencies private
92 require_virtualized relative_build_score "/>
93 <require
94 permission="launchpad.Admin"
95
96=== modified file 'lib/lp/soyuz/interfaces/archive.py'
97--- lib/lp/soyuz/interfaces/archive.py 2010-08-03 08:49:19 +0000
98+++ lib/lp/soyuz/interfaces/archive.py 2010-08-05 02:36:53 +0000
99@@ -265,6 +265,11 @@
100 description=_("Whether this archive requires its packages to be "
101 "built on a virtual builder."), readonly=False))
102
103+ build_debug_symbols = Bool(
104+ title=_("Build debug symbols"), required=False,
105+ description=_("Whether builds for this archive should create debug "
106+ "symbol packages."))
107+
108 authorized_size = Int(
109 title=_("Authorized PPA size "), required=False,
110 max=2 ** 31 - 1,
111@@ -518,7 +523,7 @@
112 """
113
114 def checkUploadToPocket(distroseries, pocket):
115- """Check if uploading to a particular pocket in an archive is possible.
116+ """Check if an upload to a particular archive and pocket is possible.
117
118 :param distroseries: A `IDistroSeries`
119 :param pocket: A `PackagePublishingPocket`
120@@ -542,7 +547,7 @@
121 vocabulary=DBEnumeratedType,
122 required=True),
123 strict_component=Bool(
124- title=_("Strict component"), required=False)
125+ title=_("Strict component"), required=False),
126 )
127 @export_operation_as("checkUpload")
128 @export_read_operation()
129@@ -1136,6 +1141,7 @@
130 :return: A new IArchiveAuthToken
131 """
132
133+
134 class IArchiveAppend(Interface):
135 """Archive interface for operations restricted by append privilege."""
136
137@@ -1432,7 +1438,6 @@
138 Only public and published sources are considered.
139 """
140
141-
142 def new(purpose, owner, name=None, displayname=None, distribution=None,
143 description=None, enabled=True, require_virtualized=True):
144 """Create a new archive.
145@@ -1446,8 +1451,9 @@
146 given it uses the names defined in
147 `IArchiveSet._getDefaultArchiveNameForPurpose`;
148 :param displayname: optional text that will be used as a reference
149- to this archive in the UI. If not provided a default text (
150- including the archive name and the owner displayname will be used.)
151+ to this archive in the UI. If not provided a default text
152+ (including the archive name and the owner displayname) will be
153+ used.
154 :param distribution: optional `IDistribution` to which the archive
155 will be attached;
156 :param description: optional text to be set as the archive
157@@ -1661,7 +1667,6 @@
158 """)
159
160
161-
162 default_name_by_purpose = {
163 ArchivePurpose.PRIMARY: 'primary',
164 ArchivePurpose.PPA: 'ppa',
165
166=== modified file 'lib/lp/soyuz/model/archive.py'
167--- lib/lp/soyuz/model/archive.py 2010-08-04 09:39:04 +0000
168+++ lib/lp/soyuz/model/archive.py 2010-08-05 02:36:53 +0000
169@@ -173,6 +173,9 @@
170 require_virtualized = BoolCol(
171 dbName='require_virtualized', notNull=True, default=True)
172
173+ build_debug_symbols = BoolCol(
174+ dbName='build_debug_symbols', notNull=True, default=False)
175+
176 authorized_size = IntCol(
177 dbName='authorized_size', notNull=False, default=2048)
178
179
180=== modified file 'lib/lp/soyuz/model/binarypackagebuildbehavior.py'
181--- lib/lp/soyuz/model/binarypackagebuildbehavior.py 2010-05-20 13:24:01 +0000
182+++ lib/lp/soyuz/model/binarypackagebuildbehavior.py 2010-08-05 02:36:53 +0000
183@@ -174,7 +174,7 @@
184 "(%s, %s)" % (
185 self._builder.url, file_name, url, sha1))
186 self._builder.slave.sendFileToSlave(
187- sha1, url, "buildd", archive.buildd_secret)
188+ sha1, url, "buildd", archive.buildd_secret)
189
190 def _extraBuildArgs(self, build):
191 """
192@@ -210,8 +210,7 @@
193
194 args['archives'] = get_sources_list_for_building(build,
195 build.distro_arch_series, build.source_package_release.name)
196-
197- # Let the build slave know whether this is a build in a private
198- # archive.
199 args['archive_private'] = build.archive.private
200+ args['build_debug_symbols'] = build.archive.build_debug_symbols
201+
202 return args
203
204=== modified file 'lib/lp/soyuz/tests/test_archive.py'
205--- lib/lp/soyuz/tests/test_archive.py 2010-08-03 19:10:42 +0000
206+++ lib/lp/soyuz/tests/test_archive.py 2010-08-05 02:36:53 +0000
207@@ -36,7 +36,8 @@
208 from lp.soyuz.model.binarypackagerelease import (
209 BinaryPackageReleaseDownloadCount)
210 from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
211-from lp.testing import login, login_person, TestCaseWithFactory
212+from lp.testing import ANONYMOUS, login, login_person, TestCaseWithFactory
213+from lp.testing.sampledata import COMMERCIAL_ADMIN_EMAIL
214
215
216 class TestGetPublicationsInArchive(TestCaseWithFactory):
217@@ -1078,11 +1079,42 @@
218 Unauthorized, self.setCommercial, self.archive, True)
219
220 # Commercial admins can change it.
221- login("commercial-member@canonical.com")
222+ login(COMMERCIAL_ADMIN_EMAIL)
223 self.setCommercial(self.archive, True)
224 self.assertTrue(self.archive.commercial)
225
226
227+class TestBuildDebugSymbols(TestCaseWithFactory):
228+ """Tests relating to the build_debug_symbols flag."""
229+
230+ layer = DatabaseFunctionalLayer
231+
232+ def setUp(self):
233+ super(TestBuildDebugSymbols, self).setUp()
234+ self.archive = self.factory.makeArchive()
235+
236+ def setBuildDebugSymbols(self, archive, build_debug_symbols):
237+ """Helper function."""
238+ archive.build_debug_symbols = build_debug_symbols
239+
240+ def test_build_debug_symbols_is_public(self):
241+ # Anyone can see the attribute.
242+ login(ANONYMOUS)
243+ self.assertFalse(self.archive.build_debug_symbols)
244+
245+ def test_owner_cannot_set_build_debug_symbols(self):
246+ # The archive owner cannot set it.
247+ login_person(self.archive.owner)
248+ self.assertRaises(
249+ Unauthorized, self.setBuildDebugSymbols, self.archive, True)
250+
251+ def test_commercial_admin_can_set_build_debug_symbols(self):
252+ # A commercial admin can set it.
253+ login(COMMERCIAL_ADMIN_EMAIL)
254+ self.setBuildDebugSymbols(self.archive, True)
255+ self.assertTrue(self.archive.build_debug_symbols)
256+
257+
258 class TestFindDepCandidates(TestCaseWithFactory):
259 """Tests for Archive.findDepCandidates."""
260
261
262=== modified file 'lib/lp/testing/sampledata.py'
263--- lib/lp/testing/sampledata.py 2010-08-02 15:36:19 +0000
264+++ lib/lp/testing/sampledata.py 2010-08-05 02:36:53 +0000
265@@ -11,6 +11,7 @@
266 __all__ = [
267 'BUILDD_ADMIN_USERNAME',
268 'CHROOT_LIBRARYFILEALIAS',
269+ 'COMMERCIAL_ADMIN_EMAIL',
270 'HOARY_DISTROSERIES_NAME',
271 'I386_ARCHITECTURE_NAME',
272 'LAUNCHPAD_DBUSER_NAME',
273@@ -40,6 +41,7 @@
274 LAUNCHPAD_DBUSER_NAME = 'launchpad'
275 MAIN_COMPONENT_NAME = 'main'
276 NO_PRIVILEGE_EMAIL = 'no-priv@canonical.com'
277+COMMERCIAL_ADMIN_EMAIL = 'commercial-member@canonical.com'
278 # A user that is an admin of ubuntu-team, which has upload rights
279 # to Ubuntu.
280 UBUNTU_DEVELOPER_ADMIN_NAME = 'name16'

Subscribers

People subscribed via source and target branches

to status/vote changes: