Merge lp:~julian-edwards/launchpad/ppa-dependency-schema into lp:launchpad/db-devel

Proposed by Julian Edwards
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
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
To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

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:
bin/test -cvvt archive.txt -t archivedependencies.txt -t xx-ppa-workflow.txt

And you can see an example of admin page at:
http://launchpad.dev/~mark/+archive/ppa/+admin

Revision history for this message
Graham Binns (gmb) :
review: Approve (code)
Revision history for this message
Stuart Bishop (stub) wrote :

Discussed on irc, all fine.

patch-2207-05-0.sql

review: Approve (schema)
Revision history for this message
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.

review: Approve (schema)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'database/sampledata/current-dev.sql'
--- database/sampledata/current-dev.sql 2009-09-07 01:46:23 +0000
+++ database/sampledata/current-dev.sql 2009-10-07 14:52:13 +0000
@@ -969,18 +969,18 @@
969969
970ALTER TABLE archive DISABLE TRIGGER ALL;970ALTER TABLE archive DISABLE TRIGGER ALL;
971971
972INSERT 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);972INSERT 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);
973INSERT 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);973INSERT 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);
974INSERT 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);974INSERT 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);
975INSERT 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);975INSERT 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);
976INSERT 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);976INSERT 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);
977INSERT 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);977INSERT 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);
978INSERT 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);978INSERT 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);
979INSERT 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);979INSERT 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);
980INSERT 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);980INSERT 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);
981INSERT 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);981INSERT 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);
982INSERT 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);982INSERT 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);
983INSERT 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);983INSERT 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);
984984
985985
986ALTER TABLE archive ENABLE TRIGGER ALL;986ALTER TABLE archive ENABLE TRIGGER ALL;
987987
=== modified file 'database/schema/comments.sql'
--- database/schema/comments.sql 2009-09-25 08:46:57 +0000
+++ database/schema/comments.sql 2009-10-07 14:52:13 +0000
@@ -1865,6 +1865,7 @@
1865COMMENT 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.';1865COMMENT 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.';
1866COMMENT ON COLUMN Archive.num_old_versions_published IS 'The number of versions of a package to keep published before older versions are superseded.';1866COMMENT ON COLUMN Archive.num_old_versions_published IS 'The number of versions of a package to keep published before older versions are superseded.';
1867COMMENT ON COLUMN Archive.relative_build_score IS 'A delta to the build score that is applied to all builds in this archive.';1867COMMENT ON COLUMN Archive.relative_build_score IS 'A delta to the build score that is applied to all builds in this archive.';
1868COMMENT 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.';
18681869
1869-- ArchiveAuthToken1870-- ArchiveAuthToken
18701871
18711872
=== added file 'database/schema/patch-2207-05-0.sql'
--- database/schema/patch-2207-05-0.sql 1970-01-01 00:00:00 +0000
+++ database/schema/patch-2207-05-0.sql 2009-10-07 14:52:13 +0000
@@ -0,0 +1,12 @@
1-- Copyright 2009 Canonical Ltd. This software is licensed under the
2-- GNU Affero General Public License version 3 (see the file LICENSE).
3
4SET client_min_messages=ERROR;
5
6
7-- Add a column for external archive dependencies.
8ALTER TABLE Archive
9 ADD COLUMN external_dependencies text DEFAULT NULL;
10
11
12INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 05, 0);
013
=== modified file 'lib/canonical/config/schema-lazr.conf'
--- lib/canonical/config/schema-lazr.conf 2009-10-01 12:06:50 +0000
+++ lib/canonical/config/schema-lazr.conf 2009-10-07 14:52:13 +0000
@@ -1418,13 +1418,6 @@
14181418
14191419
1420[ppa.master]1420[ppa.master]
1421# Line-separated repository lines to be used as build dependencies, in
1422# the following format:
1423# deb [user:pass@]<host>[/path] %(series)s[-pocket] [components]
1424# 'series' variable is replaced with the series name of the context build.
1425# datatype: string
1426dependencies: none
1427
14281421
1429[poimport]1422[poimport]
1430# The database user which will be used by this process.1423# The database user which will be used by this process.
14311424
=== modified file 'lib/lp/soyuz/adapters/archivedependencies.py'
--- lib/lp/soyuz/adapters/archivedependencies.py 2009-08-16 12:38:12 +0000
+++ lib/lp/soyuz/adapters/archivedependencies.py 2009-10-07 14:52:13 +0000
@@ -36,7 +36,6 @@
36 'pocket_dependencies',36 'pocket_dependencies',
37 ]37 ]
3838
39from canonical.config import config
40from lp.registry.interfaces.pocket import (39from lp.registry.interfaces.pocket import (
41 PackagePublishingPocket, pocketsuffix)40 PackagePublishingPocket, pocketsuffix)
42from lp.soyuz.interfaces.archive import ArchivePurpose, ALLOW_RELEASE_BUILDS41from lp.soyuz.interfaces.archive import ArchivePurpose, ALLOW_RELEASE_BUILDS
@@ -161,11 +160,9 @@
161160
162 # Append external sources_list lines for this archive if it's161 # Append external sources_list lines for this archive if it's
163 # specified in the configuration.162 # specified in the configuration.
164 archive_config_key = 'ppa.%s_%s' % (163 dependencies = build.archive.external_dependencies
165 build.archive.owner.name, build.archive.name)164 if dependencies is not None:
166 if archive_config_key in config:165 for archive_dep in dependencies.splitlines():
167 archive_config = config[archive_config_key]
168 for archive_dep in archive_config.dependencies.splitlines():
169 line = archive_dep % (166 line = archive_dep % (
170 {'series': build.distroarchseries.distroseries.name})167 {'series': build.distroarchseries.distroseries.name})
171 sources_list_lines.append(line)168 sources_list_lines.append(line)
172169
=== modified file 'lib/lp/soyuz/browser/archive.py'
--- lib/lp/soyuz/browser/archive.py 2009-09-18 21:00:18 +0000
+++ lib/lp/soyuz/browser/archive.py 2009-10-07 14:52:13 +0000
@@ -28,6 +28,7 @@
2828
29from datetime import datetime, timedelta29from datetime import datetime, timedelta
30import pytz30import pytz
31from urlparse import urlparse
3132
32from zope.app.form.browser import TextAreaWidget33from zope.app.form.browser import TextAreaWidget
33from zope.component import getUtility34from zope.component import getUtility
@@ -1754,7 +1755,10 @@
1754class ArchiveAdminView(BaseArchiveEditView):1755class ArchiveAdminView(BaseArchiveEditView):
17551756
1756 field_names = ['enabled', 'private', 'require_virtualized',1757 field_names = ['enabled', 'private', 'require_virtualized',
1757 'buildd_secret', 'authorized_size', 'relative_build_score']1758 'buildd_secret', 'authorized_size', 'relative_build_score',
1759 'external_dependencies']
1760
1761 custom_widget('external_dependencies', TextAreaWidget, height=3)
17581762
1759 def validate_save(self, action, data):1763 def validate_save(self, action, data):
1760 """Validate the save action on ArchiveAdminView.1764 """Validate the save action on ArchiveAdminView.
@@ -1773,12 +1777,44 @@
1773 self.setFieldError(1777 self.setFieldError(
1774 'private',1778 'private',
1775 'Private teams may not have public archives.')1779 'Private teams may not have public archives.')
1776
1777 elif data.get('buildd_secret') is not None and not data['private']:1780 elif data.get('buildd_secret') is not None and not data['private']:
1778 self.setFieldError(1781 self.setFieldError(
1779 'buildd_secret',1782 'buildd_secret',
1780 'Do not specify for non-private archives')1783 'Do not specify for non-private archives')
17811784
1785 # Check the external_dependencies field.
1786 ext_deps = data.get('external_dependencies')
1787 if ext_deps is not None:
1788 errors = self.validate_external_dependencies(ext_deps)
1789 if len(errors) != 0:
1790 error_text = "\n".join(errors)
1791 self.setFieldError('external_dependencies', error_text)
1792
1793 def validate_external_dependencies(self, ext_deps):
1794 """Validate the external_dependencies field.
1795
1796 :param ext_deps: The dependencies form field to check.
1797 """
1798 errors = []
1799 # The field can consist of multiple entries separated by
1800 # newlines, so process each in turn.
1801 for dep in ext_deps.splitlines():
1802 try:
1803 deb, url, suite, components = dep.split(" ", 3)
1804 except ValueError:
1805 errors.append(
1806 "'%s' is not a complete and valid sources.list entry"
1807 % dep)
1808 continue
1809
1810 if deb != "deb":
1811 errors.append("%s: Must start with 'deb'" % dep)
1812 url_components = urlparse(url)
1813 if not url_components[0] or not url_components[1]:
1814 errors.append("%s: Invalid URL" % dep)
1815
1816 return errors
1817
1782 @property1818 @property
1783 def owner_is_private_team(self):1819 def owner_is_private_team(self):
1784 """Is the owner a private team?1820 """Is the owner a private team?
17851821
=== modified file 'lib/lp/soyuz/browser/tests/archive-views.txt'
--- lib/lp/soyuz/browser/tests/archive-views.txt 2009-10-01 07:05:22 +0000
+++ lib/lp/soyuz/browser/tests/archive-views.txt 2009-10-07 14:52:13 +0000
@@ -1349,3 +1349,50 @@
13491349
1350 >>> print copy.status.name1350 >>> print copy.status.name
1351 ACCEPTED1351 ACCEPTED
1352
1353
1354== External dependencies validation ==
1355
1356The ArchiveAdminView checks the external_dependencies form data to see if
1357it's a valid sources.list entry.
1358
1359 >>> ppa_archive_view = create_initialized_view(
1360 ... cprov.archive, name="+admin")
1361
1362The validate_external_dependencies() method is called when validating and will
1363return a list of errors if the data dis not validate. A valid entry is of the
1364form:
1365 deb scheme://domain/ suite component[s]
1366
1367 >>> print ppa_archive_view.validate_external_dependencies(
1368 ... "deb http://example.com/ karmic main")
1369 []
1370
1371Multiple entries are valid, separated by newlines:
1372
1373 >>> print ppa_archive_view.validate_external_dependencies(
1374 ... "deb http://example.com/ karmic main\n"
1375 ... "deb http://example.com/ karmic restricted")
1376 []
1377
1378If the line does not start with the word "deb" it fails:
1379
1380 >>> print ppa_archive_view.validate_external_dependencies(
1381 ... "deb http://example.com/ karmic universe\n"
1382 ... "dab http://example.com/ karmic main")
1383 ["dab http://example.com/ karmic main: Must start with 'deb'"]
1384
1385If the line has too few parts it fails. Here we're missing a suite:
1386
1387 >>> print ppa_archive_view.validate_external_dependencies(
1388 ... "deb http://example.com/ karmic universe\n"
1389 ... "deb http://example.com/ main")
1390 ["'deb http://example.com/ main'
1391 is not a complete and valid sources.list entry"]
1392
1393If the URL looks invalid, it fails:
1394
1395 >>> print ppa_archive_view.validate_external_dependencies(
1396 ... "deb http://example.com/ karmic universe\n"
1397 ... "deb example.com/ karmic main")
1398 ['deb example.com/ karmic main: Invalid URL']
13521399
=== modified file 'lib/lp/soyuz/configure.zcml'
--- lib/lp/soyuz/configure.zcml 2009-09-29 07:21:40 +0000
+++ lib/lp/soyuz/configure.zcml 2009-10-07 14:52:13 +0000
@@ -399,8 +399,8 @@
399 <require399 <require
400 permission="launchpad.Commercial"400 permission="launchpad.Commercial"
401 set_attributes="authorized_size buildd_secret401 set_attributes="authorized_size buildd_secret
402 enabled private require_virtualized402 enabled external_dependencies private
403 relative_build_score"/>403 require_virtualized relative_build_score "/>
404 <require404 <require
405 permission="launchpad.Admin"405 permission="launchpad.Admin"
406 set_attributes="distribution name signing_key"/>406 set_attributes="distribution name signing_key"/>
407407
=== modified file 'lib/lp/soyuz/doc/archive-dependencies.txt'
--- lib/lp/soyuz/doc/archive-dependencies.txt 2009-08-28 07:34:44 +0000
+++ lib/lp/soyuz/doc/archive-dependencies.txt 2009-10-07 14:52:13 +0000
@@ -441,38 +441,27 @@
441441
442== External build dependencies ==442== External build dependencies ==
443443
444Via a static configuration change, any PPA hosted in launchpad can be444Via an administrator change, any PPA hosted in launchpad can be
445assigned to one or more 'external' build dependencies additionally to445assigned to one or more 'external' build dependencies additionally to
446the internal ones.446the internal ones.
447447
448There is a configuration category called 'ppa' which can be extended448There is a column on IArchive called 'external_dependencies' which can be set
449for any hosted PPA. They are named as following:449for any hosted PPA. It is a string listing the comma-separated external
450450dependencies in the debian sources_list format.
451 [ppa.<owner_name>_<ppa_name>]451
452452 deb http[s]://[user:pass@]<host>[/path] %(series)s[-pocket] [components]
453The 'ppa' categories contain the 'dependencies' field, which is a
454multi-line string listing the external dependencies in the debian
455sources_list format.
456
457 deb [user:pass@]<host>[/path] %(series)s[-pocket] [components]
458453
459The '%(series)s' part is optional and will be replaced on-the-fly with454The '%(series)s' part is optional and will be replaced on-the-fly with
460the series name for the build record being dispatched.455the series name for the build record being dispatched.
461456
462We will create a configuration for Celso's PPA.457We will create some dependencies for Celso's PPA.
463458
464 >>> from canonical.config import config459 >>> cprov.archive.external_dependencies = (
465 >>> cprov_deps = """460 ... "deb http://user:pass@repository zoing everything\n"
466 ... [ppa.cprov_ppa]461 ... "deb http://user:pass@repository %(series)s public private\n"
467 ... dependencies:462 ... "deb http://user:pass@repository %(series)s-extra public")
468 ... deb http://user:pass@repository zoing everything463
469 ... deb http://user:pass@repository %(series)s public private464Now builds in Celso's PPA will use the external dependencies.
470 ... deb http://user:pass@repository %(series)s-extra public
471 ... """
472 >>> config.push('test_deps', cprov_deps)
473
474Configuration in place, now builds in Celso's PPA will use the
475external dependencies.
476465
477 >>> print_building_sources_list(a_build)466 >>> print_building_sources_list(a_build)
478 deb http://ftpmaster.internal/ubuntu hoary467 deb http://ftpmaster.internal/ubuntu hoary
@@ -486,6 +475,3 @@
486 deb http://user:pass@repository hoary-extra public475 deb http://user:pass@repository hoary-extra public
487 deb http://user:pass@repository zoing everything476 deb http://user:pass@repository zoing everything
488477
489Tests done, we can remove the extra configuration content we've added.
490
491 >>> unused = config.pop('test_deps')
492478
=== modified file 'lib/lp/soyuz/doc/archive.txt'
--- lib/lp/soyuz/doc/archive.txt 2009-09-23 07:41:13 +0000
+++ lib/lp/soyuz/doc/archive.txt 2009-10-07 14:52:13 +0000
@@ -58,11 +58,11 @@
58 >>> cprov_archive.failed_count58 >>> cprov_archive.failed_count
59 159 1
6060
61relative_build_score is a property that can be set only by LP admins and read61relative_build_score and external_dependencies are properties that can be set
62by anyone. It is a signed integer that represents a delta to all the build62only by LP admins and read by anyone.
63scores for builds done in the archive.
6463
65The default value is zero:64relative_build_score is a signed integer that represents a delta to all the
65build scores for builds done in the archive. The default value is zero:
6666
67 >>> cprov_archive.relative_build_score67 >>> cprov_archive.relative_build_score
68 068 0
@@ -74,10 +74,28 @@
74 ...74 ...
75 Unauthorized: (..., 'relative_build_score', 'launchpad.Commercial')75 Unauthorized: (..., 'relative_build_score', 'launchpad.Commercial')
7676
77As a Launchpad admin, it will work.77external_dependencies is a text field that should contain a comma-separated
78list of sources.list entries in the format:
79deb http[s]://[user:pass@]<host>[/path] %(series)s[-pocket] [components]
80where the series variable is replaced with the series name of the context
81build. This allows an admin to set external repositories as a source for
82build dependencies on the context PPA. Its default value is None:
83
84 >>> print cprov_archive.external_dependencies
85 None
86
87Amending it as an unprivileged user results in failure:
88
89 >>> cprov_archive.external_dependencies = "test"
90 Traceback (most recent call last):
91 ...
92 Unauthorized: (..., 'external_dependencies', 'launchpad.Commercial')
93
94As a Launchpad admin, setting these properties will work.
7895
79 >>> login("admin@canonical.com")96 >>> login("admin@canonical.com")
80 >>> cprov_archive.relative_build_score = 10097 >>> cprov_archive.relative_build_score = 100
98 >>> cprov_archive.external_dependencies = "test"
8199
82The buildd_secret is used by the slave scanner when generating a100The buildd_secret is used by the slave scanner when generating a
83sources.list entry for the builder to access a private archive. It is101sources.list entry for the builder to access a private archive. It is
84102
=== modified file 'lib/lp/soyuz/interfaces/archive.py'
--- lib/lp/soyuz/interfaces/archive.py 2009-09-23 07:41:13 +0000
+++ lib/lp/soyuz/interfaces/archive.py 2009-10-07 14:52:13 +0000
@@ -253,6 +253,18 @@
253 description=_(253 description=_(
254 "A delta to apply to all build scores for this archive."))254 "A delta to apply to all build scores for this archive."))
255255
256 external_dependencies = Text(
257 title=_("External dependencies"), required=False, readonly=False,
258 description=_(
259 "Newline-separated list of repositories to be used to retrieve "
260 "any external build dependencies when building packages in this "
261 "archive, in the format:\n"
262 "deb http[s]://[user:pass@]<host>[/path] %(series)s[-pocket] "
263 "[components]\n"
264 "The series variable is replaced with the series name of the "
265 "context build.\n"
266 "NOTE: This is for migration of OEM PPAs only!"))
267
256 def getSourcesForDeletion(name=None, status=None, distroseries=None):268 def getSourcesForDeletion(name=None, status=None, distroseries=None):
257 """All `ISourcePackagePublishingHistory` available for deletion.269 """All `ISourcePackagePublishingHistory` available for deletion.
258270
259271
=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py 2009-09-30 14:30:46 +0000
+++ lib/lp/soyuz/model/archive.py 2009-10-07 14:52:13 +0000
@@ -174,6 +174,12 @@
174 relative_build_score = IntCol(174 relative_build_score = IntCol(
175 dbName='relative_build_score', notNull=True, default=0)175 dbName='relative_build_score', notNull=True, default=0)
176176
177 # This field is specifically and only intended for OEM migration to
178 # Launchpad and should be re-examined in October 2010 to see if it
179 # is still relevant.
180 external_dependencies = StringCol(
181 dbName='external_dependencies', notNull=False, default=None)
182
177 def _init(self, *args, **kw):183 def _init(self, *args, **kw):
178 """Provide the right interface for URL traversal."""184 """Provide the right interface for URL traversal."""
179 SQLBase._init(self, *args, **kw)185 SQLBase._init(self, *args, **kw)
180186
=== modified file 'lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt'
--- lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt 2009-09-18 15:24:30 +0000
+++ lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt 2009-10-07 14:52:13 +0000
@@ -345,6 +345,7 @@
345 * Set a maximum disk size: uploads will be rejected if the resulting345 * Set a maximum disk size: uploads will be rejected if the resulting
346 PPA size is exceeding the authorized size.346 PPA size is exceeding the authorized size.
347 * Set a per-archive build score delta.347 * Set a per-archive build score delta.
348 * Set external archive dependencies
348349
349In this case, the administrator may wish to amend the PPA so that it is350In this case, the administrator may wish to amend the PPA so that it is
350set up like the ubuntu security PPA, which is private but does not351set up like the ubuntu security PPA, which is private but does not
@@ -358,6 +359,8 @@
358 True359 True
359 >>> admin_browser.getControl(name="field.relative_build_score").value360 >>> admin_browser.getControl(name="field.relative_build_score").value
360 '0'361 '0'
362 >>> admin_browser.getControl(name="field.external_dependencies").value
363 ''
361364
362 >>> admin_browser.getControl(name="field.enabled").value = False365 >>> admin_browser.getControl(name="field.enabled").value = False
363 >>> admin_browser.getControl(name="field.private").value = True366 >>> admin_browser.getControl(name="field.private").value = True
@@ -367,6 +370,9 @@
367 >>> admin_browser.getControl(name="field.authorized_size").value = '1'370 >>> admin_browser.getControl(name="field.authorized_size").value = '1'
368 >>> admin_browser.getControl(371 >>> admin_browser.getControl(
369 ... name="field.relative_build_score").value = '199'372 ... name="field.relative_build_score").value = '199'
373 >>> admin_browser.getControl(
374 ... name="field.external_dependencies"
375 ... ).value = "deb http://my.spethial.repo.com/ %(series)s main"
370 >>> admin_browser.getControl("Save").click()376 >>> admin_browser.getControl("Save").click()
371377
372Once confirmed the administrator is sent to the PPA page where he can378Once confirmed the administrator is sent to the PPA page where he can
@@ -379,16 +385,33 @@
379 ... print msg385 ... print msg
380 This archive has been disabled.386 This archive has been disabled.
381387
382We need go back to the "Administer archive" page to see the build score change388We need go back to the "Administer archive" page to see the build score and
383that was made:389external dependencies changes that were made:
384390
385 >>> admin_browser.getLink("Administer archive").click()391 >>> admin_browser.getLink("Administer archive").click()
386 >>> admin_browser.getControl(name="field.relative_build_score").value392 >>> admin_browser.getControl(name="field.relative_build_score").value
387 '199'393 '199'
394 >>> admin_browser.getControl(name="field.external_dependencies").value
395 'deb http://my.spethial.repo.com/ %(series)s main'
396
397The external dependencies field is validated to make sure it looks like
398a sources.list entry. If the field fails validation an error is displayed.
399
400 >>> admin_browser.getControl(
401 ... name="field.external_dependencies"
402 ... ).value = "deb not_a_url"
403 >>> admin_browser.getControl("Save").click()
404 >>> for error in get_feedback_messages(admin_browser.contents):
405 ... print error
406 There is 1 error.
407 'deb not_a_url' is not a complete and valid sources.list entry
408
388409
389When the archive is private, the buildd secret must also be set, or an410When the archive is private, the buildd secret must also be set, or an
390error is issued:411error is issued:
391412
413 >>> admin_browser.getControl(
414 ... name="field.external_dependencies").value = ""
392 >>> admin_browser.getControl(name="field.private").value = True415 >>> admin_browser.getControl(name="field.private").value = True
393 >>> admin_browser.getControl(name="field.buildd_secret").value = ""416 >>> admin_browser.getControl(name="field.buildd_secret").value = ""
394 >>> admin_browser.getControl("Save").click()417 >>> admin_browser.getControl("Save").click()

Subscribers

People subscribed via source and target branches

to status/vote changes: