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
=== modified file 'database/schema/comments.sql'
--- database/schema/comments.sql 2010-08-04 00:03:20 +0000
+++ database/schema/comments.sql 2010-08-05 02:36:53 +0000
@@ -1992,6 +1992,7 @@
1992COMMENT ON COLUMN Archive.relative_build_score IS 'A delta to the build score that is applied to all builds in this archive.';1992COMMENT ON COLUMN Archive.relative_build_score IS 'A delta to the build score that is applied to all builds in this archive.';
1993COMMENT 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.';1993COMMENT 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.';
1994COMMENT ON COLUMN Archive.commercial IS 'Whether this archive is a commercial Archive and should appear in the Software Center.';1994COMMENT ON COLUMN Archive.commercial IS 'Whether this archive is a commercial Archive and should appear in the Software Center.';
1995COMMENT ON COLUMN Archive.build_debug_symbols IS 'Whether builds for this archive should create debug symbol packages.';
19951996
1996-- ArchiveAuthToken1997-- ArchiveAuthToken
19971998
19981999
=== added file 'database/schema/patch-2207-77-0.sql'
--- database/schema/patch-2207-77-0.sql 1970-01-01 00:00:00 +0000
+++ database/schema/patch-2207-77-0.sql 2010-08-05 02:36:53 +0000
@@ -0,0 +1,7 @@
1-- Copyright 2009 Canonical Ltd. This software is licensed under the
2-- GNU Affero General Public License version 3 (see the file LICENSE).
3
4ALTER TABLE Archive
5 ADD COLUMN build_debug_symbols boolean NOT NULL DEFAULT false;
6
7INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 77, 0);
08
=== modified file 'lib/lp/buildmaster/tests/test_manager.py'
--- lib/lp/buildmaster/tests/test_manager.py 2010-07-28 09:56:24 +0000
+++ lib/lp/buildmaster/tests/test_manager.py 2010-08-05 02:36:53 +0000
@@ -648,6 +648,7 @@
648 'archive_purpose': 'PRIMARY',648 'archive_purpose': 'PRIMARY',
649 'archives':649 'archives':
650 ['deb http://ftpmaster.internal/ubuntu hoary main'],650 ['deb http://ftpmaster.internal/ubuntu hoary main'],
651 'build_debug_symbols': False,
651 'ogrecomponent': 'main',652 'ogrecomponent': 'main',
652 'suite': u'hoary'}))],653 'suite': u'hoary'}))],
653 slave.calls, "Job was not properly dispatched.")654 slave.calls, "Job was not properly dispatched.")
@@ -886,7 +887,7 @@
886 polled a total of poll_repeat+1 times. The default values create a887 polled a total of poll_repeat+1 times. The default values create a
887 total poll time of 11 seconds. The BuilddManager logs888 total poll time of 11 seconds. The BuilddManager logs
888 "scanning cycles" every 5 seconds so these settings should see an889 "scanning cycles" every 5 seconds so these settings should see an
889 increase if the process is logging to this file. 890 increase if the process is logging to this file.
890 """891 """
891 last_size = None892 last_size = None
892 for poll in range(poll_repeat+1):893 for poll in range(poll_repeat+1):
893894
=== modified file 'lib/lp/soyuz/browser/archive.py'
--- lib/lp/soyuz/browser/archive.py 2010-08-04 16:13:16 +0000
+++ lib/lp/soyuz/browser/archive.py 2010-08-05 02:36:53 +0000
@@ -919,7 +919,7 @@
919 'status': status_names[current_status.title],919 'status': status_names[current_status.title],
920 'status_class': current_status.title,920 'status_class': current_status.title,
921 'duration': duration,921 'duration': duration,
922 'builds': builds922 'builds': builds,
923 })923 })
924924
925 return latest_updates_list925 return latest_updates_list
@@ -1871,8 +1871,8 @@
1871class ArchiveAdminView(BaseArchiveEditView):1871class ArchiveAdminView(BaseArchiveEditView):
18721872
1873 field_names = ['enabled', 'private', 'commercial', 'require_virtualized',1873 field_names = ['enabled', 'private', 'commercial', 'require_virtualized',
1874 'buildd_secret', 'authorized_size', 'relative_build_score',1874 'build_debug_symbols', 'buildd_secret', 'authorized_size',
1875 'external_dependencies']1875 'relative_build_score', 'external_dependencies']
18761876
1877 custom_widget('external_dependencies', TextAreaWidget, height=3)1877 custom_widget('external_dependencies', TextAreaWidget, height=3)
18781878
@@ -1917,7 +1917,7 @@
1917 'Do not specify for non-private archives')1917 'Do not specify for non-private archives')
19181918
1919 # Check the external_dependencies field.1919 # Check the external_dependencies field.
1920 ext_deps = data.get('external_dependencies')1920 ext_deps = data.get('external_dependencies')
1921 if ext_deps is not None:1921 if ext_deps is not None:
1922 errors = self.validate_external_dependencies(ext_deps)1922 errors = self.validate_external_dependencies(ext_deps)
1923 if len(errors) != 0:1923 if len(errors) != 0:
19241924
=== modified file 'lib/lp/soyuz/configure.zcml'
--- lib/lp/soyuz/configure.zcml 2010-06-30 17:35:36 +0000
+++ lib/lp/soyuz/configure.zcml 2010-08-05 02:36:53 +0000
@@ -405,9 +405,9 @@
405 set_attributes="description displayname publish status"/>405 set_attributes="description displayname publish status"/>
406 <require406 <require
407 permission="launchpad.Commercial"407 permission="launchpad.Commercial"
408 set_attributes="authorized_size buildd_secret408 set_attributes="authorized_size build_debug_symbols buildd_secret
409 enabled_restricted_families409 commercial enabled_restricted_families
410 commercial external_dependencies private410 external_dependencies private
411 require_virtualized relative_build_score "/>411 require_virtualized relative_build_score "/>
412 <require412 <require
413 permission="launchpad.Admin"413 permission="launchpad.Admin"
414414
=== modified file 'lib/lp/soyuz/interfaces/archive.py'
--- lib/lp/soyuz/interfaces/archive.py 2010-08-03 08:49:19 +0000
+++ lib/lp/soyuz/interfaces/archive.py 2010-08-05 02:36:53 +0000
@@ -265,6 +265,11 @@
265 description=_("Whether this archive requires its packages to be "265 description=_("Whether this archive requires its packages to be "
266 "built on a virtual builder."), readonly=False))266 "built on a virtual builder."), readonly=False))
267267
268 build_debug_symbols = Bool(
269 title=_("Build debug symbols"), required=False,
270 description=_("Whether builds for this archive should create debug "
271 "symbol packages."))
272
268 authorized_size = Int(273 authorized_size = Int(
269 title=_("Authorized PPA size "), required=False,274 title=_("Authorized PPA size "), required=False,
270 max=2 ** 31 - 1,275 max=2 ** 31 - 1,
@@ -518,7 +523,7 @@
518 """523 """
519524
520 def checkUploadToPocket(distroseries, pocket):525 def checkUploadToPocket(distroseries, pocket):
521 """Check if uploading to a particular pocket in an archive is possible.526 """Check if an upload to a particular archive and pocket is possible.
522527
523 :param distroseries: A `IDistroSeries`528 :param distroseries: A `IDistroSeries`
524 :param pocket: A `PackagePublishingPocket`529 :param pocket: A `PackagePublishingPocket`
@@ -542,7 +547,7 @@
542 vocabulary=DBEnumeratedType,547 vocabulary=DBEnumeratedType,
543 required=True),548 required=True),
544 strict_component=Bool(549 strict_component=Bool(
545 title=_("Strict component"), required=False)550 title=_("Strict component"), required=False),
546 )551 )
547 @export_operation_as("checkUpload")552 @export_operation_as("checkUpload")
548 @export_read_operation()553 @export_read_operation()
@@ -1136,6 +1141,7 @@
1136 :return: A new IArchiveAuthToken1141 :return: A new IArchiveAuthToken
1137 """1142 """
11381143
1144
1139class IArchiveAppend(Interface):1145class IArchiveAppend(Interface):
1140 """Archive interface for operations restricted by append privilege."""1146 """Archive interface for operations restricted by append privilege."""
11411147
@@ -1432,7 +1438,6 @@
1432 Only public and published sources are considered.1438 Only public and published sources are considered.
1433 """1439 """
14341440
1435
1436 def new(purpose, owner, name=None, displayname=None, distribution=None,1441 def new(purpose, owner, name=None, displayname=None, distribution=None,
1437 description=None, enabled=True, require_virtualized=True):1442 description=None, enabled=True, require_virtualized=True):
1438 """Create a new archive.1443 """Create a new archive.
@@ -1446,8 +1451,9 @@
1446 given it uses the names defined in1451 given it uses the names defined in
1447 `IArchiveSet._getDefaultArchiveNameForPurpose`;1452 `IArchiveSet._getDefaultArchiveNameForPurpose`;
1448 :param displayname: optional text that will be used as a reference1453 :param displayname: optional text that will be used as a reference
1449 to this archive in the UI. If not provided a default text (1454 to this archive in the UI. If not provided a default text
1450 including the archive name and the owner displayname will be used.)1455 (including the archive name and the owner displayname) will be
1456 used.
1451 :param distribution: optional `IDistribution` to which the archive1457 :param distribution: optional `IDistribution` to which the archive
1452 will be attached;1458 will be attached;
1453 :param description: optional text to be set as the archive1459 :param description: optional text to be set as the archive
@@ -1661,7 +1667,6 @@
1661 """)1667 """)
16621668
16631669
1664
1665default_name_by_purpose = {1670default_name_by_purpose = {
1666 ArchivePurpose.PRIMARY: 'primary',1671 ArchivePurpose.PRIMARY: 'primary',
1667 ArchivePurpose.PPA: 'ppa',1672 ArchivePurpose.PPA: 'ppa',
16681673
=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py 2010-08-04 09:39:04 +0000
+++ lib/lp/soyuz/model/archive.py 2010-08-05 02:36:53 +0000
@@ -173,6 +173,9 @@
173 require_virtualized = BoolCol(173 require_virtualized = BoolCol(
174 dbName='require_virtualized', notNull=True, default=True)174 dbName='require_virtualized', notNull=True, default=True)
175175
176 build_debug_symbols = BoolCol(
177 dbName='build_debug_symbols', notNull=True, default=False)
178
176 authorized_size = IntCol(179 authorized_size = IntCol(
177 dbName='authorized_size', notNull=False, default=2048)180 dbName='authorized_size', notNull=False, default=2048)
178181
179182
=== modified file 'lib/lp/soyuz/model/binarypackagebuildbehavior.py'
--- lib/lp/soyuz/model/binarypackagebuildbehavior.py 2010-05-20 13:24:01 +0000
+++ lib/lp/soyuz/model/binarypackagebuildbehavior.py 2010-08-05 02:36:53 +0000
@@ -174,7 +174,7 @@
174 "(%s, %s)" % (174 "(%s, %s)" % (
175 self._builder.url, file_name, url, sha1))175 self._builder.url, file_name, url, sha1))
176 self._builder.slave.sendFileToSlave(176 self._builder.slave.sendFileToSlave(
177 sha1, url, "buildd", archive.buildd_secret)177 sha1, url, "buildd", archive.buildd_secret)
178178
179 def _extraBuildArgs(self, build):179 def _extraBuildArgs(self, build):
180 """180 """
@@ -210,8 +210,7 @@
210210
211 args['archives'] = get_sources_list_for_building(build,211 args['archives'] = get_sources_list_for_building(build,
212 build.distro_arch_series, build.source_package_release.name)212 build.distro_arch_series, build.source_package_release.name)
213
214 # Let the build slave know whether this is a build in a private
215 # archive.
216 args['archive_private'] = build.archive.private213 args['archive_private'] = build.archive.private
214 args['build_debug_symbols'] = build.archive.build_debug_symbols
215
217 return args216 return args
218217
=== modified file 'lib/lp/soyuz/tests/test_archive.py'
--- lib/lp/soyuz/tests/test_archive.py 2010-08-03 19:10:42 +0000
+++ lib/lp/soyuz/tests/test_archive.py 2010-08-05 02:36:53 +0000
@@ -36,7 +36,8 @@
36from lp.soyuz.model.binarypackagerelease import (36from lp.soyuz.model.binarypackagerelease import (
37 BinaryPackageReleaseDownloadCount)37 BinaryPackageReleaseDownloadCount)
38from lp.soyuz.tests.test_publishing import SoyuzTestPublisher38from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
39from lp.testing import login, login_person, TestCaseWithFactory39from lp.testing import ANONYMOUS, login, login_person, TestCaseWithFactory
40from lp.testing.sampledata import COMMERCIAL_ADMIN_EMAIL
4041
4142
42class TestGetPublicationsInArchive(TestCaseWithFactory):43class TestGetPublicationsInArchive(TestCaseWithFactory):
@@ -1078,11 +1079,42 @@
1078 Unauthorized, self.setCommercial, self.archive, True)1079 Unauthorized, self.setCommercial, self.archive, True)
10791080
1080 # Commercial admins can change it.1081 # Commercial admins can change it.
1081 login("commercial-member@canonical.com")1082 login(COMMERCIAL_ADMIN_EMAIL)
1082 self.setCommercial(self.archive, True)1083 self.setCommercial(self.archive, True)
1083 self.assertTrue(self.archive.commercial)1084 self.assertTrue(self.archive.commercial)
10841085
10851086
1087class TestBuildDebugSymbols(TestCaseWithFactory):
1088 """Tests relating to the build_debug_symbols flag."""
1089
1090 layer = DatabaseFunctionalLayer
1091
1092 def setUp(self):
1093 super(TestBuildDebugSymbols, self).setUp()
1094 self.archive = self.factory.makeArchive()
1095
1096 def setBuildDebugSymbols(self, archive, build_debug_symbols):
1097 """Helper function."""
1098 archive.build_debug_symbols = build_debug_symbols
1099
1100 def test_build_debug_symbols_is_public(self):
1101 # Anyone can see the attribute.
1102 login(ANONYMOUS)
1103 self.assertFalse(self.archive.build_debug_symbols)
1104
1105 def test_owner_cannot_set_build_debug_symbols(self):
1106 # The archive owner cannot set it.
1107 login_person(self.archive.owner)
1108 self.assertRaises(
1109 Unauthorized, self.setBuildDebugSymbols, self.archive, True)
1110
1111 def test_commercial_admin_can_set_build_debug_symbols(self):
1112 # A commercial admin can set it.
1113 login(COMMERCIAL_ADMIN_EMAIL)
1114 self.setBuildDebugSymbols(self.archive, True)
1115 self.assertTrue(self.archive.build_debug_symbols)
1116
1117
1086class TestFindDepCandidates(TestCaseWithFactory):1118class TestFindDepCandidates(TestCaseWithFactory):
1087 """Tests for Archive.findDepCandidates."""1119 """Tests for Archive.findDepCandidates."""
10881120
10891121
=== modified file 'lib/lp/testing/sampledata.py'
--- lib/lp/testing/sampledata.py 2010-08-02 15:36:19 +0000
+++ lib/lp/testing/sampledata.py 2010-08-05 02:36:53 +0000
@@ -11,6 +11,7 @@
11__all__ = [11__all__ = [
12 'BUILDD_ADMIN_USERNAME',12 'BUILDD_ADMIN_USERNAME',
13 'CHROOT_LIBRARYFILEALIAS',13 'CHROOT_LIBRARYFILEALIAS',
14 'COMMERCIAL_ADMIN_EMAIL',
14 'HOARY_DISTROSERIES_NAME',15 'HOARY_DISTROSERIES_NAME',
15 'I386_ARCHITECTURE_NAME',16 'I386_ARCHITECTURE_NAME',
16 'LAUNCHPAD_DBUSER_NAME',17 'LAUNCHPAD_DBUSER_NAME',
@@ -40,6 +41,7 @@
40LAUNCHPAD_DBUSER_NAME = 'launchpad'41LAUNCHPAD_DBUSER_NAME = 'launchpad'
41MAIN_COMPONENT_NAME = 'main'42MAIN_COMPONENT_NAME = 'main'
42NO_PRIVILEGE_EMAIL = 'no-priv@canonical.com'43NO_PRIVILEGE_EMAIL = 'no-priv@canonical.com'
44COMMERCIAL_ADMIN_EMAIL = 'commercial-member@canonical.com'
43# A user that is an admin of ubuntu-team, which has upload rights45# A user that is an admin of ubuntu-team, which has upload rights
44# to Ubuntu.46# to Ubuntu.
45UBUNTU_DEVELOPER_ADMIN_NAME = 'name16'47UBUNTU_DEVELOPER_ADMIN_NAME = 'name16'

Subscribers

People subscribed via source and target branches

to status/vote changes: