Merge lp:~julian-edwards/launchpad/ppa-dependency-schema into lp:launchpad/db-devel
- ppa-dependency-schema
- Merge into db-devel
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~julian-edwards/launchpad/ppa-dependency-schema |
Merge into: | lp:launchpad/db-devel |
Diff against target: |
469 lines 13 files modified
database/sampledata/current-dev.sql (+12/-12) database/schema/comments.sql (+1/-0) database/schema/patch-2207-05-0.sql (+12/-0) lib/canonical/config/schema-lazr.conf (+0/-7) lib/lp/soyuz/adapters/archivedependencies.py (+3/-6) lib/lp/soyuz/browser/archive.py (+38/-2) lib/lp/soyuz/browser/tests/archive-views.txt (+47/-0) lib/lp/soyuz/configure.zcml (+2/-2) lib/lp/soyuz/doc/archive-dependencies.txt (+14/-28) lib/lp/soyuz/doc/archive.txt (+23/-5) lib/lp/soyuz/interfaces/archive.py (+12/-0) lib/lp/soyuz/model/archive.py (+6/-0) lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt (+25/-2) |
To merge this branch: | bzr merge lp:~julian-edwards/launchpad/ppa-dependency-schema |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jonathan Lange (community) | schema | Approve | |
Stuart Bishop (community) | schema | Approve | |
Graham Binns (community) | code | Approve | |
Review via email: mp+12915@code.launchpad.net |
Commit message
Description of the change
Julian Edwards (julian-edwards) wrote : | # |
Graham Binns (gmb) : | # |
Stuart Bishop (stub) wrote : | # |
Discussed on irc, all fine.
patch-2207-05-0.sql
Jonathan Lange (jml) wrote : | # |
* This is highly structured data, which makes me wonder why it's not structured in the database. We agreed that it's ok because:
* The field is temporary and only being used for migration
* There are no use cases for analyzing the data.
I'm ok with this to land on the conditions that:
* there are comments indicating that it's only for OEM migration
* we add validation code to guarantee that it's clean, in case we want to migrate to structured data later. If the validation code is not in the model, the comments in the interface should warn that there's no model-level validation.
* we schedule a date to actually delete this column after OEM have migrated.
Also,
* Please update the comment field to refer to the URL scheme, both in comments.sql and the interface.
Preview Diff
1 | === modified file 'database/sampledata/current-dev.sql' |
2 | --- database/sampledata/current-dev.sql 2009-09-07 01:46:23 +0000 |
3 | +++ database/sampledata/current-dev.sql 2009-10-07 14:52:13 +0000 |
4 | @@ -969,18 +969,18 @@ |
5 | |
6 | ALTER TABLE archive DISABLE TRIGGER ALL; |
7 | |
8 | -INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score) VALUES (1, 17, NULL, true, NULL, 1, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:12.241774', 15, 1, 8, 5, 1, '2008-09-23 17:29:03.442606', NULL, NULL, NULL, 'Primary Archive for Ubuntu Linux', 0); |
9 | -INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score) VALUES (2, 1, NULL, true, NULL, 2, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.863812', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.445921', NULL, NULL, NULL, 'Primary Archive for Redhat Advanced Server', 0); |
10 | -INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score) VALUES (3, 1, NULL, true, NULL, 3, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.864941', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.446557', NULL, NULL, NULL, 'Primary Archive for Debian GNU/Linux', 0); |
11 | -INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score) VALUES (4, 1, NULL, true, NULL, 4, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.865502', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.44689', NULL, NULL, NULL, 'Primary Archive for The Gentoo Linux', 0); |
12 | -INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score) VALUES (5, 1, NULL, true, NULL, 5, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.866015', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.447202', NULL, NULL, NULL, 'Primary Archive for Kubuntu - Free KDE-based Linux', 0); |
13 | -INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score) VALUES (7, 4, NULL, true, NULL, 7, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.866529', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.447515', NULL, NULL, NULL, 'Primary Archive for GuadaLinex: Linux for Andalucia', 0); |
14 | -INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score) VALUES (8, 17, NULL, true, NULL, 8, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.867154', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.447851', NULL, NULL, NULL, 'Primary Archive for Ubuntu Test', 0); |
15 | -INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score) VALUES (9, 28, 'packages to help my friends.', true, 1024, 1, 2, false, 3, 3, NULL, NULL, NULL, true, 'ppa', true, '2008-05-27 18:15:15.867684', 4, 0, 3, 1, 0, '2008-09-23 17:29:03.448178', NULL, NULL, NULL, 'PPA for Celso Providelo', 0); |
16 | -INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score) VALUES (10, 1, 'packages to help the humanity (you know, ubuntu)', true, 1024, 1, 2, false, 1, 1, NULL, NULL, NULL, true, 'ppa', true, '2008-05-27 18:15:15.868202', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.448488', NULL, NULL, NULL, 'PPA for Mark Shuttleworth', 0); |
17 | -INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score) VALUES (11, 52, 'I am not allowed to say, I have no privs.', true, 1024, 1, 2, false, 0, 0, NULL, NULL, NULL, true, 'ppa', true, '2008-05-27 18:15:15.868709', 1, 0, 0, 1, 0, '2008-09-23 17:29:03.448797', NULL, NULL, NULL, 'PPA for No Privileges Person', 0); |
18 | -INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score) VALUES (12, 17, 'Partner archive', true, NULL, 1, 4, false, NULL, NULL, NULL, NULL, NULL, false, 'partner', true, '2008-05-27 18:15:15.869209', 1, 0, 1, 0, 0, '2008-09-23 17:29:03.449157', NULL, NULL, NULL, 'Partner Archive for Ubuntu Linux', 0); |
19 | -INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score) VALUES (13, 17, 'Partner archive', true, NULL, 8, 4, false, NULL, NULL, NULL, NULL, NULL, false, 'partner', true, '2008-05-27 18:15:15.869732', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.449471', NULL, NULL, NULL, 'Partner Archive for Ubuntu Test', 0); |
20 | +INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies) VALUES (1, 17, NULL, true, NULL, 1, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:12.241774', 15, 1, 8, 5, 1, '2008-09-23 17:29:03.442606', NULL, NULL, NULL, 'Primary Archive for Ubuntu Linux', 0, NULL); |
21 | +INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies) VALUES (2, 1, NULL, true, NULL, 2, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.863812', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.445921', NULL, NULL, NULL, 'Primary Archive for Redhat Advanced Server', 0, NULL); |
22 | +INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies) VALUES (3, 1, NULL, true, NULL, 3, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.864941', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.446557', NULL, NULL, NULL, 'Primary Archive for Debian GNU/Linux', 0, NULL); |
23 | +INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies) VALUES (4, 1, NULL, true, NULL, 4, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.865502', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.44689', NULL, NULL, NULL, 'Primary Archive for The Gentoo Linux', 0, NULL); |
24 | +INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies) VALUES (5, 1, NULL, true, NULL, 5, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.866015', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.447202', NULL, NULL, NULL, 'Primary Archive for Kubuntu - Free KDE-based Linux', 0, NULL); |
25 | +INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies) VALUES (7, 4, NULL, true, NULL, 7, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.866529', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.447515', NULL, NULL, NULL, 'Primary Archive for GuadaLinex: Linux for Andalucia', 0, NULL); |
26 | +INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies) VALUES (8, 17, NULL, true, NULL, 8, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.867154', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.447851', NULL, NULL, NULL, 'Primary Archive for Ubuntu Test', 0, NULL); |
27 | +INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies) VALUES (9, 28, 'packages to help my friends.', true, 1024, 1, 2, false, 3, 3, NULL, NULL, NULL, true, 'ppa', true, '2008-05-27 18:15:15.867684', 4, 0, 3, 1, 0, '2008-09-23 17:29:03.448178', NULL, NULL, NULL, 'PPA for Celso Providelo', 0, NULL); |
28 | +INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies) VALUES (10, 1, 'packages to help the humanity (you know, ubuntu)', true, 1024, 1, 2, false, 1, 1, NULL, NULL, NULL, true, 'ppa', true, '2008-05-27 18:15:15.868202', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.448488', NULL, NULL, NULL, 'PPA for Mark Shuttleworth', 0, NULL); |
29 | +INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies) VALUES (11, 52, 'I am not allowed to say, I have no privs.', true, 1024, 1, 2, false, 0, 0, NULL, NULL, NULL, true, 'ppa', true, '2008-05-27 18:15:15.868709', 1, 0, 0, 1, 0, '2008-09-23 17:29:03.448797', NULL, NULL, NULL, 'PPA for No Privileges Person', 0, NULL); |
30 | +INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies) VALUES (12, 17, 'Partner archive', true, NULL, 1, 4, false, NULL, NULL, NULL, NULL, NULL, false, 'partner', true, '2008-05-27 18:15:15.869209', 1, 0, 1, 0, 0, '2008-09-23 17:29:03.449157', NULL, NULL, NULL, 'Partner Archive for Ubuntu Linux', 0, NULL); |
31 | +INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies) VALUES (13, 17, 'Partner archive', true, NULL, 8, 4, false, NULL, NULL, NULL, NULL, NULL, false, 'partner', true, '2008-05-27 18:15:15.869732', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.449471', NULL, NULL, NULL, 'Partner Archive for Ubuntu Test', 0, NULL); |
32 | |
33 | |
34 | ALTER TABLE archive ENABLE TRIGGER ALL; |
35 | |
36 | === modified file 'database/schema/comments.sql' |
37 | --- database/schema/comments.sql 2009-09-25 08:46:57 +0000 |
38 | +++ database/schema/comments.sql 2009-10-07 14:52:13 +0000 |
39 | @@ -1865,6 +1865,7 @@ |
40 | COMMENT ON COLUMN Archive.removed_binary_retention_days IS 'The number of days before superseded or deleted binary files are expired in the librarian, or zero for never.'; |
41 | COMMENT ON COLUMN Archive.num_old_versions_published IS 'The number of versions of a package to keep published before older versions are superseded.'; |
42 | COMMENT ON COLUMN Archive.relative_build_score IS 'A delta to the build score that is applied to all builds in this archive.'; |
43 | +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.'; |
44 | |
45 | -- ArchiveAuthToken |
46 | |
47 | |
48 | === added file 'database/schema/patch-2207-05-0.sql' |
49 | --- database/schema/patch-2207-05-0.sql 1970-01-01 00:00:00 +0000 |
50 | +++ database/schema/patch-2207-05-0.sql 2009-10-07 14:52:13 +0000 |
51 | @@ -0,0 +1,12 @@ |
52 | +-- Copyright 2009 Canonical Ltd. This software is licensed under the |
53 | +-- GNU Affero General Public License version 3 (see the file LICENSE). |
54 | + |
55 | +SET client_min_messages=ERROR; |
56 | + |
57 | + |
58 | +-- Add a column for external archive dependencies. |
59 | +ALTER TABLE Archive |
60 | + ADD COLUMN external_dependencies text DEFAULT NULL; |
61 | + |
62 | + |
63 | +INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 05, 0); |
64 | |
65 | === modified file 'lib/canonical/config/schema-lazr.conf' |
66 | --- lib/canonical/config/schema-lazr.conf 2009-10-01 12:06:50 +0000 |
67 | +++ lib/canonical/config/schema-lazr.conf 2009-10-07 14:52:13 +0000 |
68 | @@ -1418,13 +1418,6 @@ |
69 | |
70 | |
71 | [ppa.master] |
72 | -# Line-separated repository lines to be used as build dependencies, in |
73 | -# the following format: |
74 | -# deb [user:pass@]<host>[/path] %(series)s[-pocket] [components] |
75 | -# 'series' variable is replaced with the series name of the context build. |
76 | -# datatype: string |
77 | -dependencies: none |
78 | - |
79 | |
80 | [poimport] |
81 | # The database user which will be used by this process. |
82 | |
83 | === modified file 'lib/lp/soyuz/adapters/archivedependencies.py' |
84 | --- lib/lp/soyuz/adapters/archivedependencies.py 2009-08-16 12:38:12 +0000 |
85 | +++ lib/lp/soyuz/adapters/archivedependencies.py 2009-10-07 14:52:13 +0000 |
86 | @@ -36,7 +36,6 @@ |
87 | 'pocket_dependencies', |
88 | ] |
89 | |
90 | -from canonical.config import config |
91 | from lp.registry.interfaces.pocket import ( |
92 | PackagePublishingPocket, pocketsuffix) |
93 | from lp.soyuz.interfaces.archive import ArchivePurpose, ALLOW_RELEASE_BUILDS |
94 | @@ -161,11 +160,9 @@ |
95 | |
96 | # Append external sources_list lines for this archive if it's |
97 | # specified in the configuration. |
98 | - archive_config_key = 'ppa.%s_%s' % ( |
99 | - build.archive.owner.name, build.archive.name) |
100 | - if archive_config_key in config: |
101 | - archive_config = config[archive_config_key] |
102 | - for archive_dep in archive_config.dependencies.splitlines(): |
103 | + dependencies = build.archive.external_dependencies |
104 | + if dependencies is not None: |
105 | + for archive_dep in dependencies.splitlines(): |
106 | line = archive_dep % ( |
107 | {'series': build.distroarchseries.distroseries.name}) |
108 | sources_list_lines.append(line) |
109 | |
110 | === modified file 'lib/lp/soyuz/browser/archive.py' |
111 | --- lib/lp/soyuz/browser/archive.py 2009-09-18 21:00:18 +0000 |
112 | +++ lib/lp/soyuz/browser/archive.py 2009-10-07 14:52:13 +0000 |
113 | @@ -28,6 +28,7 @@ |
114 | |
115 | from datetime import datetime, timedelta |
116 | import pytz |
117 | +from urlparse import urlparse |
118 | |
119 | from zope.app.form.browser import TextAreaWidget |
120 | from zope.component import getUtility |
121 | @@ -1754,7 +1755,10 @@ |
122 | class ArchiveAdminView(BaseArchiveEditView): |
123 | |
124 | field_names = ['enabled', 'private', 'require_virtualized', |
125 | - 'buildd_secret', 'authorized_size', 'relative_build_score'] |
126 | + 'buildd_secret', 'authorized_size', 'relative_build_score', |
127 | + 'external_dependencies'] |
128 | + |
129 | + custom_widget('external_dependencies', TextAreaWidget, height=3) |
130 | |
131 | def validate_save(self, action, data): |
132 | """Validate the save action on ArchiveAdminView. |
133 | @@ -1773,12 +1777,44 @@ |
134 | self.setFieldError( |
135 | 'private', |
136 | 'Private teams may not have public archives.') |
137 | - |
138 | elif data.get('buildd_secret') is not None and not data['private']: |
139 | self.setFieldError( |
140 | 'buildd_secret', |
141 | 'Do not specify for non-private archives') |
142 | |
143 | + # Check the external_dependencies field. |
144 | + ext_deps = data.get('external_dependencies') |
145 | + if ext_deps is not None: |
146 | + errors = self.validate_external_dependencies(ext_deps) |
147 | + if len(errors) != 0: |
148 | + error_text = "\n".join(errors) |
149 | + self.setFieldError('external_dependencies', error_text) |
150 | + |
151 | + def validate_external_dependencies(self, ext_deps): |
152 | + """Validate the external_dependencies field. |
153 | + |
154 | + :param ext_deps: The dependencies form field to check. |
155 | + """ |
156 | + errors = [] |
157 | + # The field can consist of multiple entries separated by |
158 | + # newlines, so process each in turn. |
159 | + for dep in ext_deps.splitlines(): |
160 | + try: |
161 | + deb, url, suite, components = dep.split(" ", 3) |
162 | + except ValueError: |
163 | + errors.append( |
164 | + "'%s' is not a complete and valid sources.list entry" |
165 | + % dep) |
166 | + continue |
167 | + |
168 | + if deb != "deb": |
169 | + errors.append("%s: Must start with 'deb'" % dep) |
170 | + url_components = urlparse(url) |
171 | + if not url_components[0] or not url_components[1]: |
172 | + errors.append("%s: Invalid URL" % dep) |
173 | + |
174 | + return errors |
175 | + |
176 | @property |
177 | def owner_is_private_team(self): |
178 | """Is the owner a private team? |
179 | |
180 | === modified file 'lib/lp/soyuz/browser/tests/archive-views.txt' |
181 | --- lib/lp/soyuz/browser/tests/archive-views.txt 2009-10-01 07:05:22 +0000 |
182 | +++ lib/lp/soyuz/browser/tests/archive-views.txt 2009-10-07 14:52:13 +0000 |
183 | @@ -1349,3 +1349,50 @@ |
184 | |
185 | >>> print copy.status.name |
186 | ACCEPTED |
187 | + |
188 | + |
189 | +== External dependencies validation == |
190 | + |
191 | +The ArchiveAdminView checks the external_dependencies form data to see if |
192 | +it's a valid sources.list entry. |
193 | + |
194 | + >>> ppa_archive_view = create_initialized_view( |
195 | + ... cprov.archive, name="+admin") |
196 | + |
197 | +The validate_external_dependencies() method is called when validating and will |
198 | +return a list of errors if the data dis not validate. A valid entry is of the |
199 | +form: |
200 | + deb scheme://domain/ suite component[s] |
201 | + |
202 | + >>> print ppa_archive_view.validate_external_dependencies( |
203 | + ... "deb http://example.com/ karmic main") |
204 | + [] |
205 | + |
206 | +Multiple entries are valid, separated by newlines: |
207 | + |
208 | + >>> print ppa_archive_view.validate_external_dependencies( |
209 | + ... "deb http://example.com/ karmic main\n" |
210 | + ... "deb http://example.com/ karmic restricted") |
211 | + [] |
212 | + |
213 | +If the line does not start with the word "deb" it fails: |
214 | + |
215 | + >>> print ppa_archive_view.validate_external_dependencies( |
216 | + ... "deb http://example.com/ karmic universe\n" |
217 | + ... "dab http://example.com/ karmic main") |
218 | + ["dab http://example.com/ karmic main: Must start with 'deb'"] |
219 | + |
220 | +If the line has too few parts it fails. Here we're missing a suite: |
221 | + |
222 | + >>> print ppa_archive_view.validate_external_dependencies( |
223 | + ... "deb http://example.com/ karmic universe\n" |
224 | + ... "deb http://example.com/ main") |
225 | + ["'deb http://example.com/ main' |
226 | + is not a complete and valid sources.list entry"] |
227 | + |
228 | +If the URL looks invalid, it fails: |
229 | + |
230 | + >>> print ppa_archive_view.validate_external_dependencies( |
231 | + ... "deb http://example.com/ karmic universe\n" |
232 | + ... "deb example.com/ karmic main") |
233 | + ['deb example.com/ karmic main: Invalid URL'] |
234 | |
235 | === modified file 'lib/lp/soyuz/configure.zcml' |
236 | --- lib/lp/soyuz/configure.zcml 2009-09-29 07:21:40 +0000 |
237 | +++ lib/lp/soyuz/configure.zcml 2009-10-07 14:52:13 +0000 |
238 | @@ -399,8 +399,8 @@ |
239 | <require |
240 | permission="launchpad.Commercial" |
241 | set_attributes="authorized_size buildd_secret |
242 | - enabled private require_virtualized |
243 | - relative_build_score"/> |
244 | + enabled external_dependencies private |
245 | + require_virtualized relative_build_score "/> |
246 | <require |
247 | permission="launchpad.Admin" |
248 | set_attributes="distribution name signing_key"/> |
249 | |
250 | === modified file 'lib/lp/soyuz/doc/archive-dependencies.txt' |
251 | --- lib/lp/soyuz/doc/archive-dependencies.txt 2009-08-28 07:34:44 +0000 |
252 | +++ lib/lp/soyuz/doc/archive-dependencies.txt 2009-10-07 14:52:13 +0000 |
253 | @@ -441,38 +441,27 @@ |
254 | |
255 | == External build dependencies == |
256 | |
257 | -Via a static configuration change, any PPA hosted in launchpad can be |
258 | +Via an administrator change, any PPA hosted in launchpad can be |
259 | assigned to one or more 'external' build dependencies additionally to |
260 | the internal ones. |
261 | |
262 | -There is a configuration category called 'ppa' which can be extended |
263 | -for any hosted PPA. They are named as following: |
264 | - |
265 | - [ppa.<owner_name>_<ppa_name>] |
266 | - |
267 | -The 'ppa' categories contain the 'dependencies' field, which is a |
268 | -multi-line string listing the external dependencies in the debian |
269 | -sources_list format. |
270 | - |
271 | - deb [user:pass@]<host>[/path] %(series)s[-pocket] [components] |
272 | +There is a column on IArchive called 'external_dependencies' which can be set |
273 | +for any hosted PPA. It is a string listing the comma-separated external |
274 | +dependencies in the debian sources_list format. |
275 | + |
276 | + deb http[s]://[user:pass@]<host>[/path] %(series)s[-pocket] [components] |
277 | |
278 | The '%(series)s' part is optional and will be replaced on-the-fly with |
279 | the series name for the build record being dispatched. |
280 | |
281 | -We will create a configuration for Celso's PPA. |
282 | - |
283 | - >>> from canonical.config import config |
284 | - >>> cprov_deps = """ |
285 | - ... [ppa.cprov_ppa] |
286 | - ... dependencies: |
287 | - ... deb http://user:pass@repository zoing everything |
288 | - ... deb http://user:pass@repository %(series)s public private |
289 | - ... deb http://user:pass@repository %(series)s-extra public |
290 | - ... """ |
291 | - >>> config.push('test_deps', cprov_deps) |
292 | - |
293 | -Configuration in place, now builds in Celso's PPA will use the |
294 | -external dependencies. |
295 | +We will create some dependencies for Celso's PPA. |
296 | + |
297 | + >>> cprov.archive.external_dependencies = ( |
298 | + ... "deb http://user:pass@repository zoing everything\n" |
299 | + ... "deb http://user:pass@repository %(series)s public private\n" |
300 | + ... "deb http://user:pass@repository %(series)s-extra public") |
301 | + |
302 | +Now builds in Celso's PPA will use the external dependencies. |
303 | |
304 | >>> print_building_sources_list(a_build) |
305 | deb http://ftpmaster.internal/ubuntu hoary |
306 | @@ -486,6 +475,3 @@ |
307 | deb http://user:pass@repository hoary-extra public |
308 | deb http://user:pass@repository zoing everything |
309 | |
310 | -Tests done, we can remove the extra configuration content we've added. |
311 | - |
312 | - >>> unused = config.pop('test_deps') |
313 | |
314 | === modified file 'lib/lp/soyuz/doc/archive.txt' |
315 | --- lib/lp/soyuz/doc/archive.txt 2009-09-23 07:41:13 +0000 |
316 | +++ lib/lp/soyuz/doc/archive.txt 2009-10-07 14:52:13 +0000 |
317 | @@ -58,11 +58,11 @@ |
318 | >>> cprov_archive.failed_count |
319 | 1 |
320 | |
321 | -relative_build_score is a property that can be set only by LP admins and read |
322 | -by anyone. It is a signed integer that represents a delta to all the build |
323 | -scores for builds done in the archive. |
324 | +relative_build_score and external_dependencies are properties that can be set |
325 | +only by LP admins and read by anyone. |
326 | |
327 | -The default value is zero: |
328 | +relative_build_score is a signed integer that represents a delta to all the |
329 | +build scores for builds done in the archive. The default value is zero: |
330 | |
331 | >>> cprov_archive.relative_build_score |
332 | 0 |
333 | @@ -74,10 +74,28 @@ |
334 | ... |
335 | Unauthorized: (..., 'relative_build_score', 'launchpad.Commercial') |
336 | |
337 | -As a Launchpad admin, it will work. |
338 | +external_dependencies is a text field that should contain a comma-separated |
339 | +list of sources.list entries in the format: |
340 | +deb http[s]://[user:pass@]<host>[/path] %(series)s[-pocket] [components] |
341 | +where the series variable is replaced with the series name of the context |
342 | +build. This allows an admin to set external repositories as a source for |
343 | +build dependencies on the context PPA. Its default value is None: |
344 | + |
345 | + >>> print cprov_archive.external_dependencies |
346 | + None |
347 | + |
348 | +Amending it as an unprivileged user results in failure: |
349 | + |
350 | + >>> cprov_archive.external_dependencies = "test" |
351 | + Traceback (most recent call last): |
352 | + ... |
353 | + Unauthorized: (..., 'external_dependencies', 'launchpad.Commercial') |
354 | + |
355 | +As a Launchpad admin, setting these properties will work. |
356 | |
357 | >>> login("admin@canonical.com") |
358 | >>> cprov_archive.relative_build_score = 100 |
359 | + >>> cprov_archive.external_dependencies = "test" |
360 | |
361 | The buildd_secret is used by the slave scanner when generating a |
362 | sources.list entry for the builder to access a private archive. It is |
363 | |
364 | === modified file 'lib/lp/soyuz/interfaces/archive.py' |
365 | --- lib/lp/soyuz/interfaces/archive.py 2009-09-23 07:41:13 +0000 |
366 | +++ lib/lp/soyuz/interfaces/archive.py 2009-10-07 14:52:13 +0000 |
367 | @@ -253,6 +253,18 @@ |
368 | description=_( |
369 | "A delta to apply to all build scores for this archive.")) |
370 | |
371 | + external_dependencies = Text( |
372 | + title=_("External dependencies"), required=False, readonly=False, |
373 | + description=_( |
374 | + "Newline-separated list of repositories to be used to retrieve " |
375 | + "any external build dependencies when building packages in this " |
376 | + "archive, in the format:\n" |
377 | + "deb http[s]://[user:pass@]<host>[/path] %(series)s[-pocket] " |
378 | + "[components]\n" |
379 | + "The series variable is replaced with the series name of the " |
380 | + "context build.\n" |
381 | + "NOTE: This is for migration of OEM PPAs only!")) |
382 | + |
383 | def getSourcesForDeletion(name=None, status=None, distroseries=None): |
384 | """All `ISourcePackagePublishingHistory` available for deletion. |
385 | |
386 | |
387 | === modified file 'lib/lp/soyuz/model/archive.py' |
388 | --- lib/lp/soyuz/model/archive.py 2009-09-30 14:30:46 +0000 |
389 | +++ lib/lp/soyuz/model/archive.py 2009-10-07 14:52:13 +0000 |
390 | @@ -174,6 +174,12 @@ |
391 | relative_build_score = IntCol( |
392 | dbName='relative_build_score', notNull=True, default=0) |
393 | |
394 | + # This field is specifically and only intended for OEM migration to |
395 | + # Launchpad and should be re-examined in October 2010 to see if it |
396 | + # is still relevant. |
397 | + external_dependencies = StringCol( |
398 | + dbName='external_dependencies', notNull=False, default=None) |
399 | + |
400 | def _init(self, *args, **kw): |
401 | """Provide the right interface for URL traversal.""" |
402 | SQLBase._init(self, *args, **kw) |
403 | |
404 | === modified file 'lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt' |
405 | --- lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt 2009-09-18 15:24:30 +0000 |
406 | +++ lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt 2009-10-07 14:52:13 +0000 |
407 | @@ -345,6 +345,7 @@ |
408 | * Set a maximum disk size: uploads will be rejected if the resulting |
409 | PPA size is exceeding the authorized size. |
410 | * Set a per-archive build score delta. |
411 | + * Set external archive dependencies |
412 | |
413 | In this case, the administrator may wish to amend the PPA so that it is |
414 | set up like the ubuntu security PPA, which is private but does not |
415 | @@ -358,6 +359,8 @@ |
416 | True |
417 | >>> admin_browser.getControl(name="field.relative_build_score").value |
418 | '0' |
419 | + >>> admin_browser.getControl(name="field.external_dependencies").value |
420 | + '' |
421 | |
422 | >>> admin_browser.getControl(name="field.enabled").value = False |
423 | >>> admin_browser.getControl(name="field.private").value = True |
424 | @@ -367,6 +370,9 @@ |
425 | >>> admin_browser.getControl(name="field.authorized_size").value = '1' |
426 | >>> admin_browser.getControl( |
427 | ... name="field.relative_build_score").value = '199' |
428 | + >>> admin_browser.getControl( |
429 | + ... name="field.external_dependencies" |
430 | + ... ).value = "deb http://my.spethial.repo.com/ %(series)s main" |
431 | >>> admin_browser.getControl("Save").click() |
432 | |
433 | Once confirmed the administrator is sent to the PPA page where he can |
434 | @@ -379,16 +385,33 @@ |
435 | ... print msg |
436 | This archive has been disabled. |
437 | |
438 | -We need go back to the "Administer archive" page to see the build score change |
439 | -that was made: |
440 | +We need go back to the "Administer archive" page to see the build score and |
441 | +external dependencies changes that were made: |
442 | |
443 | >>> admin_browser.getLink("Administer archive").click() |
444 | >>> admin_browser.getControl(name="field.relative_build_score").value |
445 | '199' |
446 | + >>> admin_browser.getControl(name="field.external_dependencies").value |
447 | + 'deb http://my.spethial.repo.com/ %(series)s main' |
448 | + |
449 | +The external dependencies field is validated to make sure it looks like |
450 | +a sources.list entry. If the field fails validation an error is displayed. |
451 | + |
452 | + >>> admin_browser.getControl( |
453 | + ... name="field.external_dependencies" |
454 | + ... ).value = "deb not_a_url" |
455 | + >>> admin_browser.getControl("Save").click() |
456 | + >>> for error in get_feedback_messages(admin_browser.contents): |
457 | + ... print error |
458 | + There is 1 error. |
459 | + 'deb not_a_url' is not a complete and valid sources.list entry |
460 | + |
461 | |
462 | When the archive is private, the buildd secret must also be set, or an |
463 | error is issued: |
464 | |
465 | + >>> admin_browser.getControl( |
466 | + ... name="field.external_dependencies").value = "" |
467 | >>> admin_browser.getControl(name="field.private").value = True |
468 | >>> admin_browser.getControl(name="field.buildd_secret").value = "" |
469 | >>> admin_browser.getControl("Save").click() |
Submitting to db-devel blank email FTW!
Ok, here's what I did:
= Summary =
Move a PPA's external dependencies from config to the database
A PPA can use external repositories for build dependencies. This was only
done for OEM Services as they have some dependencies that are not in PPAs.
The problem was that with the original implementation done via config items,
the LOSAs need to CP any changes and it turns out that OEM needs a few of
these per week.
So, the dependencies now come from a new database column which is only
editable on the PPA admin form so it's restricted to admins only. We don't
want anyone being able to set this as it breaks the promise that all the
source for a PPA binary is available in another PPA or Ubuntu.
To test, run: cies.txt -t xx-ppa-workflow.txt
bin/test -cvvt archive.txt -t archivedependen
And you can see an example of admin page at: launchpad. dev/~mark/ +archive/ ppa/+admin
http://