Merge lp:~edwin-grubbs/launchpad/all-downloads-link-sprite into lp:launchpad
- all-downloads-link-sprite
- Merge into devel
Status: | Merged |
---|---|
Approved by: | Edwin Grubbs |
Approved revision: | no longer in the source branch. |
Merged at revision: | not available |
Proposed branch: | lp:~edwin-grubbs/launchpad/all-downloads-link-sprite |
Merge into: | lp:launchpad |
Diff against target: |
3199 lines 58 files modified
database/sampledata/current-dev.sql (+12/-12) database/schema/Makefile (+3/-3) database/schema/comments.sql (+20/-1) database/schema/fti.py (+8/-12) database/schema/patch-2207-00-3.sql (+6/-1) database/schema/patch-2207-04-0.sql (+13/-0) database/schema/patch-2207-05-0.sql (+12/-0) database/schema/patch-2207-06-0.sql (+122/-0) database/schema/patch-2207-08-0.sql (+20/-0) database/schema/security.cfg (+9/-1) database/schema/trusted.sql (+15/-0) database/schema/unautovacuumable.py (+25/-7) lib/canonical/config/schema-lazr.conf (+0/-7) lib/canonical/ftests/pgsql.py (+11/-0) lib/canonical/launchpad/emailtemplates/branch-merge-proposal-created.txt (+1/-1) lib/canonical/launchpad/icing/style-3-0.css (+3/-0) lib/canonical/launchpad/interfaces/_schema_circular_imports.py (+10/-0) lib/canonical/launchpad/templates/launchpad-login.pt (+7/-7) lib/lp/bugs/doc/externalbugtracker-debbugs.txt (+2/-2) lib/lp/code/browser/branch.py (+12/-2) lib/lp/code/mail/branchmergeproposal.py (+5/-0) lib/lp/code/mail/tests/test_branchmergeproposal.py (+16/-3) lib/lp/code/stories/branches/xx-branch-merge-proposals.txt (+17/-3) lib/lp/code/templates/branchmergeproposal-pagelet-summary.pt (+4/-0) lib/lp/code/templates/branchmergeproposal-resubmit.pt (+3/-2) lib/lp/registry/browser/__init__.py (+47/-9) lib/lp/registry/browser/productseries.py (+7/-2) lib/lp/registry/browser/tests/milestone-views.txt (+6/-0) lib/lp/registry/browser/tests/productseries-views.txt (+38/-9) lib/lp/registry/doc/milestone.txt (+10/-0) lib/lp/registry/model/distribution.py (+1/-0) lib/lp/registry/model/milestone.py (+4/-0) lib/lp/registry/templates/product-index.pt (+1/-1) lib/lp/registry/templates/productseries-delete.pt (+12/-6) lib/lp/soyuz/adapters/archivedependencies.py (+3/-6) lib/lp/soyuz/browser/archive.py (+38/-2) lib/lp/soyuz/browser/configure.zcml (+1/-1) lib/lp/soyuz/browser/packageset.py (+19/-0) lib/lp/soyuz/browser/tests/archive-views.txt (+47/-0) lib/lp/soyuz/configure.zcml (+10/-2) lib/lp/soyuz/doc/archive-dependencies.txt (+14/-28) lib/lp/soyuz/doc/archive.txt (+23/-5) lib/lp/soyuz/doc/distroarchseriesbinarypackage.txt (+1/-0) lib/lp/soyuz/doc/package-cache.txt (+4/-2) lib/lp/soyuz/interfaces/archive.py (+36/-11) lib/lp/soyuz/interfaces/archivepermission.py (+14/-1) lib/lp/soyuz/interfaces/packageset.py (+56/-6) lib/lp/soyuz/interfaces/packagesetgroup.py (+41/-0) lib/lp/soyuz/model/archive.py (+9/-2) lib/lp/soyuz/model/archivepermission.py (+21/-8) lib/lp/soyuz/model/packageset.py (+76/-7) lib/lp/soyuz/model/packagesetgroup.py (+30/-0) lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt (+25/-2) lib/lp/soyuz/stories/webservice/xx-packageset.txt (+234/-60) lib/lp/soyuz/templates/person-archive-subscriptions.pt (+1/-1) lib/lp/soyuz/tests/test_packageset.py (+187/-0) scripts/ftpmaster-tools/_syncorigins.py (+1/-1) utilities/pgmassacre.py (+19/-3) |
To merge this branch: | bzr merge lp:~edwin-grubbs/launchpad/all-downloads-link-sprite |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Nelson (community) | release-critical | Approve | |
Curtis Hovey (community) | code | Approve | |
Review via email: mp+14333@code.launchpad.net |
Commit message
Description of the change
Edwin Grubbs (edwin-grubbs) wrote : | # |
Edwin Grubbs (edwin-grubbs) wrote : | # |
Here is the real diff:
{{{
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -219,7 +219,7 @@
<p class="alternate">
- <a class="sprint info"
+ <a class="sprite info"
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -34,7 +34,7 @@
- <a tal:attributes=
+ <a tal:attributes=
}}}
Curtis Hovey (sinzui) wrote : | # |
This looks good to land. Thanks for fixing the typo and adding the missing class.
Michael Nelson (michael.nelson) wrote : | # |
Approved for the 'real' diff that you've listed. As you said, it'd be great to wait until the last devel changes hit db-devel so you can verify the real diff.
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-11-03 18:13:40 +0000 | |||
4 | @@ -969,18 +969,18 @@ | |||
5 | 969 | 969 | ||
6 | 970 | ALTER TABLE archive DISABLE TRIGGER ALL; | 970 | ALTER TABLE archive DISABLE TRIGGER ALL; |
7 | 971 | 971 | ||
20 | 972 | 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); | 972 | 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 | 973 | 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); | 973 | 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 | 974 | 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); | 974 | 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 | 975 | 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); | 975 | 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 | 976 | 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); | 976 | 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 | 977 | 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); | 977 | 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 | 978 | 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); | 978 | 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 | 979 | 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); | 979 | 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 | 980 | 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); | 980 | 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 | 981 | 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); | 981 | 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 | 982 | 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); | 982 | 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 | 983 | 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); | 983 | 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 | 984 | 984 | ||
33 | 985 | 985 | ||
34 | 986 | ALTER TABLE archive ENABLE TRIGGER ALL; | 986 | ALTER TABLE archive ENABLE TRIGGER ALL; |
35 | 987 | 987 | ||
36 | === modified file 'database/schema/Makefile' | |||
37 | --- database/schema/Makefile 2009-08-04 22:16:48 +0000 | |||
38 | +++ database/schema/Makefile 2009-11-03 18:13:41 +0000 | |||
39 | @@ -113,7 +113,7 @@ | |||
40 | 113 | @ echo "* eg. sudo -u postgres make create" | 113 | @ echo "* eg. sudo -u postgres make create" |
41 | 114 | @ echo | 114 | @ echo |
42 | 115 | @ echo "* Creating database \"$(EMPTY_DBNAME)\"." | 115 | @ echo "* Creating database \"$(EMPTY_DBNAME)\"." |
44 | 116 | @ ${CREATEDB} template1 ${EMPTY_DBNAME} | 116 | @ ${CREATEDB} template0 ${EMPTY_DBNAME} |
45 | 117 | @ if ! `createlang -l ${EMPTY_DBNAME} | grep -qs plpythonu`; then \ | 117 | @ if ! `createlang -l ${EMPTY_DBNAME} | grep -qs plpythonu`; then \ |
46 | 118 | echo "* Installing PL/PythonU"; \ | 118 | echo "* Installing PL/PythonU"; \ |
47 | 119 | createlang -d ${EMPTY_DBNAME} plpythonu; \ | 119 | createlang -d ${EMPTY_DBNAME} plpythonu; \ |
48 | @@ -142,12 +142,12 @@ | |||
49 | 142 | 142 | ||
50 | 143 | @ echo "* Creating session databases '${SESSION_DBNAME}' (if necessary)" | 143 | @ echo "* Creating session databases '${SESSION_DBNAME}' (if necessary)" |
51 | 144 | @if [ "$$((`psql -l | grep -w ${SESSION_DBNAME} | wc -l`))" = '0' ]; \ | 144 | @if [ "$$((`psql -l | grep -w ${SESSION_DBNAME} | wc -l`))" = '0' ]; \ |
53 | 145 | then ${CREATEDB} template1 ${SESSION_DBNAME} ; \ | 145 | then ${CREATEDB} template0 ${SESSION_DBNAME} ; \ |
54 | 146 | createlang plpgsql ${SESSION_DBNAME}; \ | 146 | createlang plpgsql ${SESSION_DBNAME}; \ |
55 | 147 | psql -q -d ${SESSION_DBNAME} -f launchpad_session.sql ; \ | 147 | psql -q -d ${SESSION_DBNAME} -f launchpad_session.sql ; \ |
56 | 148 | fi | 148 | fi |
57 | 149 | @ echo "* Creating session database '${TEST_SESSION_DBNAME}'" | 149 | @ echo "* Creating session database '${TEST_SESSION_DBNAME}'" |
59 | 150 | @ ${CREATEDB} template1 ${TEST_SESSION_DBNAME} | 150 | @ ${CREATEDB} template0 ${TEST_SESSION_DBNAME} |
60 | 151 | @ createlang plpgsql ${TEST_SESSION_DBNAME} | 151 | @ createlang plpgsql ${TEST_SESSION_DBNAME} |
61 | 152 | @ psql -q -d ${TEST_SESSION_DBNAME} -f launchpad_session.sql | 152 | @ psql -q -d ${TEST_SESSION_DBNAME} -f launchpad_session.sql |
62 | 153 | 153 | ||
63 | 154 | 154 | ||
64 | === modified file 'database/schema/comments.sql' | |||
65 | --- database/schema/comments.sql 2009-08-30 01:41:38 +0000 | |||
66 | +++ database/schema/comments.sql 2009-11-03 18:13:41 +0000 | |||
67 | @@ -763,8 +763,11 @@ | |||
68 | 763 | 763 | ||
69 | 764 | -- SprintAttendance | 764 | -- SprintAttendance |
70 | 765 | COMMENT ON TABLE SprintAttendance IS 'The record that someone will be attending a particular sprint or meeting.'; | 765 | COMMENT ON TABLE SprintAttendance IS 'The record that someone will be attending a particular sprint or meeting.'; |
71 | 766 | COMMENT ON COLUMN SprintAttendance.attendee IS 'The person attending the sprint.'; | ||
72 | 767 | COMMENT ON COLUMN SprintAttendance.sprint IS 'The sprint the person is attending.'; | ||
73 | 766 | COMMENT ON COLUMN SprintAttendance.time_starts IS 'The time from which the person will be available to participate in meetings at the sprint.'; | 768 | COMMENT ON COLUMN SprintAttendance.time_starts IS 'The time from which the person will be available to participate in meetings at the sprint.'; |
74 | 767 | COMMENT ON COLUMN SprintAttendance.time_ends IS 'The time of departure from the sprint or conference - this is the last time at which the person is available for meetings during the sprint.'; | 769 | COMMENT ON COLUMN SprintAttendance.time_ends IS 'The time of departure from the sprint or conference - this is the last time at which the person is available for meetings during the sprint.'; |
75 | 770 | COMMENT ON COLUMN SprintAttendance.is_physical IS 'Is the person physically attending the sprint'; | ||
76 | 768 | 771 | ||
77 | 769 | 772 | ||
78 | 770 | -- SprintSpecification | 773 | -- SprintSpecification |
79 | @@ -1862,6 +1865,7 @@ | |||
80 | 1862 | 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.'; | 1865 | 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.'; |
81 | 1863 | COMMENT ON COLUMN Archive.num_old_versions_published IS 'The number of versions of a package to keep published before older versions are superseded.'; | 1866 | COMMENT ON COLUMN Archive.num_old_versions_published IS 'The number of versions of a package to keep published before older versions are superseded.'; |
82 | 1864 | COMMENT ON COLUMN Archive.relative_build_score IS 'A delta to the build score that is applied to all builds in this archive.'; | 1867 | COMMENT ON COLUMN Archive.relative_build_score IS 'A delta to the build score that is applied to all builds in this archive.'; |
83 | 1868 | 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.'; | ||
84 | 1865 | 1869 | ||
85 | 1866 | -- ArchiveAuthToken | 1870 | -- ArchiveAuthToken |
86 | 1867 | 1871 | ||
87 | @@ -2235,11 +2239,20 @@ | |||
88 | 2235 | 2239 | ||
89 | 2236 | -- Packageset | 2240 | -- Packageset |
90 | 2237 | 2241 | ||
92 | 2238 | COMMENT ON TABLE Packageset IS 'Package sets facilitate the grouping of packages for purposes like the control of upload permissions, et.'; | 2242 | COMMENT ON TABLE Packageset IS 'Package sets facilitate the grouping of packages (in a given distro series) for purposes like the control of upload permissions, etc.'; |
93 | 2239 | COMMENT ON COLUMN Packageset.date_created IS 'Date and time of creation.'; | 2243 | COMMENT ON COLUMN Packageset.date_created IS 'Date and time of creation.'; |
94 | 2240 | COMMENT ON COLUMN Packageset.owner IS 'The Person or team who owns the package set'; | 2244 | COMMENT ON COLUMN Packageset.owner IS 'The Person or team who owns the package set'; |
95 | 2241 | COMMENT ON COLUMN Packageset.name IS 'The name for the package set on hand.'; | 2245 | COMMENT ON COLUMN Packageset.name IS 'The name for the package set on hand.'; |
96 | 2242 | COMMENT ON COLUMN Packageset.description IS 'The description for the package set on hand.'; | 2246 | COMMENT ON COLUMN Packageset.description IS 'The description for the package set on hand.'; |
97 | 2247 | COMMENT ON COLUMN Packageset.packagesetgroup IS 'The group this package set is affiliated with.'; | ||
98 | 2248 | COMMENT ON COLUMN Packageset.distroseries IS 'The distro series this package set belongs to.'; | ||
99 | 2249 | |||
100 | 2250 | -- PackagesetGroup | ||
101 | 2251 | |||
102 | 2252 | COMMENT ON TABLE PackagesetGroup IS 'Package set groups keep track of equivalent package sets across distro series boundaries.'; | ||
103 | 2253 | COMMENT ON COLUMN Packageset.date_created IS 'Date and time of creation.'; | ||
104 | 2254 | COMMENT ON COLUMN Packageset.owner IS 'The Person or team who owns the package | ||
105 | 2255 | set group.'; | ||
106 | 2243 | 2256 | ||
107 | 2244 | -- PackagesetSources | 2257 | -- PackagesetSources |
108 | 2245 | 2258 | ||
109 | @@ -2256,3 +2269,9 @@ | |||
110 | 2256 | COMMENT ON TABLE FlatPackagesetInclusion IS 'In order to facilitate the querying of set-subset relationships an expanded or flattened representation of the set-subset hierarchy is provided by this table.'; | 2269 | COMMENT ON TABLE FlatPackagesetInclusion IS 'In order to facilitate the querying of set-subset relationships an expanded or flattened representation of the set-subset hierarchy is provided by this table.'; |
111 | 2257 | COMMENT ON COLUMN FlatPackagesetInclusion.parent IS 'The package set that is (directly or indirectly) including a subset.'; | 2270 | COMMENT ON COLUMN FlatPackagesetInclusion.parent IS 'The package set that is (directly or indirectly) including a subset.'; |
112 | 2258 | COMMENT ON COLUMN FlatPackagesetInclusion.child IS 'The package set that is being included as a subset.'; | 2271 | COMMENT ON COLUMN FlatPackagesetInclusion.child IS 'The package set that is being included as a subset.'; |
113 | 2272 | |||
114 | 2273 | -- SourcePackageFormatSelection | ||
115 | 2274 | COMMENT ON TABLE SourcePackageFormatSelection IS 'Allowed source package formats for a given distroseries.'; | ||
116 | 2275 | COMMENT ON COLUMN SourcePackageFormatSelection.distroseries IS 'Refers to the distroseries in question.'; | ||
117 | 2276 | COMMENT ON COLUMN SourcePackageFormatSelection.format IS 'The SourcePackageFormat to allow.'; | ||
118 | 2277 | |||
119 | 2259 | 2278 | ||
120 | === modified file 'database/schema/fti.py' | |||
121 | --- database/schema/fti.py 2009-06-24 21:17:33 +0000 | |||
122 | +++ database/schema/fti.py 2009-11-03 18:13:42 +0000 | |||
123 | @@ -13,6 +13,7 @@ | |||
124 | 13 | 13 | ||
125 | 14 | import _pythonpath | 14 | import _pythonpath |
126 | 15 | 15 | ||
127 | 16 | from distutils.version import LooseVersion | ||
128 | 16 | import sys | 17 | import sys |
129 | 17 | import os.path | 18 | import os.path |
130 | 18 | from optparse import OptionParser | 19 | from optparse import OptionParser |
131 | @@ -287,9 +288,9 @@ | |||
132 | 287 | """Setup and install tsearch2 if isn't already""" | 288 | """Setup and install tsearch2 if isn't already""" |
133 | 288 | 289 | ||
134 | 289 | # tsearch2 is out-of-the-box in 8.3+ | 290 | # tsearch2 is out-of-the-box in 8.3+ |
138 | 290 | v83 = get_pgversion(con).startswith('8.3') | 291 | required = LooseVersion('8.3.0') |
139 | 291 | 292 | assert get_pgversion(con) >= required, ( | |
140 | 292 | assert v83, 'This script only supports PostgreSQL 8.3' | 293 | 'This script only supports PostgreSQL 8.3+') |
141 | 293 | 294 | ||
142 | 294 | schema_exists = bool(execute( | 295 | schema_exists = bool(execute( |
143 | 295 | con, "SELECT COUNT(*) FROM pg_namespace WHERE nspname='ts2'", | 296 | con, "SELECT COUNT(*) FROM pg_namespace WHERE nspname='ts2'", |
144 | @@ -608,18 +609,13 @@ | |||
145 | 608 | 609 | ||
146 | 609 | def get_pgversion(con): | 610 | def get_pgversion(con): |
147 | 610 | rows = execute(con, r"show server_version", results=True) | 611 | rows = execute(con, r"show server_version", results=True) |
149 | 611 | return rows[0][0] | 612 | return LooseVersion(rows[0][0]) |
150 | 612 | 613 | ||
151 | 613 | 614 | ||
152 | 614 | def get_tsearch2_sql_path(con): | 615 | def get_tsearch2_sql_path(con): |
161 | 615 | pgversion = get_pgversion(con) | 616 | major, minor = get_pgversion(con).version[:2] |
162 | 616 | if pgversion.startswith('8.2.'): | 617 | path = os.path.join( |
163 | 617 | path = os.path.join(PGSQL_BASE, '8.2', 'contrib', 'tsearch2.sql') | 618 | PGSQL_BASE, '%d.%d' % (major, minor), 'contrib', 'tsearch2.sql') |
156 | 618 | elif pgversion.startswith('8.3.'): | ||
157 | 619 | path = os.path.join(PGSQL_BASE, '8.3', 'contrib', 'tsearch2.sql') | ||
158 | 620 | else: | ||
159 | 621 | raise RuntimeError('Unknown version %s' % pgversion) | ||
160 | 622 | |||
164 | 623 | assert os.path.exists(path), '%s does not exist' % path | 619 | assert os.path.exists(path), '%s does not exist' % path |
165 | 624 | return path | 620 | return path |
166 | 625 | 621 | ||
167 | 626 | 622 | ||
168 | === modified file 'database/schema/patch-2207-00-3.sql' | |||
169 | --- database/schema/patch-2207-00-3.sql 2009-09-18 04:13:18 +0000 | |||
170 | +++ database/schema/patch-2207-00-3.sql 2009-11-03 18:13:41 +0000 | |||
171 | @@ -1,7 +1,12 @@ | |||
172 | 1 | SET client_min_messages TO ERROR; | 1 | SET client_min_messages TO ERROR; |
173 | 2 | 2 | ||
174 | 3 | UPDATE BugActivity SET person=(SELECT id FROM Person WHERE name='janitor') | 3 | UPDATE BugActivity SET person=(SELECT id FROM Person WHERE name='janitor') |
176 | 4 | WHERE person NOT IN (SELECT id FROM Person); | 4 | FROM ( |
177 | 5 | SELECT BugActivity.id | ||
178 | 6 | FROM BugActivity LEFT OUTER JOIN Person ON BugActivity.person = Person.id | ||
179 | 7 | WHERE Person.id IS NULL | ||
180 | 8 | ) AS Whatever | ||
181 | 9 | WHERE Whatever.id = BugActivity.id; | ||
182 | 5 | 10 | ||
183 | 6 | ALTER TABLE BugActivity | 11 | ALTER TABLE BugActivity |
184 | 7 | ADD CONSTRAINT bugactivity__person__fk | 12 | ADD CONSTRAINT bugactivity__person__fk |
185 | 8 | 13 | ||
186 | === added file 'database/schema/patch-2207-04-0.sql' | |||
187 | --- database/schema/patch-2207-04-0.sql 1970-01-01 00:00:00 +0000 | |||
188 | +++ database/schema/patch-2207-04-0.sql 2009-11-03 18:13:39 +0000 | |||
189 | @@ -0,0 +1,13 @@ | |||
190 | 1 | -- Copyright 2009 Canonical Ltd. This software is licensed under the | ||
191 | 2 | -- GNU Affero General Public License version 3 (see the file LICENSE). | ||
192 | 3 | |||
193 | 4 | SET client_min_messages=ERROR; | ||
194 | 5 | |||
195 | 6 | |||
196 | 7 | -- Add a column to indicate that the attendee is physically attending | ||
197 | 8 | -- the sprint. | ||
198 | 9 | ALTER TABLE SprintAttendance | ||
199 | 10 | ADD COLUMN is_physical BOOLEAN NOT NULL DEFAULT FALSE; | ||
200 | 11 | |||
201 | 12 | |||
202 | 13 | INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 04, 0); | ||
203 | 0 | 14 | ||
204 | === added file 'database/schema/patch-2207-05-0.sql' | |||
205 | --- database/schema/patch-2207-05-0.sql 1970-01-01 00:00:00 +0000 | |||
206 | +++ database/schema/patch-2207-05-0.sql 2009-11-03 18:13:40 +0000 | |||
207 | @@ -0,0 +1,12 @@ | |||
208 | 1 | -- Copyright 2009 Canonical Ltd. This software is licensed under the | ||
209 | 2 | -- GNU Affero General Public License version 3 (see the file LICENSE). | ||
210 | 3 | |||
211 | 4 | SET client_min_messages=ERROR; | ||
212 | 5 | |||
213 | 6 | |||
214 | 7 | -- Add a column for external archive dependencies. | ||
215 | 8 | ALTER TABLE Archive | ||
216 | 9 | ADD COLUMN external_dependencies text DEFAULT NULL; | ||
217 | 10 | |||
218 | 11 | |||
219 | 12 | INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 05, 0); | ||
220 | 0 | 13 | ||
221 | === added file 'database/schema/patch-2207-06-0.sql' | |||
222 | --- database/schema/patch-2207-06-0.sql 1970-01-01 00:00:00 +0000 | |||
223 | +++ database/schema/patch-2207-06-0.sql 2009-11-03 18:13:43 +0000 | |||
224 | @@ -0,0 +1,122 @@ | |||
225 | 1 | -- Copyright 2009 Canonical Ltd. This software is licensed under the | ||
226 | 2 | -- GNU Affero General Public License version 3 (see the file LICENSE). | ||
227 | 3 | |||
228 | 4 | SET client_min_messages=ERROR; | ||
229 | 5 | |||
230 | 6 | -- ** PART 1 ** Create the 'packagesetgroup' table and the | ||
231 | 7 | -- 'packageset.packagesetgroup' foreign key, | ||
232 | 8 | -- populate the 'packagesetgroup' table | ||
233 | 9 | |||
234 | 10 | -- This table keeps track of package sets that are equivalent across | ||
235 | 11 | -- distro series boundaries. | ||
236 | 12 | CREATE SEQUENCE packagesetgroup_id_seq | ||
237 | 13 | START WITH 1 | ||
238 | 14 | INCREMENT BY 1 | ||
239 | 15 | NO MAXVALUE | ||
240 | 16 | NO MINVALUE | ||
241 | 17 | CACHE 1; | ||
242 | 18 | CREATE TABLE packagesetgroup ( | ||
243 | 19 | id integer NOT NULL DEFAULT nextval('packagesetgroup_id_seq'), | ||
244 | 20 | date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL, | ||
245 | 21 | owner integer NOT NULL, | ||
246 | 22 | -- Please note: the 'name' column is only here to ease the data migration | ||
247 | 23 | -- and will be dropped at the end of this patch. | ||
248 | 24 | name text NOT NULL | ||
249 | 25 | ); | ||
250 | 26 | ALTER SEQUENCE packagesetgroup_id_seq OWNED BY packagesetgroup.id; | ||
251 | 27 | ALTER TABLE ONLY packagesetgroup | ||
252 | 28 | ADD CONSTRAINT packagesetgroup_pkey PRIMARY KEY (id); | ||
253 | 29 | ALTER TABLE ONLY packagesetgroup | ||
254 | 30 | ADD CONSTRAINT packagesetgroup__owner__fk | ||
255 | 31 | FOREIGN KEY (owner) REFERENCES person(id); | ||
256 | 32 | |||
257 | 33 | -- Package sets and their clones belong to the same package set group. | ||
258 | 34 | ALTER TABLE ONLY packageset ADD COLUMN packagesetgroup integer; | ||
259 | 35 | ALTER TABLE ONLY packageset | ||
260 | 36 | ADD CONSTRAINT packageset__packagesetgroup__fk | ||
261 | 37 | FOREIGN KEY (packagesetgroup) REFERENCES packagesetgroup(id); | ||
262 | 38 | |||
263 | 39 | -- Create a group for each of the original (karmic koala) package sets. | ||
264 | 40 | INSERT INTO packagesetgroup(owner, name) | ||
265 | 41 | SELECT packageset.owner, packageset.name | ||
266 | 42 | FROM packageset WHERE NOT packageset.name LIKE('lucid-%'); | ||
267 | 43 | |||
268 | 44 | |||
269 | 45 | -- ** PART 2 ** Associate the karmic koala package sets and their lucid lynx | ||
270 | 46 | -- clones with the appropriate package set groups | ||
271 | 47 | |||
272 | 48 | -- Update the karmic koala package sets so they reference their groups. | ||
273 | 49 | UPDATE packageset SET packagesetgroup = packagesetgroup.id | ||
274 | 50 | FROM packagesetgroup WHERE packageset.name = packagesetgroup.name; | ||
275 | 51 | |||
276 | 52 | -- Update the lucid lynx package set *clones* so they reference their groups | ||
277 | 53 | -- as well. | ||
278 | 54 | UPDATE packageset SET packagesetgroup = packagesetgroup.id | ||
279 | 55 | FROM packagesetgroup WHERE packageset.name = 'lucid-' || packagesetgroup.name; | ||
280 | 56 | |||
281 | 57 | -- ** PART 3 ** Add the 'packageset.distroseries' foreign key and | ||
282 | 58 | -- initialise it for the existing package sets. | ||
283 | 59 | |||
284 | 60 | -- A package set lives in a distro series context. | ||
285 | 61 | ALTER TABLE ONLY packageset ADD COLUMN distroseries integer; | ||
286 | 62 | |||
287 | 63 | -- Define the foreign key constraint. | ||
288 | 64 | ALTER TABLE ONLY packageset | ||
289 | 65 | ADD CONSTRAINT packageset__distroseries__fk | ||
290 | 66 | FOREIGN KEY (distroseries) REFERENCES distroseries(id); | ||
291 | 67 | |||
292 | 68 | -- First migrate the original package sets created for the karmic koala. | ||
293 | 69 | UPDATE packageset SET distroseries = distroseries.id FROM distroseries | ||
294 | 70 | WHERE distroseries.name = 'karmic' AND NOT packageset.name LIKE('lucid-%'); | ||
295 | 71 | |||
296 | 72 | -- Migrate the lucid lynx package sets next. | ||
297 | 73 | UPDATE packageset SET distroseries = distroseries.id FROM distroseries | ||
298 | 74 | WHERE distroseries.name = 'lucid' AND packageset.name LIKE('lucid-%'); | ||
299 | 75 | |||
300 | 76 | -- Make the 'distroseries' foreign key mandatory. | ||
301 | 77 | ALTER TABLE ONLY packageset ALTER COLUMN distroseries SET NOT NULL; | ||
302 | 78 | |||
303 | 79 | -- The package set name is now only unique in conjunction with a distro series. | ||
304 | 80 | ALTER TABLE ONLY packageset | ||
305 | 81 | DROP CONSTRAINT packageset_name_key; | ||
306 | 82 | ALTER TABLE ONLY packageset | ||
307 | 83 | ADD CONSTRAINT packageset__name__distroseries__key UNIQUE (name, distroseries); | ||
308 | 84 | |||
309 | 85 | -- ** PART 4 ** Strip off the 'lucid-' prefix of the lucid lynx | ||
310 | 86 | -- package set names | ||
311 | 87 | UPDATE packageset SET name = substring(name FROM length('lucid-')+1) | ||
312 | 88 | WHERE name LIKE('lucid-%'); | ||
313 | 89 | |||
314 | 90 | -- ** PART 5 ** Create package set groups for package sets that were added in | ||
315 | 91 | -- lucid lynx but do not exist in the karmic koala, | ||
316 | 92 | -- associate these package sets with their newly created groups | ||
317 | 93 | INSERT INTO packagesetgroup(owner, name) | ||
318 | 94 | SELECT packageset.owner, packageset.name | ||
319 | 95 | FROM packageset, distroseries WHERE | ||
320 | 96 | packageset.packagesetgroup IS NULL | ||
321 | 97 | AND packageset.distroseries = distroseries.id | ||
322 | 98 | AND distroseries.name = 'lucid'; | ||
323 | 99 | |||
324 | 100 | UPDATE packageset SET packagesetgroup = packagesetgroup.id | ||
325 | 101 | FROM packagesetgroup, distroseries | ||
326 | 102 | WHERE | ||
327 | 103 | packageset.packagesetgroup IS NULL | ||
328 | 104 | AND packageset.distroseries = distroseries.id | ||
329 | 105 | AND distroseries.name = 'lucid' | ||
330 | 106 | AND packageset.name = packagesetgroup.name; | ||
331 | 107 | |||
332 | 108 | -- ** PART 6 ** Make the 'packageset.packagesetgroup' foreign key mandatory | ||
333 | 109 | ALTER TABLE ONLY packageset ALTER COLUMN packagesetgroup SET NOT NULL; | ||
334 | 110 | |||
335 | 111 | -- ** PART 7 ** Drop the 'packagesetgroup.name' column that was only added | ||
336 | 112 | -- for data migration purposes. | ||
337 | 113 | ALTER TABLE ONLY packagesetgroup DROP COLUMN name; | ||
338 | 114 | |||
339 | 115 | -- Define indices on the newly added foreign keys. | ||
340 | 116 | CREATE INDEX packageset__packagesetgroup__idx | ||
341 | 117 | ON packageset(packagesetgroup); | ||
342 | 118 | CREATE INDEX packageset__distroseries__idx | ||
343 | 119 | ON packageset(distroseries); | ||
344 | 120 | CREATE INDEX packagesetgroup__owner__idx ON PackageSetGroup(owner); | ||
345 | 121 | |||
346 | 122 | INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 06, 0); | ||
347 | 0 | 123 | ||
348 | === added file 'database/schema/patch-2207-08-0.sql' | |||
349 | --- database/schema/patch-2207-08-0.sql 1970-01-01 00:00:00 +0000 | |||
350 | +++ database/schema/patch-2207-08-0.sql 2009-11-03 18:13:40 +0000 | |||
351 | @@ -0,0 +1,20 @@ | |||
352 | 1 | -- Copyright 2009 Canonical Ltd. This software is licensed under the | ||
353 | 2 | -- GNU Affero General Public License version 3 (see the file LICENSE). | ||
354 | 3 | |||
355 | 4 | SET client_min_messages=ERROR; | ||
356 | 5 | |||
357 | 6 | CREATE TABLE sourcepackageformatselection ( | ||
358 | 7 | id serial PRIMARY KEY, | ||
359 | 8 | distroseries integer NOT NULL | ||
360 | 9 | CONSTRAINT sourceformatselection__distroseries__fk | ||
361 | 10 | REFERENCES distroseries, | ||
362 | 11 | format integer NOT NULL, | ||
363 | 12 | CONSTRAINT sourceformatselection__distroseries__format__key | ||
364 | 13 | UNIQUE (distroseries, format) | ||
365 | 14 | ); | ||
366 | 15 | |||
367 | 16 | -- Allow all series to accept format 1.0 by default. | ||
368 | 17 | INSERT INTO sourcepackageformatselection (distroseries, format) | ||
369 | 18 | SELECT id, 0 AS format FROM distroseries; | ||
370 | 19 | |||
371 | 20 | INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 08, 0); | ||
372 | 0 | 21 | ||
373 | === modified file 'database/schema/security.cfg' | |||
374 | --- database/schema/security.cfg 2009-10-31 01:41:29 +0000 | |||
375 | +++ database/schema/security.cfg 2009-11-03 18:13:41 +0000 | |||
376 | @@ -227,6 +227,7 @@ | |||
377 | 227 | public.packagediff = SELECT, INSERT, UPDATE, DELETE | 227 | public.packagediff = SELECT, INSERT, UPDATE, DELETE |
378 | 228 | public.packagediff = SELECT, INSERT, UPDATE, DELETE | 228 | public.packagediff = SELECT, INSERT, UPDATE, DELETE |
379 | 229 | public.packageset = SELECT, INSERT, UPDATE, DELETE | 229 | public.packageset = SELECT, INSERT, UPDATE, DELETE |
380 | 230 | public.packagesetgroup = SELECT, INSERT, UPDATE, DELETE | ||
381 | 230 | public.packagesetsources = SELECT, INSERT, UPDATE, DELETE | 231 | public.packagesetsources = SELECT, INSERT, UPDATE, DELETE |
382 | 231 | public.packagesetinclusion = SELECT, INSERT, UPDATE, DELETE | 232 | public.packagesetinclusion = SELECT, INSERT, UPDATE, DELETE |
383 | 232 | public.flatpackagesetinclusion = SELECT, INSERT, UPDATE, DELETE | 233 | public.flatpackagesetinclusion = SELECT, INSERT, UPDATE, DELETE |
384 | @@ -649,6 +650,7 @@ | |||
385 | 649 | public.messagechunk = SELECT, INSERT | 650 | public.messagechunk = SELECT, INSERT |
386 | 650 | # Merge notifications | 651 | # Merge notifications |
387 | 651 | public.codereviewvote = SELECT | 652 | public.codereviewvote = SELECT |
388 | 653 | public.codereviewmessage = SELECT | ||
389 | 652 | 654 | ||
390 | 653 | [branch-distro] | 655 | [branch-distro] |
391 | 654 | type=user | 656 | type=user |
392 | @@ -785,6 +787,7 @@ | |||
393 | 785 | public.packagecopyrequest = SELECT, INSERT, UPDATE | 787 | public.packagecopyrequest = SELECT, INSERT, UPDATE |
394 | 786 | public.packagediff = SELECT, INSERT, UPDATE | 788 | public.packagediff = SELECT, INSERT, UPDATE |
395 | 787 | public.packageset = SELECT | 789 | public.packageset = SELECT |
396 | 790 | public.packagesetgroup = SELECT | ||
397 | 788 | public.packagesetsources = SELECT, INSERT, UPDATE, DELETE | 791 | public.packagesetsources = SELECT, INSERT, UPDATE, DELETE |
398 | 789 | public.packagesetinclusion = SELECT, INSERT, UPDATE, DELETE | 792 | public.packagesetinclusion = SELECT, INSERT, UPDATE, DELETE |
399 | 790 | public.flatpackagesetinclusion = SELECT, INSERT, UPDATE, DELETE | 793 | public.flatpackagesetinclusion = SELECT, INSERT, UPDATE, DELETE |
400 | @@ -862,6 +865,7 @@ | |||
401 | 862 | public.teammembership = SELECT | 865 | public.teammembership = SELECT |
402 | 863 | public.gpgkey = SELECT | 866 | public.gpgkey = SELECT |
403 | 864 | public.packageset = SELECT | 867 | public.packageset = SELECT |
404 | 868 | public.packagesetgroup = SELECT | ||
405 | 865 | public.packagesetsources = SELECT | 869 | public.packagesetsources = SELECT |
406 | 866 | public.packagesetinclusion = SELECT | 870 | public.packagesetinclusion = SELECT |
407 | 867 | public.flatpackagesetinclusion = SELECT | 871 | public.flatpackagesetinclusion = SELECT |
408 | @@ -917,7 +921,7 @@ | |||
409 | 917 | public.bugpackageinfestation = SELECT, INSERT, UPDATE | 921 | public.bugpackageinfestation = SELECT, INSERT, UPDATE |
410 | 918 | public.bugproductinfestation = SELECT, INSERT, UPDATE | 922 | public.bugproductinfestation = SELECT, INSERT, UPDATE |
411 | 919 | public.bugsubscription = SELECT, INSERT, UPDATE, DELETE | 923 | public.bugsubscription = SELECT, INSERT, UPDATE, DELETE |
413 | 920 | public.bugtask = SELECT, INSERT, UPDATE | 924 | public.bugtask = SELECT, INSERT, UPDATE, DELETE |
414 | 921 | public.bugtracker = SELECT, INSERT, UPDATE, DELETE | 925 | public.bugtracker = SELECT, INSERT, UPDATE, DELETE |
415 | 922 | public.bugtrackeralias = SELECT, INSERT, UPDATE, DELETE | 926 | public.bugtrackeralias = SELECT, INSERT, UPDATE, DELETE |
416 | 923 | public.bugwatch = SELECT, INSERT, UPDATE, DELETE | 927 | public.bugwatch = SELECT, INSERT, UPDATE, DELETE |
417 | @@ -1062,6 +1066,7 @@ | |||
418 | 1062 | public.archive = SELECT, INSERT, UPDATE | 1066 | public.archive = SELECT, INSERT, UPDATE |
419 | 1063 | public.archivearch = SELECT, INSERT, UPDATE | 1067 | public.archivearch = SELECT, INSERT, UPDATE |
420 | 1064 | public.packageset = SELECT | 1068 | public.packageset = SELECT |
421 | 1069 | public.packagesetgroup = SELECT | ||
422 | 1065 | public.packagesetsources = SELECT | 1070 | public.packagesetsources = SELECT |
423 | 1066 | public.packagesetinclusion = SELECT | 1071 | public.packagesetinclusion = SELECT |
424 | 1067 | public.flatpackagesetinclusion = SELECT | 1072 | public.flatpackagesetinclusion = SELECT |
425 | @@ -1250,6 +1255,7 @@ | |||
426 | 1250 | public.personlanguage = SELECT | 1255 | public.personlanguage = SELECT |
427 | 1251 | public.structuralsubscription = SELECT | 1256 | public.structuralsubscription = SELECT |
428 | 1252 | public.packageset = SELECT | 1257 | public.packageset = SELECT |
429 | 1258 | public.packagesetgroup = SELECT | ||
430 | 1253 | public.packagesetsources = SELECT | 1259 | public.packagesetsources = SELECT |
431 | 1254 | public.packagesetinclusion = SELECT | 1260 | public.packagesetinclusion = SELECT |
432 | 1255 | public.flatpackagesetinclusion = SELECT | 1261 | public.flatpackagesetinclusion = SELECT |
433 | @@ -1702,6 +1708,7 @@ | |||
434 | 1702 | public.productseries = SELECT | 1708 | public.productseries = SELECT |
435 | 1703 | public.revision = SELECT | 1709 | public.revision = SELECT |
436 | 1704 | public.revisionauthor = SELECT, INSERT | 1710 | public.revisionauthor = SELECT, INSERT |
437 | 1711 | public.seriessourcepackagebranch = SELECT | ||
438 | 1705 | public.sourcepackagename = SELECT | 1712 | public.sourcepackagename = SELECT |
439 | 1706 | public.staticdiff = SELECT, INSERT | 1713 | public.staticdiff = SELECT, INSERT |
440 | 1707 | public.teammembership = SELECT | 1714 | public.teammembership = SELECT |
441 | @@ -1807,6 +1814,7 @@ | |||
442 | 1807 | type=user | 1814 | type=user |
443 | 1808 | public.libraryfilecontent = SELECT | 1815 | public.libraryfilecontent = SELECT |
444 | 1809 | public.openidrpconfig = SELECT | 1816 | public.openidrpconfig = SELECT |
445 | 1817 | public.branch = SELECT | ||
446 | 1810 | 1818 | ||
447 | 1811 | [modified-branches] | 1819 | [modified-branches] |
448 | 1812 | type=user | 1820 | type=user |
449 | 1813 | 1821 | ||
450 | === modified file 'database/schema/trusted.sql' | |||
451 | --- database/schema/trusted.sql 2009-08-19 15:35:13 +0000 | |||
452 | +++ database/schema/trusted.sql 2009-11-03 18:13:42 +0000 | |||
453 | @@ -1029,7 +1029,22 @@ | |||
454 | 1029 | DECLARE | 1029 | DECLARE |
455 | 1030 | parent_name text; | 1030 | parent_name text; |
456 | 1031 | child_name text; | 1031 | child_name text; |
457 | 1032 | parent_distroseries text; | ||
458 | 1033 | child_distroseries text; | ||
459 | 1032 | BEGIN | 1034 | BEGIN |
460 | 1035 | -- Make sure that the package sets being associated here belong | ||
461 | 1036 | -- to the same distro series. | ||
462 | 1037 | IF (SELECT parent.distroseries != child.distroseries | ||
463 | 1038 | FROM packageset parent, packageset child | ||
464 | 1039 | WHERE parent.id = NEW.parent AND child.id = NEW.child) | ||
465 | 1040 | THEN | ||
466 | 1041 | SELECT name INTO parent_name FROM packageset WHERE id = NEW.parent; | ||
467 | 1042 | SELECT name INTO child_name FROM packageset WHERE id = NEW.child; | ||
468 | 1043 | SELECT ds.name INTO parent_distroseries FROM packageset ps, distroseries ds WHERE ps.id = NEW.parent AND ps.distroseries = ds.id; | ||
469 | 1044 | SELECT ds.name INTO child_distroseries FROM packageset ps, distroseries ds WHERE ps.id = NEW.child AND ps.distroseries = ds.id; | ||
470 | 1045 | RAISE EXCEPTION 'Package sets % and % belong to different distro series (to % and % respectively) and thus cannot be associated.', child_name, parent_name, child_distroseries, parent_distroseries; | ||
471 | 1046 | END IF; | ||
472 | 1047 | |||
473 | 1033 | IF EXISTS( | 1048 | IF EXISTS( |
474 | 1034 | SELECT * FROM flatpackagesetinclusion | 1049 | SELECT * FROM flatpackagesetinclusion |
475 | 1035 | WHERE parent = NEW.child AND child = NEW.parent LIMIT 1) | 1050 | WHERE parent = NEW.child AND child = NEW.parent LIMIT 1) |
476 | 1036 | 1051 | ||
477 | === modified file 'database/schema/unautovacuumable.py' | |||
478 | --- database/schema/unautovacuumable.py 2009-06-24 21:17:33 +0000 | |||
479 | +++ database/schema/unautovacuumable.py 2009-11-03 18:13:43 +0000 | |||
480 | @@ -19,6 +19,7 @@ | |||
481 | 19 | # pylint: disable-msg=W0403 | 19 | # pylint: disable-msg=W0403 |
482 | 20 | import _pythonpath | 20 | import _pythonpath |
483 | 21 | 21 | ||
484 | 22 | from distutils.version import LooseVersion | ||
485 | 22 | from optparse import OptionParser | 23 | from optparse import OptionParser |
486 | 23 | import sys | 24 | import sys |
487 | 24 | import time | 25 | import time |
488 | @@ -44,14 +45,31 @@ | |||
489 | 44 | con.set_isolation_level(0) # Autocommit | 45 | con.set_isolation_level(0) # Autocommit |
490 | 45 | cur = con.cursor() | 46 | cur = con.cursor() |
491 | 46 | 47 | ||
492 | 48 | cur.execute('show server_version') | ||
493 | 49 | pg_version = LooseVersion(cur.fetchone()[0]) | ||
494 | 50 | |||
495 | 47 | log.debug("Disabling autovacuum on all tables in the database.") | 51 | log.debug("Disabling autovacuum on all tables in the database.") |
503 | 48 | cur.execute(""" | 52 | if pg_version < LooseVersion('8.4.0'): |
504 | 49 | INSERT INTO pg_autovacuum | 53 | cur.execute(""" |
505 | 50 | SELECT pg_class.oid, FALSE, -1,-1,-1,-1,-1,-1,-1,-1 | 54 | INSERT INTO pg_autovacuum |
506 | 51 | FROM pg_class | 55 | SELECT pg_class.oid, FALSE, -1,-1,-1,-1,-1,-1,-1,-1 |
507 | 52 | WHERE relkind in ('r','t') | 56 | FROM pg_class |
508 | 53 | AND pg_class.oid NOT IN (SELECT vacrelid FROM pg_autovacuum) | 57 | WHERE relkind in ('r','t') |
509 | 54 | """) | 58 | AND pg_class.oid NOT IN (SELECT vacrelid FROM pg_autovacuum) |
510 | 59 | """) | ||
511 | 60 | else: | ||
512 | 61 | cur.execute(""" | ||
513 | 62 | SELECT nspname,relname | ||
514 | 63 | FROM pg_namespace, pg_class | ||
515 | 64 | WHERE relnamespace = pg_namespace.oid | ||
516 | 65 | AND relkind = 'r' AND nspname <> 'pg_catalog' | ||
517 | 66 | """) | ||
518 | 67 | for namespace, table in list(cur.fetchall()): | ||
519 | 68 | cur.execute(""" | ||
520 | 69 | ALTER TABLE ONLY "%s"."%s" SET ( | ||
521 | 70 | autovacuum_enabled=false, | ||
522 | 71 | toast.autovacuum_enabled=false) | ||
523 | 72 | """ % (namespace, table)) | ||
524 | 55 | 73 | ||
525 | 56 | log.debug("Killing existing autovacuum processes") | 74 | log.debug("Killing existing autovacuum processes") |
526 | 57 | num_autovacuums = -1 | 75 | num_autovacuums = -1 |
527 | 58 | 76 | ||
528 | === modified file 'lib/canonical/config/schema-lazr.conf' | |||
529 | --- lib/canonical/config/schema-lazr.conf 2009-10-29 05:50:08 +0000 | |||
530 | +++ lib/canonical/config/schema-lazr.conf 2009-11-03 18:13:40 +0000 | |||
531 | @@ -1436,13 +1436,6 @@ | |||
532 | 1436 | 1436 | ||
533 | 1437 | 1437 | ||
534 | 1438 | [ppa.master] | 1438 | [ppa.master] |
535 | 1439 | # Line-separated repository lines to be used as build dependencies, in | ||
536 | 1440 | # the following format: | ||
537 | 1441 | # deb [user:pass@]<host>[/path] %(series)s[-pocket] [components] | ||
538 | 1442 | # 'series' variable is replaced with the series name of the context build. | ||
539 | 1443 | # datatype: string | ||
540 | 1444 | dependencies: none | ||
541 | 1445 | |||
542 | 1446 | 1439 | ||
543 | 1447 | [poimport] | 1440 | [poimport] |
544 | 1448 | # The database user which will be used by this process. | 1441 | # The database user which will be used by this process. |
545 | 1449 | 1442 | ||
546 | === modified file 'lib/canonical/ftests/pgsql.py' | |||
547 | --- lib/canonical/ftests/pgsql.py 2009-06-25 05:30:52 +0000 | |||
548 | +++ lib/canonical/ftests/pgsql.py 2009-11-03 18:13:40 +0000 | |||
549 | @@ -144,6 +144,13 @@ | |||
550 | 144 | host = None | 144 | host = None |
551 | 145 | port = None | 145 | port = None |
552 | 146 | 146 | ||
553 | 147 | # Class attributes. With PostgreSQL 8.4, pg_shdepend bloats | ||
554 | 148 | # hugely when we drop and create databases, because this | ||
555 | 149 | # operation cancels any autovacuum process maintaining it. | ||
556 | 150 | # To cope, we need to manually vacuum it ourselves occasionally. | ||
557 | 151 | vacuum_shdepend_every = 10 | ||
558 | 152 | _vacuum_shdepend_counter = 0 | ||
559 | 153 | |||
560 | 147 | # (template, name) of last test. Class attribute. | 154 | # (template, name) of last test. Class attribute. |
561 | 148 | _last_db = (None, None) | 155 | _last_db = (None, None) |
562 | 149 | # Class attribute. True if we should destroy the DB because changes made. | 156 | # Class attribute. True if we should destroy the DB because changes made. |
563 | @@ -308,6 +315,10 @@ | |||
564 | 308 | if 'does not exist' in str(x): | 315 | if 'does not exist' in str(x): |
565 | 309 | break | 316 | break |
566 | 310 | raise | 317 | raise |
567 | 318 | PgTestSetup._vacuum_shdepend_counter += 1 | ||
568 | 319 | if (PgTestSetup._vacuum_shdepend_counter | ||
569 | 320 | % PgTestSetup.vacuum_shdepend_every) == 0: | ||
570 | 321 | cur.execute('VACUUM pg_catalog.pg_shdepend') | ||
571 | 311 | finally: | 322 | finally: |
572 | 312 | con.close() | 323 | con.close() |
573 | 313 | 324 | ||
574 | 314 | 325 | ||
575 | === modified file 'lib/canonical/launchpad/emailtemplates/branch-merge-proposal-created.txt' | |||
576 | --- lib/canonical/launchpad/emailtemplates/branch-merge-proposal-created.txt 2009-08-05 19:27:17 +0000 | |||
577 | +++ lib/canonical/launchpad/emailtemplates/branch-merge-proposal-created.txt 2009-11-03 18:13:39 +0000 | |||
578 | @@ -1,4 +1,4 @@ | |||
580 | 1 | %(proposal_registrant)s has proposed merging %(source_branch)s into %(target_branch)s. | 1 | %(proposal_registrant)s has proposed merging %(source_branch)s into %(target_branch)s%(prerequisite)s. |
581 | 2 | 2 | ||
582 | 3 | %(reviews)s%(related_bugs)s%(gap)s%(comment)s%(diff_cutoff_warning)s | 3 | %(reviews)s%(related_bugs)s%(gap)s%(comment)s%(diff_cutoff_warning)s |
583 | 4 | -- | 4 | -- |
584 | 5 | 5 | ||
585 | === modified file 'lib/canonical/launchpad/icing/style-3-0.css' | |||
586 | --- lib/canonical/launchpad/icing/style-3-0.css 2009-10-29 21:39:12 +0000 | |||
587 | +++ lib/canonical/launchpad/icing/style-3-0.css 2009-11-03 18:13:42 +0000 | |||
588 | @@ -466,6 +466,9 @@ | |||
589 | 466 | padding: 0 1.5em 0 0; | 466 | padding: 0 1.5em 0 0; |
590 | 467 | } | 467 | } |
591 | 468 | .subordinate { | 468 | .subordinate { |
592 | 469 | margin-left: 2em; | ||
593 | 470 | } | ||
594 | 471 | ol.subordinate { | ||
595 | 469 | margin-left: 4em; | 472 | margin-left: 4em; |
596 | 470 | } | 473 | } |
597 | 471 | .two-column-list li, | 474 | .two-column-list li, |
598 | 472 | 475 | ||
599 | === modified file 'lib/canonical/launchpad/interfaces/_schema_circular_imports.py' | |||
600 | --- lib/canonical/launchpad/interfaces/_schema_circular_imports.py 2009-10-29 19:55:59 +0000 | |||
601 | +++ lib/canonical/launchpad/interfaces/_schema_circular_imports.py 2009-11-03 18:13:43 +0000 | |||
602 | @@ -234,6 +234,14 @@ | |||
603 | 234 | IArchive, 'getAllPublishedBinaries', 'status', PackagePublishingStatus) | 234 | IArchive, 'getAllPublishedBinaries', 'status', PackagePublishingStatus) |
604 | 235 | patch_choice_parameter_type( | 235 | patch_choice_parameter_type( |
605 | 236 | IArchive, 'getAllPublishedBinaries', 'pocket', PackagePublishingPocket) | 236 | IArchive, 'getAllPublishedBinaries', 'pocket', PackagePublishingPocket) |
606 | 237 | patch_plain_parameter_type( | ||
607 | 238 | IArchive, 'isSourceUploadAllowed', 'distroseries', IDistroSeries) | ||
608 | 239 | patch_plain_parameter_type( | ||
609 | 240 | IArchive, 'newPackagesetUploader', 'packageset', IPackageset) | ||
610 | 241 | patch_plain_parameter_type( | ||
611 | 242 | IArchive, 'getUploadersForPackageset', 'packageset', IPackageset) | ||
612 | 243 | patch_plain_parameter_type( | ||
613 | 244 | IArchive, 'deletePackagesetUploader', 'packageset', IPackageset) | ||
614 | 237 | 245 | ||
615 | 238 | # IDistribution | 246 | # IDistribution |
616 | 239 | IDistribution['serieses'].value_type.schema = IDistroSeries | 247 | IDistribution['serieses'].value_type.schema = IDistroSeries |
617 | @@ -283,6 +291,8 @@ | |||
618 | 283 | IPackageset, 'getSourcesSharedBy', 'other_package_set', IPackageset) | 291 | IPackageset, 'getSourcesSharedBy', 'other_package_set', IPackageset) |
619 | 284 | patch_plain_parameter_type( | 292 | patch_plain_parameter_type( |
620 | 285 | IPackageset, 'getSourcesNotSharedBy', 'other_package_set', IPackageset) | 293 | IPackageset, 'getSourcesNotSharedBy', 'other_package_set', IPackageset) |
621 | 294 | patch_collection_return_type( | ||
622 | 295 | IPackageset, 'relatedSets', IPackageset) | ||
623 | 286 | 296 | ||
624 | 287 | # IPackageUpload | 297 | # IPackageUpload |
625 | 288 | IPackageUpload['pocket'].vocabulary = PackagePublishingPocket | 298 | IPackageUpload['pocket'].vocabulary = PackagePublishingPocket |
626 | 289 | 299 | ||
627 | === modified file 'lib/canonical/launchpad/templates/launchpad-login.pt' | |||
628 | --- lib/canonical/launchpad/templates/launchpad-login.pt 2009-10-16 16:13:00 +0000 | |||
629 | +++ lib/canonical/launchpad/templates/launchpad-login.pt 2009-11-03 18:13:39 +0000 | |||
630 | @@ -171,13 +171,13 @@ | |||
631 | 171 | <p> | 171 | <p> |
632 | 172 | Creating your Launchpad account is easy. Here's what to do:</p> | 172 | Creating your Launchpad account is easy. Here's what to do:</p> |
633 | 173 | 173 | ||
641 | 174 | <ol class="subordinate"> | 174 | <ol class="subordinate"> |
642 | 175 | <li>Make sure cookies are enabled in your browser.</li> | 175 | <li>Make sure cookies are enabled in your browser.</li> |
643 | 176 | <li>Enter your e-mail address and answer our random question | 176 | <li>Enter your e-mail address and answer our random question |
644 | 177 | so we know that you're human. | 177 | so we know that you're human. |
645 | 178 | </li> | 178 | </li> |
646 | 179 | <li>Follow the URL in the confirmation e-mail that Launchpad sends and you're done!</li> | 179 | <li>Follow the URL in the confirmation e-mail that Launchpad sends and you're done!</li> |
647 | 180 | </ol> | 180 | </ol> |
648 | 181 | 181 | ||
649 | 182 | 182 | ||
650 | 183 | 183 | ||
651 | 184 | 184 | ||
652 | === modified file 'lib/lp/bugs/doc/externalbugtracker-debbugs.txt' | |||
653 | --- lib/lp/bugs/doc/externalbugtracker-debbugs.txt 2009-10-06 07:38:29 +0000 | |||
654 | +++ lib/lp/bugs/doc/externalbugtracker-debbugs.txt 2009-11-03 18:13:40 +0000 | |||
655 | @@ -102,7 +102,7 @@ | |||
656 | 102 | >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater | 102 | >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
657 | 103 | >>> bug_watch_updater = BugWatchUpdater(txn) | 103 | >>> bug_watch_updater = BugWatchUpdater(txn) |
658 | 104 | >>> external_debbugs.sync_comments = False | 104 | >>> external_debbugs.sync_comments = False |
660 | 105 | >>> bug_watch_ids = [bug_watch.id for bug_watch in bug_watches] | 105 | >>> bug_watch_ids = sorted([bug_watch.id for bug_watch in bug_watches]) |
661 | 106 | >>> bug_watch_updater.updateBugWatches(external_debbugs, bug_watches) | 106 | >>> bug_watch_updater.updateBugWatches(external_debbugs, bug_watches) |
662 | 107 | INFO:...:Updating 5 watches for 5 bugs on http://... | 107 | INFO:...:Updating 5 watches for 5 bugs on http://... |
663 | 108 | 108 | ||
664 | @@ -110,10 +110,10 @@ | |||
665 | 110 | >>> for bug_watch_id in bug_watch_ids: | 110 | >>> for bug_watch_id in bug_watch_ids: |
666 | 111 | ... bug_watch = getUtility(IBugWatchSet).get(bug_watch_id) | 111 | ... bug_watch = getUtility(IBugWatchSet).get(bug_watch_id) |
667 | 112 | ... print "%s: %s" % (bug_watch.remotebug, bug_watch.remotestatus) | 112 | ... print "%s: %s" % (bug_watch.remotebug, bug_watch.remotestatus) |
668 | 113 | 280883: done grave woody security | ||
669 | 113 | 304014: open important | 114 | 304014: open important |
670 | 114 | 327452: done critical patch security | 115 | 327452: done critical patch security |
671 | 115 | 327549: open important security | 116 | 327549: open important security |
672 | 116 | 280883: done grave woody security | ||
673 | 117 | 308994: open important | 117 | 308994: open important |
674 | 118 | 118 | ||
675 | 119 | The lastchecked attribute got updated for each bug watch, so no more | 119 | The lastchecked attribute got updated for each bug watch, so no more |
676 | 120 | 120 | ||
677 | === modified file 'lib/lp/code/browser/branch.py' | |||
678 | --- lib/lp/code/browser/branch.py 2009-10-11 02:33:30 +0000 | |||
679 | +++ lib/lp/code/browser/branch.py 2009-11-03 18:13:40 +0000 | |||
680 | @@ -575,7 +575,8 @@ | |||
681 | 575 | BranchLifecycleStatus, | 575 | BranchLifecycleStatus, |
682 | 576 | css_class_prefix='branchstatus'), | 576 | css_class_prefix='branchstatus'), |
683 | 577 | 'status_value': self.context.lifecycle_status.title, | 577 | 'status_value': self.context.lifecycle_status.title, |
685 | 578 | 'user_can_edit_status': check_permission('launchpad.Edit', self.context), | 578 | 'user_can_edit_status': check_permission( |
686 | 579 | 'launchpad.Edit', self.context), | ||
687 | 579 | 'branch_path': '/' + self.context.unique_name, | 580 | 'branch_path': '/' + self.context.unique_name, |
688 | 580 | }) | 581 | }) |
689 | 581 | 582 | ||
690 | @@ -1153,6 +1154,13 @@ | |||
691 | 1153 | description=_( | 1154 | description=_( |
692 | 1154 | "The branch that the source branch will be merged into.")) | 1155 | "The branch that the source branch will be merged into.")) |
693 | 1155 | 1156 | ||
694 | 1157 | prerequisite_branch = Choice( | ||
695 | 1158 | title=_('Prerequisite Branch'), | ||
696 | 1159 | vocabulary='Branch', required=False, readonly=False, | ||
697 | 1160 | description=_( | ||
698 | 1161 | 'A branch that should be merged before this one. (Its changes' | ||
699 | 1162 | ' will not be shown in the diff.)')) | ||
700 | 1163 | |||
701 | 1156 | comment = Text( | 1164 | comment = Text( |
702 | 1157 | title=_('Initial Comment'), required=False, | 1165 | title=_('Initial Comment'), required=False, |
703 | 1158 | description=_('Describe your change.')) | 1166 | description=_('Describe your change.')) |
704 | @@ -1206,6 +1214,7 @@ | |||
705 | 1206 | registrant = self.user | 1214 | registrant = self.user |
706 | 1207 | source_branch = self.context | 1215 | source_branch = self.context |
707 | 1208 | target_branch = data['target_branch'] | 1216 | target_branch = data['target_branch'] |
708 | 1217 | prerequisite_branch = data.get('prerequisite_branch') | ||
709 | 1209 | 1218 | ||
710 | 1210 | review_requests = [] | 1219 | review_requests = [] |
711 | 1211 | reviewer = data.get('reviewer') | 1220 | reviewer = data.get('reviewer') |
712 | @@ -1217,7 +1226,8 @@ | |||
713 | 1217 | # and an advanced expandable section. | 1226 | # and an advanced expandable section. |
714 | 1218 | proposal = source_branch.addLandingTarget( | 1227 | proposal = source_branch.addLandingTarget( |
715 | 1219 | registrant=registrant, target_branch=target_branch, | 1228 | registrant=registrant, target_branch=target_branch, |
717 | 1220 | needs_review=True, initial_comment=data.get('comment'), | 1229 | prerequisite_branch=prerequisite_branch, needs_review=True, |
718 | 1230 | initial_comment=data.get('comment'), | ||
719 | 1221 | review_requests=review_requests) | 1231 | review_requests=review_requests) |
720 | 1222 | 1232 | ||
721 | 1223 | self.next_url = canonical_url(proposal) | 1233 | self.next_url = canonical_url(proposal) |
722 | 1224 | 1234 | ||
723 | === modified file 'lib/lp/code/mail/branchmergeproposal.py' | |||
724 | --- lib/lp/code/mail/branchmergeproposal.py 2009-09-18 13:50:52 +0000 | |||
725 | +++ lib/lp/code/mail/branchmergeproposal.py 2009-11-03 18:13:41 +0000 | |||
726 | @@ -199,6 +199,7 @@ | |||
727 | 199 | 'proposal_registrant': self.merge_proposal.registrant.displayname, | 199 | 'proposal_registrant': self.merge_proposal.registrant.displayname, |
728 | 200 | 'source_branch': self.merge_proposal.source_branch.bzr_identity, | 200 | 'source_branch': self.merge_proposal.source_branch.bzr_identity, |
729 | 201 | 'target_branch': self.merge_proposal.target_branch.bzr_identity, | 201 | 'target_branch': self.merge_proposal.target_branch.bzr_identity, |
730 | 202 | 'prerequisite': '', | ||
731 | 202 | 'proposal_title': self.merge_proposal.title, | 203 | 'proposal_title': self.merge_proposal.title, |
732 | 203 | 'proposal_url': canonical_url(self.merge_proposal), | 204 | 'proposal_url': canonical_url(self.merge_proposal), |
733 | 204 | 'edit_subscription': '', | 205 | 'edit_subscription': '', |
734 | @@ -209,6 +210,10 @@ | |||
735 | 209 | 'diff_cutoff_warning': '', | 210 | 'diff_cutoff_warning': '', |
736 | 210 | } | 211 | } |
737 | 211 | 212 | ||
738 | 213 | if self.merge_proposal.prerequisite_branch is not None: | ||
739 | 214 | prereq_url = self.merge_proposal.prerequisite_branch.bzr_identity | ||
740 | 215 | params['prerequisite'] = ' with %s as a prerequisite' % prereq_url | ||
741 | 216 | |||
742 | 212 | requested_reviews = [] | 217 | requested_reviews = [] |
743 | 213 | for review in self.requested_reviews: | 218 | for review in self.requested_reviews: |
744 | 214 | reviewer = review.reviewer | 219 | reviewer = review.reviewer |
745 | 215 | 220 | ||
746 | === modified file 'lib/lp/code/mail/tests/test_branchmergeproposal.py' | |||
747 | --- lib/lp/code/mail/tests/test_branchmergeproposal.py 2009-09-18 13:50:52 +0000 | |||
748 | +++ lib/lp/code/mail/tests/test_branchmergeproposal.py 2009-11-03 18:13:42 +0000 | |||
749 | @@ -36,7 +36,7 @@ | |||
750 | 36 | super(TestMergeProposalMailing, self).setUp('admin@canonical.com') | 36 | super(TestMergeProposalMailing, self).setUp('admin@canonical.com') |
751 | 37 | 37 | ||
752 | 38 | def makeProposalWithSubscriber(self, diff_text=None, | 38 | def makeProposalWithSubscriber(self, diff_text=None, |
754 | 39 | initial_comment=None): | 39 | initial_comment=None, prerequisite=False): |
755 | 40 | if diff_text is not None: | 40 | if diff_text is not None: |
756 | 41 | preview_diff = PreviewDiff.create( | 41 | preview_diff = PreviewDiff.create( |
757 | 42 | diff_text, | 42 | diff_text, |
758 | @@ -49,9 +49,14 @@ | |||
759 | 49 | registrant = self.factory.makePerson( | 49 | registrant = self.factory.makePerson( |
760 | 50 | name='bazqux', displayname='Baz Qux', email='baz.qux@example.com') | 50 | name='bazqux', displayname='Baz Qux', email='baz.qux@example.com') |
761 | 51 | product = self.factory.makeProduct(name='super-product') | 51 | product = self.factory.makeProduct(name='super-product') |
762 | 52 | if prerequisite: | ||
763 | 53 | prerequisite_branch = self.factory.makeProductBranch(product) | ||
764 | 54 | else: | ||
765 | 55 | prerequisite_branch = None | ||
766 | 52 | bmp = self.factory.makeBranchMergeProposal( | 56 | bmp = self.factory.makeBranchMergeProposal( |
769 | 53 | registrant=registrant, product=product, preview_diff=preview_diff, | 57 | registrant=registrant, product=product, |
770 | 54 | initial_comment=initial_comment) | 58 | prerequisite_branch=prerequisite_branch, |
771 | 59 | preview_diff=preview_diff, initial_comment=initial_comment) | ||
772 | 55 | subscriber = self.factory.makePerson(displayname='Baz Quxx', | 60 | subscriber = self.factory.makePerson(displayname='Baz Quxx', |
773 | 56 | email='baz.quxx@example.com') | 61 | email='baz.quxx@example.com') |
774 | 57 | bmp.source_branch.subscribe(subscriber, | 62 | bmp.source_branch.subscribe(subscriber, |
775 | @@ -133,6 +138,14 @@ | |||
776 | 133 | 'Requested reviews:\n Review-person (review-person)\n\n-- \n', | 138 | 'Requested reviews:\n Review-person (review-person)\n\n-- \n', |
777 | 134 | ctrl.body) | 139 | ctrl.body) |
778 | 135 | 140 | ||
779 | 141 | def test_forCreation_with_prerequisite_branch(self): | ||
780 | 142 | """Correctly format list of reviewers.""" | ||
781 | 143 | bmp, subscriber = self.makeProposalWithSubscriber(prerequisite=True) | ||
782 | 144 | mailer = BMPMailer.forCreation(bmp, bmp.registrant) | ||
783 | 145 | ctrl = mailer.generateEmail('baz.quxx@example.com', subscriber) | ||
784 | 146 | prereq = bmp.prerequisite_branch.bzr_identity | ||
785 | 147 | self.assertIn(' with %s as a prerequisite.' % prereq, ctrl.body) | ||
786 | 148 | |||
787 | 136 | def test_to_addrs_includes_reviewers(self): | 149 | def test_to_addrs_includes_reviewers(self): |
788 | 137 | """The addresses for the to header include requested reviewers""" | 150 | """The addresses for the to header include requested reviewers""" |
789 | 138 | request, requester = self.makeReviewRequest() | 151 | request, requester = self.makeReviewRequest() |
790 | 139 | 152 | ||
791 | === modified file 'lib/lp/code/stories/branches/xx-branch-merge-proposals.txt' | |||
792 | --- lib/lp/code/stories/branches/xx-branch-merge-proposals.txt 2009-10-23 02:36:17 +0000 | |||
793 | +++ lib/lp/code/stories/branches/xx-branch-merge-proposals.txt 2009-11-03 18:13:42 +0000 | |||
794 | @@ -57,6 +57,9 @@ | |||
795 | 57 | >>> nopriv_browser.getControl( | 57 | >>> nopriv_browser.getControl( |
796 | 58 | ... name='field.target_branch.target_branch').value = ( | 58 | ... name='field.target_branch.target_branch').value = ( |
797 | 59 | ... '~name12/gnome-terminal/main') | 59 | ... '~name12/gnome-terminal/main') |
798 | 60 | >>> nopriv_browser.getControl( | ||
799 | 61 | ... name='field.prerequisite_branch').value = ( | ||
800 | 62 | ... '~name12/gnome-terminal/pushed') | ||
801 | 60 | 63 | ||
802 | 61 | There is a cancel link shown with the buttons. | 64 | There is a cancel link shown with the buttons. |
803 | 62 | 65 | ||
804 | @@ -68,6 +71,20 @@ | |||
805 | 68 | >>> print nopriv_browser.url | 71 | >>> print nopriv_browser.url |
806 | 69 | http://code.launchpad.dev/~name12/gnome-terminal/klingon/+merge/... | 72 | http://code.launchpad.dev/~name12/gnome-terminal/klingon/+merge/... |
807 | 70 | 73 | ||
808 | 74 | The summary reflects the selected target and prerequisite. | ||
809 | 75 | |||
810 | 76 | >>> def print_summary(browser): | ||
811 | 77 | ... print extract_text(find_tag_by_id( | ||
812 | 78 | ... browser.contents, 'proposal-summary')) | ||
813 | 79 | >>> print_summary(nopriv_browser) | ||
814 | 80 | Status:... | ||
815 | 81 | Proposed branch: | ||
816 | 82 | lp://dev/~name12/gnome-terminal/klingon | ||
817 | 83 | Merge into: | ||
818 | 84 | lp://dev/~name12/gnome-terminal/main | ||
819 | 85 | Prerequisite: | ||
820 | 86 | lp://dev/~name12/gnome-terminal/pushed | ||
821 | 87 | |||
822 | 71 | 88 | ||
823 | 72 | Editing a commit message | 89 | Editing a commit message |
824 | 73 | ------------------------ | 90 | ------------------------ |
825 | @@ -83,9 +100,6 @@ | |||
826 | 83 | >>> print nopriv_browser.url | 100 | >>> print nopriv_browser.url |
827 | 84 | http://code.launchpad.dev/~name12/gnome-terminal/klingon/+merge/1 | 101 | http://code.launchpad.dev/~name12/gnome-terminal/klingon/+merge/1 |
828 | 85 | 102 | ||
829 | 86 | >>> def print_summary(browser): | ||
830 | 87 | ... print extract_text(find_tag_by_id( | ||
831 | 88 | ... browser.contents, 'proposal-summary')) | ||
832 | 89 | >>> print_tag_with_id(nopriv_browser.contents, 'edit-description') | 103 | >>> print_tag_with_id(nopriv_browser.contents, 'edit-description') |
833 | 90 | Commit Message | 104 | Commit Message |
834 | 91 | Add more <b>mojo</b> | 105 | Add more <b>mojo</b> |
835 | 92 | 106 | ||
836 | === modified file 'lib/lp/code/templates/branchmergeproposal-pagelet-summary.pt' | |||
837 | --- lib/lp/code/templates/branchmergeproposal-pagelet-summary.pt 2009-10-21 23:20:59 +0000 | |||
838 | +++ lib/lp/code/templates/branchmergeproposal-pagelet-summary.pt 2009-11-03 18:13:43 +0000 | |||
839 | @@ -105,6 +105,10 @@ | |||
840 | 105 | <th>Merge into:</th> | 105 | <th>Merge into:</th> |
841 | 106 | <td tal:content="structure context/target_branch/fmt:bzr-link">lp:~foo/bar/baz</td> | 106 | <td tal:content="structure context/target_branch/fmt:bzr-link">lp:~foo/bar/baz</td> |
842 | 107 | </tr> | 107 | </tr> |
843 | 108 | <tr tal:condition="context/prerequisite_branch"> | ||
844 | 109 | <th>Prerequisite:</th> | ||
845 | 110 | <td tal:content="structure context/prerequisite_branch/fmt:bzr-link">lp:~foo/bar/baz</td> | ||
846 | 111 | </tr> | ||
847 | 108 | <tr tal:condition="context/preview_diff"> | 112 | <tr tal:condition="context/preview_diff"> |
848 | 109 | <th>Diff against target:</th> | 113 | <th>Diff against target:</th> |
849 | 110 | <td> | 114 | <td> |
850 | 111 | 115 | ||
851 | === modified file 'lib/lp/code/templates/branchmergeproposal-resubmit.pt' | |||
852 | --- lib/lp/code/templates/branchmergeproposal-resubmit.pt 2009-09-08 19:24:40 +0000 | |||
853 | +++ lib/lp/code/templates/branchmergeproposal-resubmit.pt 2009-11-03 18:13:39 +0000 | |||
854 | @@ -14,8 +14,9 @@ | |||
855 | 14 | <div metal:fill-slot="extra_info"> | 14 | <div metal:fill-slot="extra_info"> |
856 | 15 | <p> | 15 | <p> |
857 | 16 | Resubmitting this proposal to merge will cause this proposal to be | 16 | Resubmitting this proposal to merge will cause this proposal to be |
860 | 17 | marked as <strong>superseded</strong>. Another proposal to merge with | 17 | marked as <strong>superseded</strong>. Another merge proposal will |
861 | 18 | the same source and target branches will be created. | 18 | be created, with the same source, target and prerequisite branch |
862 | 19 | (if any). | ||
863 | 19 | </p> | 20 | </p> |
864 | 20 | <p> | 21 | <p> |
865 | 21 | Everyone who has reviewed the previous proposal or was requested to | 22 | Everyone who has reviewed the previous proposal or was requested to |
866 | 22 | 23 | ||
867 | === modified file 'lib/lp/registry/browser/__init__.py' | |||
868 | --- lib/lp/registry/browser/__init__.py 2009-09-22 16:21:12 +0000 | |||
869 | +++ lib/lp/registry/browser/__init__.py 2009-11-03 18:13:42 +0000 | |||
870 | @@ -18,6 +18,8 @@ | |||
871 | 18 | 18 | ||
872 | 19 | from zope.component import getUtility | 19 | from zope.component import getUtility |
873 | 20 | 20 | ||
874 | 21 | from storm.store import Store | ||
875 | 22 | |||
876 | 21 | from lp.bugs.interfaces.bugtask import BugTaskSearchParams, IBugTaskSet | 23 | from lp.bugs.interfaces.bugtask import BugTaskSearchParams, IBugTaskSet |
877 | 22 | from lp.registry.interfaces.productseries import IProductSeries | 24 | from lp.registry.interfaces.productseries import IProductSeries |
878 | 23 | from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities | 25 | from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities |
879 | @@ -136,15 +138,22 @@ | |||
880 | 136 | """The context's URL.""" | 138 | """The context's URL.""" |
881 | 137 | return canonical_url(self.context) | 139 | return canonical_url(self.context) |
882 | 138 | 140 | ||
886 | 139 | def _getBugtasks(self, milestone): | 141 | def _getBugtasks(self, target): |
887 | 140 | """Return the list `IBugTask`s targeted to the milestone.""" | 142 | """Return the list `IBugTask`s associated with the target.""" |
888 | 141 | params = BugTaskSearchParams(milestone=milestone, user=None) | 143 | if IProductSeries.providedBy(target): |
889 | 144 | params = BugTaskSearchParams(user=None) | ||
890 | 145 | params.setProductSeries(target) | ||
891 | 146 | else: | ||
892 | 147 | params = BugTaskSearchParams(milestone=target, user=None) | ||
893 | 142 | bugtasks = getUtility(IBugTaskSet).search(params) | 148 | bugtasks = getUtility(IBugTaskSet).search(params) |
894 | 143 | return list(bugtasks) | 149 | return list(bugtasks) |
895 | 144 | 150 | ||
899 | 145 | def _getSpecifications(self, milestone): | 151 | def _getSpecifications(self, target): |
900 | 146 | """Return the list `ISpecification`s targeted to the milestone.""" | 152 | """Return the list `ISpecification`s associated to the target.""" |
901 | 147 | return list(milestone.specifications) | 153 | if IProductSeries.providedBy(target): |
902 | 154 | return list(target.all_specifications) | ||
903 | 155 | else: | ||
904 | 156 | return list(target.specifications) | ||
905 | 148 | 157 | ||
906 | 149 | def _getProductRelease(self, milestone): | 158 | def _getProductRelease(self, milestone): |
907 | 150 | """The `IProductRelease` associated with the milestone.""" | 159 | """The `IProductRelease` associated with the milestone.""" |
908 | @@ -158,10 +167,37 @@ | |||
909 | 158 | else: | 167 | else: |
910 | 159 | return [] | 168 | return [] |
911 | 160 | 169 | ||
912 | 170 | def _unsubscribe_structure(self, structure): | ||
913 | 171 | """Removed the subscriptions from structure.""" | ||
914 | 172 | for subscription in structure.getSubscriptions(): | ||
915 | 173 | # The owner of the subscription or an admin are the only users | ||
916 | 174 | # that can destroy a subscription, but this rule cannot prevent | ||
917 | 175 | # the owner from removing the structure. | ||
918 | 176 | Store.of(subscription).remove(subscription) | ||
919 | 177 | |||
920 | 178 | def _remove_series_bugs_and_specifications(self, series): | ||
921 | 179 | """Untarget the associated bugs and subscriptions.""" | ||
922 | 180 | for spec in self._getSpecifications(series): | ||
923 | 181 | spec.proposeGoal(None, self.user) | ||
924 | 182 | for bugtask in self._getBugtasks(series): | ||
925 | 183 | # Bugtasks cannot be deleted directly. In this case, the bugtask | ||
926 | 184 | # is already reported on the product, so the series bugtask has | ||
927 | 185 | # no purpose without a series. | ||
928 | 186 | Store.of(bugtask).remove(bugtask) | ||
929 | 187 | |||
930 | 161 | def _deleteProductSeries(self, series): | 188 | def _deleteProductSeries(self, series): |
934 | 162 | """Remove the series and delete/unlink related objects.""" | 189 | """Remove the series and delete/unlink related objects. |
935 | 163 | # Delete all milestones, releases, and files. | 190 | |
936 | 164 | # Any associated bugtasks and specifications are untargeted. | 191 | All subordinate milestones, releases, and files will be deleted. |
937 | 192 | Milestone bugs and blueprints will be untargeted. | ||
938 | 193 | Series bugs and blueprints will be untargeted. | ||
939 | 194 | Series and milestone structural subscriptions are unsubscribed. | ||
940 | 195 | Series branches are unlinked. | ||
941 | 196 | """ | ||
942 | 197 | self._unsubscribe_structure(series) | ||
943 | 198 | self._remove_series_bugs_and_specifications(series) | ||
944 | 199 | series.branch = None | ||
945 | 200 | |||
946 | 165 | for milestone in series.all_milestones: | 201 | for milestone in series.all_milestones: |
947 | 166 | self._deleteMilestone(milestone) | 202 | self._deleteMilestone(milestone) |
948 | 167 | # Series are not deleted because some objects like translations are | 203 | # Series are not deleted because some objects like translations are |
949 | @@ -174,6 +210,7 @@ | |||
950 | 174 | 210 | ||
951 | 175 | def _deleteMilestone(self, milestone): | 211 | def _deleteMilestone(self, milestone): |
952 | 176 | """Delete a milestone and unlink related objects.""" | 212 | """Delete a milestone and unlink related objects.""" |
953 | 213 | self._unsubscribe_structure(milestone) | ||
954 | 177 | for bugtask in self._getBugtasks(milestone): | 214 | for bugtask in self._getBugtasks(milestone): |
955 | 178 | bugtask.milestone = None | 215 | bugtask.milestone = None |
956 | 179 | for spec in self._getSpecifications(milestone): | 216 | for spec in self._getSpecifications(milestone): |
957 | @@ -191,6 +228,7 @@ | |||
958 | 191 | 228 | ||
959 | 192 | class RegistryEditFormView(LaunchpadEditFormView): | 229 | class RegistryEditFormView(LaunchpadEditFormView): |
960 | 193 | """A base class that provides consistent edit form behaviour.""" | 230 | """A base class that provides consistent edit form behaviour.""" |
961 | 231 | |||
962 | 194 | @property | 232 | @property |
963 | 195 | def page_title(self): | 233 | def page_title(self): |
964 | 196 | """The page title.""" | 234 | """The page title.""" |
965 | 197 | 235 | ||
966 | === modified file 'lib/lp/registry/browser/productseries.py' | |||
967 | --- lib/lp/registry/browser/productseries.py 2009-10-26 19:47:59 +0000 | |||
968 | +++ lib/lp/registry/browser/productseries.py 2009-11-03 18:13:42 +0000 | |||
969 | @@ -479,7 +479,7 @@ | |||
970 | 479 | @cachedproperty | 479 | @cachedproperty |
971 | 480 | def bugtasks(self): | 480 | def bugtasks(self): |
972 | 481 | """A list of all `IBugTask`s targeted to this series.""" | 481 | """A list of all `IBugTask`s targeted to this series.""" |
974 | 482 | all_bugtasks = [] | 482 | all_bugtasks = self._getBugtasks(self.context) |
975 | 483 | for milestone in self.milestones: | 483 | for milestone in self.milestones: |
976 | 484 | all_bugtasks.extend(self._getBugtasks(milestone)) | 484 | all_bugtasks.extend(self._getBugtasks(milestone)) |
977 | 485 | return all_bugtasks | 485 | return all_bugtasks |
978 | @@ -487,7 +487,7 @@ | |||
979 | 487 | @cachedproperty | 487 | @cachedproperty |
980 | 488 | def specifications(self): | 488 | def specifications(self): |
981 | 489 | """A list of all `ISpecification`s targeted to this series.""" | 489 | """A list of all `ISpecification`s targeted to this series.""" |
983 | 490 | all_specifications = [] | 490 | all_specifications = self._getSpecifications(self.context) |
984 | 491 | for milestone in self.milestones: | 491 | for milestone in self.milestones: |
985 | 492 | all_specifications.extend(self._getSpecifications(milestone)) | 492 | all_specifications.extend(self._getSpecifications(milestone)) |
986 | 493 | return all_specifications | 493 | return all_specifications |
987 | @@ -497,6 +497,11 @@ | |||
988 | 497 | """Does the series have any targeted bugtasks or specifications.""" | 497 | """Does the series have any targeted bugtasks or specifications.""" |
989 | 498 | return len(self.bugtasks) > 0 or len(self.specifications) > 0 | 498 | return len(self.bugtasks) > 0 or len(self.specifications) > 0 |
990 | 499 | 499 | ||
991 | 500 | @property | ||
992 | 501 | def has_linked_branch(self): | ||
993 | 502 | """Is the series linked to a branch.""" | ||
994 | 503 | return self.context.branch is not None | ||
995 | 504 | |||
996 | 500 | @cachedproperty | 505 | @cachedproperty |
997 | 501 | def product_release_files(self): | 506 | def product_release_files(self): |
998 | 502 | """A list of all `IProductReleaseFile`s that belong to this series.""" | 507 | """A list of all `IProductReleaseFile`s that belong to this series.""" |
999 | 503 | 508 | ||
1000 | === modified file 'lib/lp/registry/browser/tests/milestone-views.txt' | |||
1001 | --- lib/lp/registry/browser/tests/milestone-views.txt 2009-09-22 16:21:12 +0000 | |||
1002 | +++ lib/lp/registry/browser/tests/milestone-views.txt 2009-11-03 18:13:41 +0000 | |||
1003 | @@ -654,6 +654,9 @@ | |||
1004 | 654 | >>> bug = factory.makeBug(product=firefox) | 654 | >>> bug = factory.makeBug(product=firefox) |
1005 | 655 | >>> bugtask = bug.bugtasks[0] | 655 | >>> bugtask = bug.bugtasks[0] |
1006 | 656 | >>> bugtask.milestone = milestone | 656 | >>> bugtask.milestone = milestone |
1007 | 657 | >>> subscription = milestone.addSubscription(owner, owner) | ||
1008 | 658 | >>> [subscription for subscription in owner.structural_subscriptions] | ||
1009 | 659 | [<StructuralSubscription ...>] | ||
1010 | 657 | 660 | ||
1011 | 658 | >>> view = create_initialized_view(milestone, '+delete') | 661 | >>> view = create_initialized_view(milestone, '+delete') |
1012 | 659 | >>> [bugtask.milestone.name for bugtask in view.bugtasks] | 662 | >>> [bugtask.milestone.name for bugtask in view.bugtasks] |
1013 | @@ -685,6 +688,9 @@ | |||
1014 | 685 | >>> print bugtask.milestone | 688 | >>> print bugtask.milestone |
1015 | 686 | None | 689 | None |
1016 | 687 | 690 | ||
1017 | 691 | >>> [subscription for subscription in owner.structural_subscriptions] | ||
1018 | 692 | [] | ||
1019 | 693 | |||
1020 | 688 | No Privileges Person cannot access this view because he is neither the | 694 | No Privileges Person cannot access this view because he is neither the |
1021 | 689 | project owner or series driver.. | 695 | project owner or series driver.. |
1022 | 690 | 696 | ||
1023 | 691 | 697 | ||
1024 | === modified file 'lib/lp/registry/browser/tests/productseries-views.txt' | |||
1025 | --- lib/lp/registry/browser/tests/productseries-views.txt 2009-10-23 16:21:47 +0000 | |||
1026 | +++ lib/lp/registry/browser/tests/productseries-views.txt 2009-11-03 18:13:42 +0000 | |||
1027 | @@ -229,6 +229,8 @@ | |||
1028 | 229 | [] | 229 | [] |
1029 | 230 | >>> view.product_release_files | 230 | >>> view.product_release_files |
1030 | 231 | [] | 231 | [] |
1031 | 232 | >>> view.has_linked_branch | ||
1032 | 233 | False | ||
1033 | 232 | 234 | ||
1034 | 233 | Most series that are deleted do not have any related objects, but a small | 235 | Most series that are deleted do not have any related objects, but a small |
1035 | 234 | portion do. | 236 | portion do. |
1036 | @@ -244,18 +246,38 @@ | |||
1037 | 244 | >>> bugtask = bug.bugtasks[0] | 246 | >>> bugtask = bug.bugtasks[0] |
1038 | 245 | >>> bugtask.milestone = milestone_two | 247 | >>> bugtask.milestone = milestone_two |
1039 | 246 | 248 | ||
1040 | 249 | >>> owner = product.owner | ||
1041 | 250 | >>> series_specification = factory.makeSpecification(product=product) | ||
1042 | 251 | >>> series_specification.proposeGoal(productseries, owner) | ||
1043 | 252 | >>> series_bugtask = factory.makeBugTask(bug=bug, target=productseries) | ||
1044 | 253 | >>> subscription = productseries.addSubscription(owner, owner) | ||
1045 | 254 | >>> productseries.branch = factory.makeBranch() | ||
1046 | 255 | |||
1047 | 247 | >>> view = create_view(productseries, name='+delete') | 256 | >>> view = create_view(productseries, name='+delete') |
1048 | 248 | >>> [milestone.name for milestone in view.milestones] | 257 | >>> [milestone.name for milestone in view.milestones] |
1049 | 249 | [u'0.2', u'0.1'] | 258 | [u'0.2', u'0.1'] |
1050 | 250 | >>> view.has_bugtasks_and_specifications | 259 | >>> view.has_bugtasks_and_specifications |
1051 | 251 | True | 260 | True |
1059 | 252 | >>> [bugtask.milestone.name for bugtask in view.bugtasks] | 261 | >>> for bugtask in view.bugtasks: |
1060 | 253 | [u'0.2'] | 262 | ... if bugtask.milestone is not None: |
1061 | 254 | >>> [spec.milestone.name for spec in view.specifications] | 263 | ... print bugtask.milestone.name |
1062 | 255 | [u'0.1'] | 264 | ... else: |
1063 | 256 | 265 | ... print bugtask.target.name | |
1064 | 257 | # Listing and deleting product release files is done in the story | 266 | rabbit |
1065 | 258 | # because they require the Librarian to be running. | 267 | 0.2 |
1066 | 268 | >>> for spec in view.specifications: | ||
1067 | 269 | ... if spec.milestone is not None: | ||
1068 | 270 | ... print spec.milestone.name | ||
1069 | 271 | ... else: | ||
1070 | 272 | ... print spec.goal.name | ||
1071 | 273 | rabbit | ||
1072 | 274 | 0.1 | ||
1073 | 275 | |||
1074 | 276 | >>> view.has_linked_branch | ||
1075 | 277 | True | ||
1076 | 278 | |||
1077 | 279 | # Listing and deleting product release files is done in | ||
1078 | 280 | # product-release-views because they require the Librarian to be running. | ||
1079 | 259 | 281 | ||
1080 | 260 | Series that are the active focus of development cannot be deleted. The | 282 | Series that are the active focus of development cannot be deleted. The |
1081 | 261 | view's can_delete property checks this rule. | 283 | view's can_delete property checks this rule. |
1082 | @@ -291,7 +313,8 @@ | |||
1083 | 291 | Calling the view's delete action on a series that can be deleted will | 313 | Calling the view's delete action on a series that can be deleted will |
1084 | 292 | untarget the bugtasks and specifications that are targeted to the | 314 | untarget the bugtasks and specifications that are targeted to the |
1085 | 293 | series' milestones. The milestones, releases, and release files are | 315 | series' milestones. The milestones, releases, and release files are |
1087 | 294 | deleted. | 316 | deleted. Bugs and blueprints targeted to the series are unassigned. |
1088 | 317 | Series structural subscriptions are removed. Branch links are removed. | ||
1089 | 295 | 318 | ||
1090 | 296 | >>> view = create_initialized_view(productseries, '+delete', form=form) | 319 | >>> view = create_initialized_view(productseries, '+delete', form=form) |
1091 | 297 | >>> for notification in view.request.response.notifications: | 320 | >>> for notification in view.request.response.notifications: |
1092 | @@ -308,11 +331,17 @@ | |||
1093 | 308 | None | 331 | None |
1094 | 309 | >>> print bugtask.milestone | 332 | >>> print bugtask.milestone |
1095 | 310 | None | 333 | None |
1096 | 334 | >>> bugtask.related_tasks | ||
1097 | 335 | [] | ||
1098 | 336 | >>> print series_specification.milestone | ||
1099 | 337 | None | ||
1100 | 338 | >>> [subscription for subscription in owner.structural_subscriptions] | ||
1101 | 339 | [] | ||
1102 | 311 | 340 | ||
1103 | 312 | The series was not actually deleted because there are problematic objects | 341 | The series was not actually deleted because there are problematic objects |
1104 | 313 | like translations. The series are assigned to the Obsolete Junk project. | 342 | like translations. The series are assigned to the Obsolete Junk project. |
1105 | 314 | The series name is changed to 'product_name-series_name-date_created' to | 343 | The series name is changed to 'product_name-series_name-date_created' to |
1107 | 315 | avoid conflicts. | 344 | avoid conflicts. The linked branch is removed. |
1108 | 316 | 345 | ||
1109 | 317 | >>> from zope.component import getUtility | 346 | >>> from zope.component import getUtility |
1110 | 318 | >>> from canonical.launchpad.interfaces.launchpad import ( | 347 | >>> from canonical.launchpad.interfaces.launchpad import ( |
1111 | 319 | 348 | ||
1112 | === modified file 'lib/lp/registry/doc/milestone.txt' | |||
1113 | --- lib/lp/registry/doc/milestone.txt 2009-08-13 19:03:36 +0000 | |||
1114 | +++ lib/lp/registry/doc/milestone.txt 2009-11-03 18:13:40 +0000 | |||
1115 | @@ -496,3 +496,13 @@ | |||
1116 | 496 | ... | 496 | ... |
1117 | 497 | AssertionError: You cannot delete a milestone which has specifications | 497 | AssertionError: You cannot delete a milestone which has specifications |
1118 | 498 | targeted to it. | 498 | targeted to it. |
1119 | 499 | |||
1120 | 500 | If a milestone has a structural subscription, it cannot be deleted. | ||
1121 | 501 | |||
1122 | 502 | >>> milestone = ff_onedotzero.newMilestone('1.0.14') | ||
1123 | 503 | >>> subscription = milestone.addSubscription(owner, owner) | ||
1124 | 504 | >>> milestone.destroySelf() | ||
1125 | 505 | Traceback (most recent call last): | ||
1126 | 506 | ... | ||
1127 | 507 | AssertionError: You cannot delete a milestone which has structural | ||
1128 | 508 | subscriptions. | ||
1129 | 499 | 509 | ||
1130 | === modified file 'lib/lp/registry/model/distribution.py' | |||
1131 | --- lib/lp/registry/model/distribution.py 2009-10-23 16:20:14 +0000 | |||
1132 | +++ lib/lp/registry/model/distribution.py 2009-11-03 18:13:43 +0000 | |||
1133 | @@ -851,6 +851,7 @@ | |||
1134 | 851 | SourcePackagePublishingHistory.dateremoved is NULL | 851 | SourcePackagePublishingHistory.dateremoved is NULL |
1135 | 852 | """ % sqlvalues(self, archive), | 852 | """ % sqlvalues(self, archive), |
1136 | 853 | distinct=True, | 853 | distinct=True, |
1137 | 854 | orderBy="name", | ||
1138 | 854 | clauseTables=['SourcePackagePublishingHistory', 'DistroSeries', | 855 | clauseTables=['SourcePackagePublishingHistory', 'DistroSeries', |
1139 | 855 | 'SourcePackageRelease'])) | 856 | 'SourcePackageRelease'])) |
1140 | 856 | 857 | ||
1141 | 857 | 858 | ||
1142 | === modified file 'lib/lp/registry/model/milestone.py' | |||
1143 | --- lib/lp/registry/model/milestone.py 2009-10-22 09:43:29 +0000 | |||
1144 | +++ lib/lp/registry/model/milestone.py 2009-11-03 18:13:43 +0000 | |||
1145 | @@ -188,6 +188,9 @@ | |||
1146 | 188 | """See `IMilestone`.""" | 188 | """See `IMilestone`.""" |
1147 | 189 | params = BugTaskSearchParams(milestone=self, user=None) | 189 | params = BugTaskSearchParams(milestone=self, user=None) |
1148 | 190 | bugtasks = getUtility(IBugTaskSet).search(params) | 190 | bugtasks = getUtility(IBugTaskSet).search(params) |
1149 | 191 | assert len(self.getSubscriptions()) == 0, ( | ||
1150 | 192 | "You cannot delete a milestone which has structural " | ||
1151 | 193 | "subscriptions.") | ||
1152 | 191 | assert bugtasks.count() == 0, ( | 194 | assert bugtasks.count() == 0, ( |
1153 | 192 | "You cannot delete a milestone which has bugtasks targeted " | 195 | "You cannot delete a milestone which has bugtasks targeted " |
1154 | 193 | "to it.") | 196 | "to it.") |
1155 | @@ -238,6 +241,7 @@ | |||
1156 | 238 | """See lp.registry.interfaces.milestone.IMilestoneSet.""" | 241 | """See lp.registry.interfaces.milestone.IMilestoneSet.""" |
1157 | 239 | return Milestone.selectBy(active=True, orderBy='id') | 242 | return Milestone.selectBy(active=True, orderBy='id') |
1158 | 240 | 243 | ||
1159 | 244 | |||
1160 | 241 | class ProjectMilestone(HasBugsBase): | 245 | class ProjectMilestone(HasBugsBase): |
1161 | 242 | """A virtual milestone implementation for project. | 246 | """A virtual milestone implementation for project. |
1162 | 243 | 247 | ||
1163 | 244 | 248 | ||
1164 | === modified file 'lib/lp/registry/templates/product-index.pt' | |||
1165 | --- lib/lp/registry/templates/product-index.pt 2009-10-08 15:54:09 +0000 | |||
1166 | +++ lib/lp/registry/templates/product-index.pt 2009-11-03 18:13:40 +0000 | |||
1167 | @@ -219,7 +219,7 @@ | |||
1168 | 219 | </tal:release> | 219 | </tal:release> |
1169 | 220 | 220 | ||
1170 | 221 | <p class="alternate"> | 221 | <p class="alternate"> |
1172 | 222 | <a class="sprint info" | 222 | <a class="sprite info" |
1173 | 223 | tal:define="link overview_menu/downloads" | 223 | tal:define="link overview_menu/downloads" |
1174 | 224 | tal:condition="release" | 224 | tal:condition="release" |
1175 | 225 | tal:attributes="href link/fmt:url; | 225 | tal:attributes="href link/fmt:url; |
1176 | 226 | 226 | ||
1177 | === modified file 'lib/lp/registry/templates/productseries-delete.pt' | |||
1178 | --- lib/lp/registry/templates/productseries-delete.pt 2009-08-11 21:31:51 +0000 | |||
1179 | +++ lib/lp/registry/templates/productseries-delete.pt 2009-11-03 18:13:43 +0000 | |||
1180 | @@ -30,10 +30,12 @@ | |||
1181 | 30 | </tal:no-files> | 30 | </tal:no-files> |
1182 | 31 | </p> | 31 | </p> |
1183 | 32 | 32 | ||
1185 | 33 | <ul id="milestones" tal:condition="view/milestones"> | 33 | <ul id="milestones" class="subordinate" |
1186 | 34 | tal:condition="view/milestones"> | ||
1187 | 34 | <li tal:repeat="milestone view/milestones"> | 35 | <li tal:repeat="milestone view/milestones"> |
1188 | 35 | <strong> | 36 | <strong> |
1190 | 36 | <a tal:attributes="href milestone/fmt:url"><tal:name | 37 | <a class="sprite milestone" |
1191 | 38 | tal:attributes="href milestone/fmt:url"><tal:name | ||
1192 | 37 | content="milestone/name">0.9</tal:name><tal:codename | 39 | content="milestone/name">0.9</tal:name><tal:codename |
1193 | 38 | condition="milestone/code_name"> | 40 | condition="milestone/code_name"> |
1194 | 39 | "<tal:name | 41 | "<tal:name |
1195 | @@ -42,9 +44,8 @@ | |||
1196 | 42 | </li> | 44 | </li> |
1197 | 43 | </ul> | 45 | </ul> |
1198 | 44 | 46 | ||
1202 | 45 | 47 | <ul id="files" class="subordinate" | |
1203 | 46 | 48 | tal:condition="view/product_release_files"> | |
1201 | 47 | <ul id="files" tal:condition="view/product_release_files"> | ||
1204 | 48 | <li tal:repeat="file view/product_release_files"> | 49 | <li tal:repeat="file view/product_release_files"> |
1205 | 49 | <strong tal:content="file/libraryfile/filename">foo.tgz</strong> | 50 | <strong tal:content="file/libraryfile/filename">foo.tgz</strong> |
1206 | 50 | </li> | 51 | </li> |
1207 | @@ -54,7 +55,7 @@ | |||
1208 | 54 | The following bugs and blueprints will be <em>untargeted</em>: | 55 | The following bugs and blueprints will be <em>untargeted</em>: |
1209 | 55 | </p> | 56 | </p> |
1210 | 56 | 57 | ||
1212 | 57 | <ul id="bugtasks-and-blueprints" | 58 | <ul id="bugtasks-and-blueprints" class="subordinate" |
1213 | 58 | tal:condition="view/has_bugtasks_and_specifications"> | 59 | tal:condition="view/has_bugtasks_and_specifications"> |
1214 | 59 | <li tal:repeat="bugtask view/bugtasks" | 60 | <li tal:repeat="bugtask view/bugtasks" |
1215 | 60 | tal:content="structure bugtask/bug/fmt:link">bug 1 | 61 | tal:content="structure bugtask/bug/fmt:link">bug 1 |
1216 | @@ -64,6 +65,11 @@ | |||
1217 | 64 | </li> | 65 | </li> |
1218 | 65 | </ul> | 66 | </ul> |
1219 | 66 | 67 | ||
1220 | 68 | <p tal:condition="view/has_linked_branch"> | ||
1221 | 69 | The associated branch will be <em>unlinked</em>: | ||
1222 | 70 | <a tal:replace="structure view/context/branch/fmt:link" /> | ||
1223 | 71 | </p> | ||
1224 | 72 | |||
1225 | 67 | <p> | 73 | <p> |
1226 | 68 | Series deletion is permanent. | 74 | Series deletion is permanent. |
1227 | 69 | </p> | 75 | </p> |
1228 | 70 | 76 | ||
1229 | === modified file 'lib/lp/soyuz/adapters/archivedependencies.py' | |||
1230 | --- lib/lp/soyuz/adapters/archivedependencies.py 2009-08-16 12:38:12 +0000 | |||
1231 | +++ lib/lp/soyuz/adapters/archivedependencies.py 2009-11-03 18:13:42 +0000 | |||
1232 | @@ -36,7 +36,6 @@ | |||
1233 | 36 | 'pocket_dependencies', | 36 | 'pocket_dependencies', |
1234 | 37 | ] | 37 | ] |
1235 | 38 | 38 | ||
1236 | 39 | from canonical.config import config | ||
1237 | 40 | from lp.registry.interfaces.pocket import ( | 39 | from lp.registry.interfaces.pocket import ( |
1238 | 41 | PackagePublishingPocket, pocketsuffix) | 40 | PackagePublishingPocket, pocketsuffix) |
1239 | 42 | from lp.soyuz.interfaces.archive import ArchivePurpose, ALLOW_RELEASE_BUILDS | 41 | from lp.soyuz.interfaces.archive import ArchivePurpose, ALLOW_RELEASE_BUILDS |
1240 | @@ -161,11 +160,9 @@ | |||
1241 | 161 | 160 | ||
1242 | 162 | # Append external sources_list lines for this archive if it's | 161 | # Append external sources_list lines for this archive if it's |
1243 | 163 | # specified in the configuration. | 162 | # specified in the configuration. |
1249 | 164 | archive_config_key = 'ppa.%s_%s' % ( | 163 | dependencies = build.archive.external_dependencies |
1250 | 165 | build.archive.owner.name, build.archive.name) | 164 | if dependencies is not None: |
1251 | 166 | if archive_config_key in config: | 165 | for archive_dep in dependencies.splitlines(): |
1247 | 167 | archive_config = config[archive_config_key] | ||
1248 | 168 | for archive_dep in archive_config.dependencies.splitlines(): | ||
1252 | 169 | line = archive_dep % ( | 166 | line = archive_dep % ( |
1253 | 170 | {'series': build.distroarchseries.distroseries.name}) | 167 | {'series': build.distroarchseries.distroseries.name}) |
1254 | 171 | sources_list_lines.append(line) | 168 | sources_list_lines.append(line) |
1255 | 172 | 169 | ||
1256 | === modified file 'lib/lp/soyuz/browser/archive.py' | |||
1257 | --- lib/lp/soyuz/browser/archive.py 2009-10-30 12:29:32 +0000 | |||
1258 | +++ lib/lp/soyuz/browser/archive.py 2009-11-03 18:13:43 +0000 | |||
1259 | @@ -28,6 +28,7 @@ | |||
1260 | 28 | 28 | ||
1261 | 29 | from datetime import datetime, timedelta | 29 | from datetime import datetime, timedelta |
1262 | 30 | import pytz | 30 | import pytz |
1263 | 31 | from urlparse import urlparse | ||
1264 | 31 | 32 | ||
1265 | 32 | from zope.app.form.browser import TextAreaWidget | 33 | from zope.app.form.browser import TextAreaWidget |
1266 | 33 | from zope.component import getUtility | 34 | from zope.component import getUtility |
1267 | @@ -1775,7 +1776,10 @@ | |||
1268 | 1775 | class ArchiveAdminView(BaseArchiveEditView): | 1776 | class ArchiveAdminView(BaseArchiveEditView): |
1269 | 1776 | 1777 | ||
1270 | 1777 | field_names = ['enabled', 'private', 'require_virtualized', | 1778 | field_names = ['enabled', 'private', 'require_virtualized', |
1272 | 1778 | 'buildd_secret', 'authorized_size', 'relative_build_score'] | 1779 | 'buildd_secret', 'authorized_size', 'relative_build_score', |
1273 | 1780 | 'external_dependencies'] | ||
1274 | 1781 | |||
1275 | 1782 | custom_widget('external_dependencies', TextAreaWidget, height=3) | ||
1276 | 1779 | 1783 | ||
1277 | 1780 | def validate_save(self, action, data): | 1784 | def validate_save(self, action, data): |
1278 | 1781 | """Validate the save action on ArchiveAdminView. | 1785 | """Validate the save action on ArchiveAdminView. |
1279 | @@ -1794,12 +1798,44 @@ | |||
1280 | 1794 | self.setFieldError( | 1798 | self.setFieldError( |
1281 | 1795 | 'private', | 1799 | 'private', |
1282 | 1796 | 'Private teams may not have public archives.') | 1800 | 'Private teams may not have public archives.') |
1283 | 1797 | |||
1284 | 1798 | elif data.get('buildd_secret') is not None and not data['private']: | 1801 | elif data.get('buildd_secret') is not None and not data['private']: |
1285 | 1799 | self.setFieldError( | 1802 | self.setFieldError( |
1286 | 1800 | 'buildd_secret', | 1803 | 'buildd_secret', |
1287 | 1801 | 'Do not specify for non-private archives') | 1804 | 'Do not specify for non-private archives') |
1288 | 1802 | 1805 | ||
1289 | 1806 | # Check the external_dependencies field. | ||
1290 | 1807 | ext_deps = data.get('external_dependencies') | ||
1291 | 1808 | if ext_deps is not None: | ||
1292 | 1809 | errors = self.validate_external_dependencies(ext_deps) | ||
1293 | 1810 | if len(errors) != 0: | ||
1294 | 1811 | error_text = "\n".join(errors) | ||
1295 | 1812 | self.setFieldError('external_dependencies', error_text) | ||
1296 | 1813 | |||
1297 | 1814 | def validate_external_dependencies(self, ext_deps): | ||
1298 | 1815 | """Validate the external_dependencies field. | ||
1299 | 1816 | |||
1300 | 1817 | :param ext_deps: The dependencies form field to check. | ||
1301 | 1818 | """ | ||
1302 | 1819 | errors = [] | ||
1303 | 1820 | # The field can consist of multiple entries separated by | ||
1304 | 1821 | # newlines, so process each in turn. | ||
1305 | 1822 | for dep in ext_deps.splitlines(): | ||
1306 | 1823 | try: | ||
1307 | 1824 | deb, url, suite, components = dep.split(" ", 3) | ||
1308 | 1825 | except ValueError: | ||
1309 | 1826 | errors.append( | ||
1310 | 1827 | "'%s' is not a complete and valid sources.list entry" | ||
1311 | 1828 | % dep) | ||
1312 | 1829 | continue | ||
1313 | 1830 | |||
1314 | 1831 | if deb != "deb": | ||
1315 | 1832 | errors.append("%s: Must start with 'deb'" % dep) | ||
1316 | 1833 | url_components = urlparse(url) | ||
1317 | 1834 | if not url_components[0] or not url_components[1]: | ||
1318 | 1835 | errors.append("%s: Invalid URL" % dep) | ||
1319 | 1836 | |||
1320 | 1837 | return errors | ||
1321 | 1838 | |||
1322 | 1803 | @property | 1839 | @property |
1323 | 1804 | def owner_is_private_team(self): | 1840 | def owner_is_private_team(self): |
1324 | 1805 | """Is the owner a private team? | 1841 | """Is the owner a private team? |
1325 | 1806 | 1842 | ||
1326 | === modified file 'lib/lp/soyuz/browser/configure.zcml' | |||
1327 | --- lib/lp/soyuz/browser/configure.zcml 2009-10-22 10:33:00 +0000 | |||
1328 | +++ lib/lp/soyuz/browser/configure.zcml 2009-11-03 18:13:42 +0000 | |||
1329 | @@ -783,7 +783,7 @@ | |||
1330 | 783 | /> | 783 | /> |
1331 | 784 | <browser:url | 784 | <browser:url |
1332 | 785 | for="lp.soyuz.interfaces.packageset.IPackageset" | 785 | for="lp.soyuz.interfaces.packageset.IPackageset" |
1334 | 786 | path_expression="name" | 786 | path_expression="string:${distroseries/name}/${name}" |
1335 | 787 | parent_utility="lp.soyuz.interfaces.packageset.IPackagesetSet" | 787 | parent_utility="lp.soyuz.interfaces.packageset.IPackagesetSet" |
1336 | 788 | /> | 788 | /> |
1337 | 789 | <browser:url | 789 | <browser:url |
1338 | 790 | 790 | ||
1339 | === modified file 'lib/lp/soyuz/browser/packageset.py' | |||
1340 | --- lib/lp/soyuz/browser/packageset.py 2009-06-30 16:56:07 +0000 | |||
1341 | +++ lib/lp/soyuz/browser/packageset.py 2009-11-03 18:13:42 +0000 | |||
1342 | @@ -17,3 +17,22 @@ | |||
1343 | 17 | class PackagesetSetNavigation(GetitemNavigation): | 17 | class PackagesetSetNavigation(GetitemNavigation): |
1344 | 18 | """Navigation methods for PackagesetSet.""" | 18 | """Navigation methods for PackagesetSet.""" |
1345 | 19 | usedfor = IPackagesetSet | 19 | usedfor = IPackagesetSet |
1346 | 20 | |||
1347 | 21 | def traverse(self, distroseries): | ||
1348 | 22 | """Traverse package sets in distro series context. | ||
1349 | 23 | |||
1350 | 24 | The URI fragment of interest is: | ||
1351 | 25 | |||
1352 | 26 | /package-sets/lucid/mozilla | ||
1353 | 27 | |||
1354 | 28 | where 'lucid' is the distro series and 'mozilla' is the package set | ||
1355 | 29 | *name* respectively. | ||
1356 | 30 | """ | ||
1357 | 31 | if self.request.stepstogo: | ||
1358 | 32 | # The package set name follows after the distro series. | ||
1359 | 33 | ps_name = self.request.stepstogo.consume() | ||
1360 | 34 | return self.context.getByName(ps_name, distroseries=distroseries) | ||
1361 | 35 | |||
1362 | 36 | # Otherwise return None (to trigger a NotFound error). | ||
1363 | 37 | return None | ||
1364 | 38 | |||
1365 | 20 | 39 | ||
1366 | === modified file 'lib/lp/soyuz/browser/tests/archive-views.txt' | |||
1367 | --- lib/lp/soyuz/browser/tests/archive-views.txt 2009-10-30 21:42:10 +0000 | |||
1368 | +++ lib/lp/soyuz/browser/tests/archive-views.txt 2009-11-03 18:13:41 +0000 | |||
1369 | @@ -1345,3 +1345,50 @@ | |||
1370 | 1345 | 1345 | ||
1371 | 1346 | >>> print copy.status.name | 1346 | >>> print copy.status.name |
1372 | 1347 | ACCEPTED | 1347 | ACCEPTED |
1373 | 1348 | |||
1374 | 1349 | |||
1375 | 1350 | == External dependencies validation == | ||
1376 | 1351 | |||
1377 | 1352 | The ArchiveAdminView checks the external_dependencies form data to see if | ||
1378 | 1353 | it's a valid sources.list entry. | ||
1379 | 1354 | |||
1380 | 1355 | >>> ppa_archive_view = create_initialized_view( | ||
1381 | 1356 | ... cprov.archive, name="+admin") | ||
1382 | 1357 | |||
1383 | 1358 | The validate_external_dependencies() method is called when validating and will | ||
1384 | 1359 | return a list of errors if the data dis not validate. A valid entry is of the | ||
1385 | 1360 | form: | ||
1386 | 1361 | deb scheme://domain/ suite component[s] | ||
1387 | 1362 | |||
1388 | 1363 | >>> print ppa_archive_view.validate_external_dependencies( | ||
1389 | 1364 | ... "deb http://example.com/ karmic main") | ||
1390 | 1365 | [] | ||
1391 | 1366 | |||
1392 | 1367 | Multiple entries are valid, separated by newlines: | ||
1393 | 1368 | |||
1394 | 1369 | >>> print ppa_archive_view.validate_external_dependencies( | ||
1395 | 1370 | ... "deb http://example.com/ karmic main\n" | ||
1396 | 1371 | ... "deb http://example.com/ karmic restricted") | ||
1397 | 1372 | [] | ||
1398 | 1373 | |||
1399 | 1374 | If the line does not start with the word "deb" it fails: | ||
1400 | 1375 | |||
1401 | 1376 | >>> print ppa_archive_view.validate_external_dependencies( | ||
1402 | 1377 | ... "deb http://example.com/ karmic universe\n" | ||
1403 | 1378 | ... "dab http://example.com/ karmic main") | ||
1404 | 1379 | ["dab http://example.com/ karmic main: Must start with 'deb'"] | ||
1405 | 1380 | |||
1406 | 1381 | If the line has too few parts it fails. Here we're missing a suite: | ||
1407 | 1382 | |||
1408 | 1383 | >>> print ppa_archive_view.validate_external_dependencies( | ||
1409 | 1384 | ... "deb http://example.com/ karmic universe\n" | ||
1410 | 1385 | ... "deb http://example.com/ main") | ||
1411 | 1386 | ["'deb http://example.com/ main' | ||
1412 | 1387 | is not a complete and valid sources.list entry"] | ||
1413 | 1388 | |||
1414 | 1389 | If the URL looks invalid, it fails: | ||
1415 | 1390 | |||
1416 | 1391 | >>> print ppa_archive_view.validate_external_dependencies( | ||
1417 | 1392 | ... "deb http://example.com/ karmic universe\n" | ||
1418 | 1393 | ... "deb example.com/ karmic main") | ||
1419 | 1394 | ['deb example.com/ karmic main: Invalid URL'] | ||
1420 | 1348 | 1395 | ||
1421 | === modified file 'lib/lp/soyuz/configure.zcml' | |||
1422 | --- lib/lp/soyuz/configure.zcml 2009-10-28 14:42:40 +0000 | |||
1423 | +++ lib/lp/soyuz/configure.zcml 2009-11-03 18:13:42 +0000 | |||
1424 | @@ -399,8 +399,8 @@ | |||
1425 | 399 | <require | 399 | <require |
1426 | 400 | permission="launchpad.Commercial" | 400 | permission="launchpad.Commercial" |
1427 | 401 | set_attributes="authorized_size buildd_secret | 401 | set_attributes="authorized_size buildd_secret |
1430 | 402 | enabled private require_virtualized | 402 | enabled external_dependencies private |
1431 | 403 | relative_build_score"/> | 403 | require_virtualized relative_build_score "/> |
1432 | 404 | <require | 404 | <require |
1433 | 405 | permission="launchpad.Admin" | 405 | permission="launchpad.Admin" |
1434 | 406 | set_attributes="distribution name signing_key"/> | 406 | set_attributes="distribution name signing_key"/> |
1435 | @@ -856,4 +856,12 @@ | |||
1436 | 856 | new"/> | 856 | new"/> |
1437 | 857 | </securedutility> | 857 | </securedutility> |
1438 | 858 | 858 | ||
1439 | 859 | <!-- PackagesetGroup --> | ||
1440 | 860 | <class | ||
1441 | 861 | class="lp.soyuz.model.packagesetgroup.PackagesetGroup"> | ||
1442 | 862 | <allow | ||
1443 | 863 | interface="lp.soyuz.interfaces.packagesetgroup.IPackagesetGroup"/> | ||
1444 | 864 | </class> | ||
1445 | 865 | |||
1446 | 866 | |||
1447 | 859 | </configure> | 867 | </configure> |
1448 | 860 | 868 | ||
1449 | === modified file 'lib/lp/soyuz/doc/archive-dependencies.txt' | |||
1450 | --- lib/lp/soyuz/doc/archive-dependencies.txt 2009-08-28 07:34:44 +0000 | |||
1451 | +++ lib/lp/soyuz/doc/archive-dependencies.txt 2009-11-03 18:13:40 +0000 | |||
1452 | @@ -441,38 +441,27 @@ | |||
1453 | 441 | 441 | ||
1454 | 442 | == External build dependencies == | 442 | == External build dependencies == |
1455 | 443 | 443 | ||
1457 | 444 | Via a static configuration change, any PPA hosted in launchpad can be | 444 | Via an administrator change, any PPA hosted in launchpad can be |
1458 | 445 | assigned to one or more 'external' build dependencies additionally to | 445 | assigned to one or more 'external' build dependencies additionally to |
1459 | 446 | the internal ones. | 446 | the internal ones. |
1460 | 447 | 447 | ||
1471 | 448 | There is a configuration category called 'ppa' which can be extended | 448 | There is a column on IArchive called 'external_dependencies' which can be set |
1472 | 449 | for any hosted PPA. They are named as following: | 449 | for any hosted PPA. It is a string listing the comma-separated external |
1473 | 450 | 450 | dependencies in the debian sources_list format. | |
1474 | 451 | [ppa.<owner_name>_<ppa_name>] | 451 | |
1475 | 452 | 452 | deb http[s]://[user:pass@]<host>[/path] %(series)s[-pocket] [components] | |
1466 | 453 | The 'ppa' categories contain the 'dependencies' field, which is a | ||
1467 | 454 | multi-line string listing the external dependencies in the debian | ||
1468 | 455 | sources_list format. | ||
1469 | 456 | |||
1470 | 457 | deb [user:pass@]<host>[/path] %(series)s[-pocket] [components] | ||
1476 | 458 | 453 | ||
1477 | 459 | The '%(series)s' part is optional and will be replaced on-the-fly with | 454 | The '%(series)s' part is optional and will be replaced on-the-fly with |
1478 | 460 | the series name for the build record being dispatched. | 455 | the series name for the build record being dispatched. |
1479 | 461 | 456 | ||
1494 | 462 | We will create a configuration for Celso's PPA. | 457 | We will create some dependencies for Celso's PPA. |
1495 | 463 | 458 | ||
1496 | 464 | >>> from canonical.config import config | 459 | >>> cprov.archive.external_dependencies = ( |
1497 | 465 | >>> cprov_deps = """ | 460 | ... "deb http://user:pass@repository zoing everything\n" |
1498 | 466 | ... [ppa.cprov_ppa] | 461 | ... "deb http://user:pass@repository %(series)s public private\n" |
1499 | 467 | ... dependencies: | 462 | ... "deb http://user:pass@repository %(series)s-extra public") |
1500 | 468 | ... deb http://user:pass@repository zoing everything | 463 | |
1501 | 469 | ... deb http://user:pass@repository %(series)s public private | 464 | Now builds in Celso's PPA will use the external dependencies. |
1488 | 470 | ... deb http://user:pass@repository %(series)s-extra public | ||
1489 | 471 | ... """ | ||
1490 | 472 | >>> config.push('test_deps', cprov_deps) | ||
1491 | 473 | |||
1492 | 474 | Configuration in place, now builds in Celso's PPA will use the | ||
1493 | 475 | external dependencies. | ||
1502 | 476 | 465 | ||
1503 | 477 | >>> print_building_sources_list(a_build) | 466 | >>> print_building_sources_list(a_build) |
1504 | 478 | deb http://ftpmaster.internal/ubuntu hoary | 467 | deb http://ftpmaster.internal/ubuntu hoary |
1505 | @@ -486,6 +475,3 @@ | |||
1506 | 486 | deb http://user:pass@repository hoary-extra public | 475 | deb http://user:pass@repository hoary-extra public |
1507 | 487 | deb http://user:pass@repository zoing everything | 476 | deb http://user:pass@repository zoing everything |
1508 | 488 | 477 | ||
1509 | 489 | Tests done, we can remove the extra configuration content we've added. | ||
1510 | 490 | |||
1511 | 491 | >>> unused = config.pop('test_deps') | ||
1512 | 492 | 478 | ||
1513 | === modified file 'lib/lp/soyuz/doc/archive.txt' | |||
1514 | --- lib/lp/soyuz/doc/archive.txt 2009-10-13 16:12:10 +0000 | |||
1515 | +++ lib/lp/soyuz/doc/archive.txt 2009-11-03 18:13:41 +0000 | |||
1516 | @@ -58,11 +58,11 @@ | |||
1517 | 58 | >>> cprov_archive.failed_count | 58 | >>> cprov_archive.failed_count |
1518 | 59 | 1 | 59 | 1 |
1519 | 60 | 60 | ||
1523 | 61 | relative_build_score is a property that can be set only by LP admins and read | 61 | relative_build_score and external_dependencies are properties that can be set |
1524 | 62 | by anyone. It is a signed integer that represents a delta to all the build | 62 | only by LP admins and read by anyone. |
1522 | 63 | scores for builds done in the archive. | ||
1525 | 64 | 63 | ||
1527 | 65 | The default value is zero: | 64 | relative_build_score is a signed integer that represents a delta to all the |
1528 | 65 | build scores for builds done in the archive. The default value is zero: | ||
1529 | 66 | 66 | ||
1530 | 67 | >>> cprov_archive.relative_build_score | 67 | >>> cprov_archive.relative_build_score |
1531 | 68 | 0 | 68 | 0 |
1532 | @@ -74,10 +74,28 @@ | |||
1533 | 74 | ... | 74 | ... |
1534 | 75 | Unauthorized: (..., 'relative_build_score', 'launchpad.Commercial') | 75 | Unauthorized: (..., 'relative_build_score', 'launchpad.Commercial') |
1535 | 76 | 76 | ||
1537 | 77 | As a Launchpad admin, it will work. | 77 | external_dependencies is a text field that should contain a comma-separated |
1538 | 78 | list of sources.list entries in the format: | ||
1539 | 79 | deb http[s]://[user:pass@]<host>[/path] %(series)s[-pocket] [components] | ||
1540 | 80 | where the series variable is replaced with the series name of the context | ||
1541 | 81 | build. This allows an admin to set external repositories as a source for | ||
1542 | 82 | build dependencies on the context PPA. Its default value is None: | ||
1543 | 83 | |||
1544 | 84 | >>> print cprov_archive.external_dependencies | ||
1545 | 85 | None | ||
1546 | 86 | |||
1547 | 87 | Amending it as an unprivileged user results in failure: | ||
1548 | 88 | |||
1549 | 89 | >>> cprov_archive.external_dependencies = "test" | ||
1550 | 90 | Traceback (most recent call last): | ||
1551 | 91 | ... | ||
1552 | 92 | Unauthorized: (..., 'external_dependencies', 'launchpad.Commercial') | ||
1553 | 93 | |||
1554 | 94 | As a Launchpad admin, setting these properties will work. | ||
1555 | 78 | 95 | ||
1556 | 79 | >>> login("admin@canonical.com") | 96 | >>> login("admin@canonical.com") |
1557 | 80 | >>> cprov_archive.relative_build_score = 100 | 97 | >>> cprov_archive.relative_build_score = 100 |
1558 | 98 | >>> cprov_archive.external_dependencies = "test" | ||
1559 | 81 | 99 | ||
1560 | 82 | The buildd_secret is used by the slave scanner when generating a | 100 | The buildd_secret is used by the slave scanner when generating a |
1561 | 83 | sources.list entry for the builder to access a private archive. It is | 101 | sources.list entry for the builder to access a private archive. It is |
1562 | 84 | 102 | ||
1563 | === modified file 'lib/lp/soyuz/doc/distroarchseriesbinarypackage.txt' | |||
1564 | --- lib/lp/soyuz/doc/distroarchseriesbinarypackage.txt 2009-09-04 12:17:11 +0000 | |||
1565 | +++ lib/lp/soyuz/doc/distroarchseriesbinarypackage.txt 2009-11-03 18:13:40 +0000 | |||
1566 | @@ -209,6 +209,7 @@ | |||
1567 | 209 | 209 | ||
1568 | 210 | >>> ubuntu.updateCompleteSourcePackageCache( | 210 | >>> ubuntu.updateCompleteSourcePackageCache( |
1569 | 211 | ... archive=cprov.archive, ztm=LaunchpadZopelessLayer.txn, log=TestLog()) | 211 | ... archive=cprov.archive, ztm=LaunchpadZopelessLayer.txn, log=TestLog()) |
1570 | 212 | DEBUG: ... | ||
1571 | 212 | DEBUG: Considering source 'pmount' | 213 | DEBUG: Considering source 'pmount' |
1572 | 213 | ... | 214 | ... |
1573 | 214 | 215 | ||
1574 | 215 | 216 | ||
1575 | === modified file 'lib/lp/soyuz/doc/package-cache.txt' | |||
1576 | --- lib/lp/soyuz/doc/package-cache.txt 2009-08-13 13:09:34 +0000 | |||
1577 | +++ lib/lp/soyuz/doc/package-cache.txt 2009-11-03 18:13:39 +0000 | |||
1578 | @@ -163,11 +163,12 @@ | |||
1579 | 163 | 163 | ||
1580 | 164 | >>> updates = ubuntu.updateCompleteSourcePackageCache( | 164 | >>> updates = ubuntu.updateCompleteSourcePackageCache( |
1581 | 165 | ... archive=ubuntu.main_archive, ztm=transaction, log=TestLog()) | 165 | ... archive=ubuntu.main_archive, ztm=transaction, log=TestLog()) |
1584 | 166 | DEBUG: Considering source 'mozilla-firefox' | 166 | DEBUG: ... |
1583 | 167 | ... | ||
1585 | 168 | DEBUG: Considering source 'cdrkit' | 167 | DEBUG: Considering source 'cdrkit' |
1586 | 169 | DEBUG: Creating new source cache entry. | 168 | DEBUG: Creating new source cache entry. |
1587 | 170 | ... | 169 | ... |
1588 | 170 | DEBUG: Considering source 'mozilla-firefox' | ||
1589 | 171 | ... | ||
1590 | 171 | 172 | ||
1591 | 172 | >>> print updates | 173 | >>> print updates |
1592 | 173 | 10 | 174 | 10 |
1593 | @@ -355,6 +356,7 @@ | |||
1594 | 355 | 356 | ||
1595 | 356 | >>> source_updates = ubuntu.updateCompleteSourcePackageCache( | 357 | >>> source_updates = ubuntu.updateCompleteSourcePackageCache( |
1596 | 357 | ... archive=cprov.archive, ztm=transaction, log=TestLog()) | 358 | ... archive=cprov.archive, ztm=transaction, log=TestLog()) |
1597 | 359 | DEBUG: ... | ||
1598 | 358 | DEBUG: Considering source 'pmount' | 360 | DEBUG: Considering source 'pmount' |
1599 | 359 | ... | 361 | ... |
1600 | 360 | 362 | ||
1601 | 361 | 363 | ||
1602 | === modified file 'lib/lp/soyuz/interfaces/archive.py' | |||
1603 | --- lib/lp/soyuz/interfaces/archive.py 2009-10-26 09:43:56 +0000 | |||
1604 | +++ lib/lp/soyuz/interfaces/archive.py 2009-11-03 18:13:41 +0000 | |||
1605 | @@ -256,6 +256,18 @@ | |||
1606 | 256 | description=_( | 256 | description=_( |
1607 | 257 | "A delta to apply to all build scores for this archive.")) | 257 | "A delta to apply to all build scores for this archive.")) |
1608 | 258 | 258 | ||
1609 | 259 | external_dependencies = Text( | ||
1610 | 260 | title=_("External dependencies"), required=False, readonly=False, | ||
1611 | 261 | description=_( | ||
1612 | 262 | "Newline-separated list of repositories to be used to retrieve " | ||
1613 | 263 | "any external build dependencies when building packages in this " | ||
1614 | 264 | "archive, in the format:\n" | ||
1615 | 265 | "deb http[s]://[user:pass@]<host>[/path] %(series)s[-pocket] " | ||
1616 | 266 | "[components]\n" | ||
1617 | 267 | "The series variable is replaced with the series name of the " | ||
1618 | 268 | "context build.\n" | ||
1619 | 269 | "NOTE: This is for migration of OEM PPAs only!")) | ||
1620 | 270 | |||
1621 | 259 | def getSourcesForDeletion(name=None, status=None, distroseries=None): | 271 | def getSourcesForDeletion(name=None, status=None, distroseries=None): |
1622 | 260 | """All `ISourcePackagePublishingHistory` available for deletion. | 272 | """All `ISourcePackagePublishingHistory` available for deletion. |
1623 | 261 | 273 | ||
1624 | @@ -433,8 +445,10 @@ | |||
1625 | 433 | 445 | ||
1626 | 434 | @operation_parameters( | 446 | @operation_parameters( |
1627 | 435 | person=Reference(schema=IPerson), | 447 | person=Reference(schema=IPerson), |
1630 | 436 | packageset=TextLine( | 448 | # Really IPackageset, corrected in _schema_circular_imports to avoid |
1631 | 437 | title=_("Package set"), required=True), | 449 | # circular import. |
1632 | 450 | packageset=Reference( | ||
1633 | 451 | Interface, title=_("Package set"), required=True), | ||
1634 | 438 | explicit=Bool( | 452 | explicit=Bool( |
1635 | 439 | title=_("Explicit"), required=False)) | 453 | title=_("Explicit"), required=False)) |
1636 | 440 | # Really IArchivePermission, set in _schema_circular_imports to avoid | 454 | # Really IArchivePermission, set in _schema_circular_imports to avoid |
1637 | @@ -444,7 +458,7 @@ | |||
1638 | 444 | """Add a package set based permission for a person. | 458 | """Add a package set based permission for a person. |
1639 | 445 | 459 | ||
1640 | 446 | :param person: An `IPerson` for whom you want to add permission. | 460 | :param person: An `IPerson` for whom you want to add permission. |
1642 | 447 | :param packageset: An `IPackageset` or a string package set name. | 461 | :param packageset: An `IPackageset`. |
1643 | 448 | :param explicit: True if the package set in question requires | 462 | :param explicit: True if the package set in question requires |
1644 | 449 | specialist skills for proper handling. | 463 | specialist skills for proper handling. |
1645 | 450 | 464 | ||
1646 | @@ -453,8 +467,10 @@ | |||
1647 | 453 | """ | 467 | """ |
1648 | 454 | 468 | ||
1649 | 455 | @operation_parameters( | 469 | @operation_parameters( |
1652 | 456 | packageset=TextLine( | 470 | # Really IPackageset, corrected in _schema_circular_imports to avoid |
1653 | 457 | title=_("Package set"), required=True), | 471 | # circular import. |
1654 | 472 | packageset=Reference( | ||
1655 | 473 | Interface, title=_("Package set"), required=True), | ||
1656 | 458 | direct_permissions=Bool( | 474 | direct_permissions=Bool( |
1657 | 459 | title=_("Ignore package set hierarchy"), required=False)) | 475 | title=_("Ignore package set hierarchy"), required=False)) |
1658 | 460 | # Really IArchivePermission, set in _schema_circular_imports to avoid | 476 | # Really IArchivePermission, set in _schema_circular_imports to avoid |
1659 | @@ -464,7 +480,7 @@ | |||
1660 | 464 | def getUploadersForPackageset(packageset, direct_permissions=True): | 480 | def getUploadersForPackageset(packageset, direct_permissions=True): |
1661 | 465 | """The `ArchivePermission` records for uploaders to the package set. | 481 | """The `ArchivePermission` records for uploaders to the package set. |
1662 | 466 | 482 | ||
1664 | 467 | :param packageset: An `IPackageset` or a string package set name. | 483 | :param packageset: An `IPackageset`. |
1665 | 468 | :param direct_permissions: If True, only consider permissions granted | 484 | :param direct_permissions: If True, only consider permissions granted |
1666 | 469 | directly for the package set at hand. Otherwise, include any | 485 | directly for the package set at hand. Otherwise, include any |
1667 | 470 | uploaders for package sets that include this one. | 486 | uploaders for package sets that include this one. |
1668 | @@ -475,8 +491,10 @@ | |||
1669 | 475 | 491 | ||
1670 | 476 | @operation_parameters( | 492 | @operation_parameters( |
1671 | 477 | person=Reference(schema=IPerson), | 493 | person=Reference(schema=IPerson), |
1674 | 478 | packageset=TextLine( | 494 | # Really IPackageset, corrected in _schema_circular_imports to avoid |
1675 | 479 | title=_("Package set"), required=True), | 495 | # circular import. |
1676 | 496 | packageset=Reference( | ||
1677 | 497 | Interface, title=_("Package set"), required=True), | ||
1678 | 480 | explicit=Bool( | 498 | explicit=Bool( |
1679 | 481 | title=_("Explicit"), required=False)) | 499 | title=_("Explicit"), required=False)) |
1680 | 482 | @export_write_operation() | 500 | @export_write_operation() |
1681 | @@ -484,7 +502,7 @@ | |||
1682 | 484 | """Revoke upload permissions for a person. | 502 | """Revoke upload permissions for a person. |
1683 | 485 | 503 | ||
1684 | 486 | :param person: An `IPerson` for whom you want to revoke permission. | 504 | :param person: An `IPerson` for whom you want to revoke permission. |
1686 | 487 | :param packageset: An `IPackageset` or a string package set name. | 505 | :param packageset: An `IPackageset`. |
1687 | 488 | :param explicit: The value of the 'explicit' flag for the permission | 506 | :param explicit: The value of the 'explicit' flag for the permission |
1688 | 489 | to be revoked. | 507 | to be revoked. |
1689 | 490 | """ | 508 | """ |
1690 | @@ -567,9 +585,13 @@ | |||
1691 | 567 | @operation_parameters( | 585 | @operation_parameters( |
1692 | 568 | sourcepackagename=TextLine( | 586 | sourcepackagename=TextLine( |
1693 | 569 | title=_("Source package name"), required=True), | 587 | title=_("Source package name"), required=True), |
1695 | 570 | person=Reference(schema=IPerson)) | 588 | person=Reference(schema=IPerson), |
1696 | 589 | distroseries=Reference( | ||
1697 | 590 | # Really IDistroSeries, avoiding a circular import here. | ||
1698 | 591 | Interface, | ||
1699 | 592 | title=_("The distro series"), required=False)) | ||
1700 | 571 | @export_read_operation() | 593 | @export_read_operation() |
1702 | 572 | def isSourceUploadAllowed(sourcepackagename, person): | 594 | def isSourceUploadAllowed(sourcepackagename, person, distroseries=None): |
1703 | 573 | """True if the person is allowed to upload the given source package. | 595 | """True if the person is allowed to upload the given source package. |
1704 | 574 | 596 | ||
1705 | 575 | Return True if there exists a permission that combines | 597 | Return True if there exists a permission that combines |
1706 | @@ -585,6 +607,9 @@ | |||
1707 | 585 | either a string or a `ISourcePackageName`. | 607 | either a string or a `ISourcePackageName`. |
1708 | 586 | :param person: An `IPerson` for whom you want to find out which | 608 | :param person: An `IPerson` for whom you want to find out which |
1709 | 587 | package sets he has access to. | 609 | package sets he has access to. |
1710 | 610 | :param distroseries: The `IDistroSeries` for which to check | ||
1711 | 611 | permissions. If none is supplied then `currentseries` in | ||
1712 | 612 | Ubuntu is assumed. | ||
1713 | 588 | 613 | ||
1714 | 589 | :raises NoSuchSourcePackageName: if a source package with the | 614 | :raises NoSuchSourcePackageName: if a source package with the |
1715 | 590 | given name could not be found. | 615 | given name could not be found. |
1716 | 591 | 616 | ||
1717 | === modified file 'lib/lp/soyuz/interfaces/archivepermission.py' | |||
1718 | --- lib/lp/soyuz/interfaces/archivepermission.py 2009-08-03 17:10:12 +0000 | |||
1719 | +++ lib/lp/soyuz/interfaces/archivepermission.py 2009-11-03 18:13:41 +0000 | |||
1720 | @@ -258,7 +258,8 @@ | |||
1721 | 258 | archive in question. | 258 | archive in question. |
1722 | 259 | """ | 259 | """ |
1723 | 260 | 260 | ||
1725 | 261 | def isSourceUploadAllowed(archive, sourcepackagename, person): | 261 | def isSourceUploadAllowed( |
1726 | 262 | archive, sourcepackagename, person, distroseries=None): | ||
1727 | 262 | """True if the person is allowed to upload the given source package. | 263 | """True if the person is allowed to upload the given source package. |
1728 | 263 | 264 | ||
1729 | 264 | Return True if there exists a permission that combines | 265 | Return True if there exists a permission that combines |
1730 | @@ -275,6 +276,9 @@ | |||
1731 | 275 | either a string or a `ISourcePackageName`. | 276 | either a string or a `ISourcePackageName`. |
1732 | 276 | :param person: An `IPerson` for whom you want to find out which | 277 | :param person: An `IPerson` for whom you want to find out which |
1733 | 277 | package sets he has access to. | 278 | package sets he has access to. |
1734 | 279 | :param distroseries: The `IDistroSeries` for which to check | ||
1735 | 280 | permissions. If none is supplied then `currentseries` in | ||
1736 | 281 | Ubuntu is assumed. | ||
1737 | 278 | 282 | ||
1738 | 279 | :raises SourceNotFound: if a source package with the given | 283 | :raises SourceNotFound: if a source package with the given |
1739 | 280 | name could not be found. | 284 | name could not be found. |
1740 | @@ -284,6 +288,9 @@ | |||
1741 | 284 | def uploadersForPackageset(archive, packageset, direct_permissions=True): | 288 | def uploadersForPackageset(archive, packageset, direct_permissions=True): |
1742 | 285 | """The `ArchivePermission` records for uploaders to the package set. | 289 | """The `ArchivePermission` records for uploaders to the package set. |
1743 | 286 | 290 | ||
1744 | 291 | Please note: if a package set *name* is passed the respective | ||
1745 | 292 | package set in the current distro series will be used. | ||
1746 | 293 | |||
1747 | 287 | :param archive: The archive the permission applies to. | 294 | :param archive: The archive the permission applies to. |
1748 | 288 | :param packageset: An `IPackageset` or a string package set name. | 295 | :param packageset: An `IPackageset` or a string package set name. |
1749 | 289 | :param direct_permissions: If True only consider permissions granted | 296 | :param direct_permissions: If True only consider permissions granted |
1750 | @@ -332,6 +339,9 @@ | |||
1751 | 332 | def newPackagesetUploader(archive, person, packageset, explicit=False): | 339 | def newPackagesetUploader(archive, person, packageset, explicit=False): |
1752 | 333 | """Create and return a new `ArchivePermission` for an uploader. | 340 | """Create and return a new `ArchivePermission` for an uploader. |
1753 | 334 | 341 | ||
1754 | 342 | Please note: if a package set *name* is passed the respective | ||
1755 | 343 | package set in the current distro series will be used. | ||
1756 | 344 | |||
1757 | 335 | :param archive: The archive the permission applies to. | 345 | :param archive: The archive the permission applies to. |
1758 | 336 | :param person: An `IPerson` for whom you want to add permission. | 346 | :param person: An `IPerson` for whom you want to add permission. |
1759 | 337 | :param packageset: An `IPackageset` or a string package set name. | 347 | :param packageset: An `IPackageset` or a string package set name. |
1760 | @@ -379,6 +389,9 @@ | |||
1761 | 379 | def deletePackagesetUploader(archive, person, packageset, explicit=False): | 389 | def deletePackagesetUploader(archive, person, packageset, explicit=False): |
1762 | 380 | """Revoke upload permissions for a person. | 390 | """Revoke upload permissions for a person. |
1763 | 381 | 391 | ||
1764 | 392 | Please note: if a package set *name* is passed the respective | ||
1765 | 393 | package set in the current distro series will be used. | ||
1766 | 394 | |||
1767 | 382 | :param archive: The archive the permission applies to. | 395 | :param archive: The archive the permission applies to. |
1768 | 383 | :param person: An `IPerson` for whom you want to revoke permission. | 396 | :param person: An `IPerson` for whom you want to revoke permission. |
1769 | 384 | :param packageset: An `IPackageset` or a string package set name. | 397 | :param packageset: An `IPackageset` or a string package set name. |
1770 | 385 | 398 | ||
1771 | === modified file 'lib/lp/soyuz/interfaces/packageset.py' | |||
1772 | --- lib/lp/soyuz/interfaces/packageset.py 2009-07-25 16:33:39 +0000 | |||
1773 | +++ lib/lp/soyuz/interfaces/packageset.py 2009-11-03 18:13:41 +0000 | |||
1774 | @@ -8,6 +8,7 @@ | |||
1775 | 8 | __metaclass__ = type | 8 | __metaclass__ = type |
1776 | 9 | 9 | ||
1777 | 10 | __all__ = [ | 10 | __all__ = [ |
1778 | 11 | 'DuplicatePackagesetName', | ||
1779 | 11 | 'IPackageset', | 12 | 'IPackageset', |
1780 | 12 | 'IPackagesetSet', | 13 | 'IPackagesetSet', |
1781 | 13 | 'NoSuchPackageSet', | 14 | 'NoSuchPackageSet', |
1782 | @@ -26,14 +27,23 @@ | |||
1783 | 26 | operation_parameters, operation_returns_collection_of, | 27 | operation_parameters, operation_returns_collection_of, |
1784 | 27 | operation_returns_entry, webservice_error) | 28 | operation_returns_entry, webservice_error) |
1785 | 28 | from lazr.restful.fields import Reference | 29 | from lazr.restful.fields import Reference |
1786 | 30 | from lp.registry.interfaces.distroseries import IDistroSeries | ||
1787 | 29 | from lp.registry.interfaces.person import IPerson | 31 | from lp.registry.interfaces.person import IPerson |
1788 | 30 | from lp.registry.interfaces.role import IHasOwner | 32 | from lp.registry.interfaces.role import IHasOwner |
1789 | 33 | from lp.soyuz.interfaces.packagesetgroup import IPackagesetGroup | ||
1790 | 31 | 34 | ||
1791 | 32 | 35 | ||
1792 | 33 | class NoSuchPackageSet(NameLookupFailed): | 36 | class NoSuchPackageSet(NameLookupFailed): |
1793 | 34 | """Raised when we try to look up an PackageSet that doesn't exist.""" | 37 | """Raised when we try to look up an PackageSet that doesn't exist.""" |
1796 | 35 | webservice_error(400) #Bad request. | 38 | # Bad request. |
1797 | 36 | _message_prefix = "No such packageset" | 39 | webservice_error(400) |
1798 | 40 | _message_prefix = "No such package set (in the specified distro series)" | ||
1799 | 41 | |||
1800 | 42 | |||
1801 | 43 | class DuplicatePackagesetName(Exception): | ||
1802 | 44 | """Raised for packagesets with the same name and distroseries.""" | ||
1803 | 45 | # Bad request. | ||
1804 | 46 | webservice_error(400) | ||
1805 | 37 | 47 | ||
1806 | 38 | 48 | ||
1807 | 39 | class IPackagesetViewOnly(IHasOwner): | 49 | class IPackagesetViewOnly(IHasOwner): |
1808 | @@ -48,7 +58,7 @@ | |||
1809 | 48 | 58 | ||
1810 | 49 | owner = exported(Reference( | 59 | owner = exported(Reference( |
1811 | 50 | IPerson, title=_("Person"), required=True, readonly=True, | 60 | IPerson, title=_("Person"), required=True, readonly=True, |
1813 | 51 | description=_("The person who owns the package set at hand."))) | 61 | description=_("The person who owns this package set."))) |
1814 | 52 | 62 | ||
1815 | 53 | name = exported(TextLine( | 63 | name = exported(TextLine( |
1816 | 54 | title=_('Valid package set name'), | 64 | title=_('Valid package set name'), |
1817 | @@ -58,6 +68,18 @@ | |||
1818 | 58 | title=_("Description"), required=True, readonly=True, | 68 | title=_("Description"), required=True, readonly=True, |
1819 | 59 | description=_("The description for the package set at hand."))) | 69 | description=_("The description for the package set at hand."))) |
1820 | 60 | 70 | ||
1821 | 71 | distroseries = exported(Reference( | ||
1822 | 72 | IDistroSeries, title=_("Distribution series"), required=True, | ||
1823 | 73 | readonly=True, | ||
1824 | 74 | description=_( | ||
1825 | 75 | "The distroseries to which this package set is related."))) | ||
1826 | 76 | |||
1827 | 77 | packagesetgroup = Reference( | ||
1828 | 78 | IPackagesetGroup, title=_('Package set group'), required=True, | ||
1829 | 79 | readonly=True, | ||
1830 | 80 | description=_( | ||
1831 | 81 | 'Used internally to link package sets across distro series.')) | ||
1832 | 82 | |||
1833 | 61 | def sourcesIncluded(direct_inclusion=False): | 83 | def sourcesIncluded(direct_inclusion=False): |
1834 | 62 | """Get all source names associated with this package set. | 84 | """Get all source names associated with this package set. |
1835 | 63 | 85 | ||
1836 | @@ -195,6 +217,16 @@ | |||
1837 | 195 | names. | 217 | names. |
1838 | 196 | """ | 218 | """ |
1839 | 197 | 219 | ||
1840 | 220 | @operation_returns_collection_of(Interface) | ||
1841 | 221 | @export_read_operation() | ||
1842 | 222 | def relatedSets(): | ||
1843 | 223 | """Get all package sets related to this one. | ||
1844 | 224 | |||
1845 | 225 | Return all package sets that are related to this one. | ||
1846 | 226 | |||
1847 | 227 | :return: A (potentially empty) sequence of `IPackageset` instances. | ||
1848 | 228 | """ | ||
1849 | 229 | |||
1850 | 198 | 230 | ||
1851 | 199 | class IPackagesetEdit(Interface): | 231 | class IPackagesetEdit(Interface): |
1852 | 200 | """A writeable interface for package sets.""" | 232 | """A writeable interface for package sets.""" |
1853 | @@ -316,15 +348,31 @@ | |||
1854 | 316 | title=_('Package set description'), required=True), | 348 | title=_('Package set description'), required=True), |
1855 | 317 | owner=Reference( | 349 | owner=Reference( |
1856 | 318 | IPerson, title=_("Person"), required=True, readonly=True, | 350 | IPerson, title=_("Person"), required=True, readonly=True, |
1858 | 319 | description=_("The person who owns the package set at hand."))) | 351 | description=_("The person who owns this package set.")), |
1859 | 352 | distroseries=Reference( | ||
1860 | 353 | IDistroSeries, title=_("Distroseries"), required=False, | ||
1861 | 354 | readonly=True, description=_( | ||
1862 | 355 | "The distribution series to which the packageset " | ||
1863 | 356 | "is related.")), | ||
1864 | 357 | related_set=Reference( | ||
1865 | 358 | IPackageset, title=_("Related package set"), required=False, | ||
1866 | 359 | readonly=True, description=_( | ||
1867 | 360 | "The new package set will share the package set group " | ||
1868 | 361 | "with this one."))) | ||
1869 | 320 | @export_factory_operation(IPackageset, []) | 362 | @export_factory_operation(IPackageset, []) |
1871 | 321 | def new(name, description, owner): | 363 | def new(name, description, owner, distroseries=None, related_set=None): |
1872 | 322 | """Create a new package set. | 364 | """Create a new package set. |
1873 | 323 | 365 | ||
1874 | 324 | :param name: the name of the package set to be created. | 366 | :param name: the name of the package set to be created. |
1875 | 325 | :param description: the description for the package set to be created. | 367 | :param description: the description for the package set to be created. |
1876 | 326 | :param owner: the owner of the package set to be created. | 368 | :param owner: the owner of the package set to be created. |
1877 | 369 | :param distroseries: the distroseries to which the new packageset | ||
1878 | 370 | is related. Defaults to the current Ubuntu series. | ||
1879 | 371 | :param related_set: the newly created package set is to be related to | ||
1880 | 372 | `related_set` (by being placed in the same package group). | ||
1881 | 327 | 373 | ||
1882 | 374 | :raises DuplicatePackagesetName: if a package set with the same `name` | ||
1883 | 375 | exists in `distroseries` already. | ||
1884 | 328 | :return: a newly created `IPackageset`. | 376 | :return: a newly created `IPackageset`. |
1885 | 329 | """ | 377 | """ |
1886 | 330 | 378 | ||
1887 | @@ -332,10 +380,12 @@ | |||
1888 | 332 | name=TextLine(title=_('Package set name'), required=True)) | 380 | name=TextLine(title=_('Package set name'), required=True)) |
1889 | 333 | @operation_returns_entry(IPackageset) | 381 | @operation_returns_entry(IPackageset) |
1890 | 334 | @export_read_operation() | 382 | @export_read_operation() |
1892 | 335 | def getByName(name): | 383 | def getByName(name, distroseries=None): |
1893 | 336 | """Return the single package set with the given name (if any). | 384 | """Return the single package set with the given name (if any). |
1894 | 337 | 385 | ||
1895 | 338 | :param name: the name of the package set sought. | 386 | :param name: the name of the package set sought. |
1896 | 387 | :param distroseries: the distroseries to which the new packageset | ||
1897 | 388 | is related. Defaults to the current Ubuntu series. | ||
1898 | 339 | 389 | ||
1899 | 340 | :return: An `IPackageset` instance or None. | 390 | :return: An `IPackageset` instance or None. |
1900 | 341 | """ | 391 | """ |
1901 | 342 | 392 | ||
1902 | === added file 'lib/lp/soyuz/interfaces/packagesetgroup.py' | |||
1903 | --- lib/lp/soyuz/interfaces/packagesetgroup.py 1970-01-01 00:00:00 +0000 | |||
1904 | +++ lib/lp/soyuz/interfaces/packagesetgroup.py 2009-11-03 18:13:43 +0000 | |||
1905 | @@ -0,0 +1,41 @@ | |||
1906 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | ||
1907 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
1908 | 3 | |||
1909 | 4 | """Packageset Group interface.""" | ||
1910 | 5 | |||
1911 | 6 | __metaclass__ = type | ||
1912 | 7 | |||
1913 | 8 | __all__ = [ | ||
1914 | 9 | 'IPackagesetGroup', | ||
1915 | 10 | ] | ||
1916 | 11 | |||
1917 | 12 | from zope.schema import Datetime, Int | ||
1918 | 13 | |||
1919 | 14 | from lazr.restful.fields import Reference | ||
1920 | 15 | |||
1921 | 16 | from canonical.launchpad import _ | ||
1922 | 17 | from lp.registry.interfaces.person import IPerson | ||
1923 | 18 | from lp.registry.interfaces.role import IHasOwner | ||
1924 | 19 | |||
1925 | 20 | |||
1926 | 21 | class IPackagesetGroup(IHasOwner): | ||
1927 | 22 | """A group of related package sets across distroseries' | ||
1928 | 23 | |||
1929 | 24 | This class is used internally to group related packagesets across | ||
1930 | 25 | distroseries. For example, if in Karmic there is a 'gnome-games' | ||
1931 | 26 | package set, and this package set is cloned initially for Lucid, | ||
1932 | 27 | then both packagesets would refer to the same packageset-group. | ||
1933 | 28 | |||
1934 | 29 | Packageset-groups are not exposed at all. The date_created and | ||
1935 | 30 | owner fields are present for internal use only. | ||
1936 | 31 | """ | ||
1937 | 32 | id = Int(title=_('ID'), required=True, readonly=True) | ||
1938 | 33 | |||
1939 | 34 | date_created = Datetime( | ||
1940 | 35 | title=_("Date Created"), required=True, readonly=True, | ||
1941 | 36 | description=_("The creation date/time for this packageset group.")) | ||
1942 | 37 | |||
1943 | 38 | owner = Reference( | ||
1944 | 39 | IPerson, title=_("Person"), required=True, readonly=True, | ||
1945 | 40 | description=_("The person who created this packageset group.")) | ||
1946 | 41 | |||
1947 | 0 | 42 | ||
1948 | === modified file 'lib/lp/soyuz/model/archive.py' | |||
1949 | --- lib/lp/soyuz/model/archive.py 2009-10-26 09:43:56 +0000 | |||
1950 | +++ lib/lp/soyuz/model/archive.py 2009-11-03 18:13:42 +0000 | |||
1951 | @@ -174,6 +174,12 @@ | |||
1952 | 174 | relative_build_score = IntCol( | 174 | relative_build_score = IntCol( |
1953 | 175 | dbName='relative_build_score', notNull=True, default=0) | 175 | dbName='relative_build_score', notNull=True, default=0) |
1954 | 176 | 176 | ||
1955 | 177 | # This field is specifically and only intended for OEM migration to | ||
1956 | 178 | # Launchpad and should be re-examined in October 2010 to see if it | ||
1957 | 179 | # is still relevant. | ||
1958 | 180 | external_dependencies = StringCol( | ||
1959 | 181 | dbName='external_dependencies', notNull=False, default=None) | ||
1960 | 182 | |||
1961 | 177 | def _init(self, *args, **kw): | 183 | def _init(self, *args, **kw): |
1962 | 178 | """Provide the right interface for URL traversal.""" | 184 | """Provide the right interface for URL traversal.""" |
1963 | 179 | SQLBase._init(self, *args, **kw) | 185 | SQLBase._init(self, *args, **kw) |
1964 | @@ -998,11 +1004,12 @@ | |||
1965 | 998 | return permission_set.packagesetsForSource( | 1004 | return permission_set.packagesetsForSource( |
1966 | 999 | self, sourcepackagename, direct_permissions) | 1005 | self, sourcepackagename, direct_permissions) |
1967 | 1000 | 1006 | ||
1969 | 1001 | def isSourceUploadAllowed(self, sourcepackagename, person): | 1007 | def isSourceUploadAllowed( |
1970 | 1008 | self, sourcepackagename, person, distroseries=None): | ||
1971 | 1002 | """See `IArchive`.""" | 1009 | """See `IArchive`.""" |
1972 | 1003 | permission_set = getUtility(IArchivePermissionSet) | 1010 | permission_set = getUtility(IArchivePermissionSet) |
1973 | 1004 | return permission_set.isSourceUploadAllowed( | 1011 | return permission_set.isSourceUploadAllowed( |
1975 | 1005 | self, sourcepackagename, person) | 1012 | self, sourcepackagename, person, distroseries) |
1976 | 1006 | 1013 | ||
1977 | 1007 | def getFileByName(self, filename): | 1014 | def getFileByName(self, filename): |
1978 | 1008 | """See `IArchive`.""" | 1015 | """See `IArchive`.""" |
1979 | 1009 | 1016 | ||
1980 | === modified file 'lib/lp/soyuz/model/archivepermission.py' | |||
1981 | --- lib/lp/soyuz/model/archivepermission.py 2009-07-28 21:52:56 +0000 | |||
1982 | +++ lib/lp/soyuz/model/archivepermission.py 2009-11-03 18:13:43 +0000 | |||
1983 | @@ -22,6 +22,7 @@ | |||
1984 | 22 | from canonical.database.enumcol import EnumCol | 22 | from canonical.database.enumcol import EnumCol |
1985 | 23 | from canonical.database.sqlbase import sqlvalues, SQLBase | 23 | from canonical.database.sqlbase import sqlvalues, SQLBase |
1986 | 24 | 24 | ||
1987 | 25 | from lp.registry.interfaces.distribution import IDistributionSet | ||
1988 | 25 | from lp.soyuz.interfaces.archive import ComponentNotFound | 26 | from lp.soyuz.interfaces.archive import ComponentNotFound |
1989 | 26 | from lp.soyuz.interfaces.archivepermission import ( | 27 | from lp.soyuz.interfaces.archivepermission import ( |
1990 | 27 | ArchivePermissionType, IArchivePermission, IArchivePermissionSet, | 28 | ArchivePermissionType, IArchivePermission, IArchivePermissionSet, |
1991 | @@ -312,9 +313,13 @@ | |||
1992 | 312 | def _nameToPackageset(self, packageset): | 313 | def _nameToPackageset(self, packageset): |
1993 | 313 | """Helper to convert a possible string name to IPackageset.""" | 314 | """Helper to convert a possible string name to IPackageset.""" |
1994 | 314 | if isinstance(packageset, basestring): | 315 | if isinstance(packageset, basestring): |
1995 | 316 | # A package set name was passed, assume the current distro series. | ||
1996 | 317 | ubuntu = getUtility(IDistributionSet).getByName('ubuntu') | ||
1997 | 315 | name = packageset | 318 | name = packageset |
1998 | 316 | store = IStore(Packageset) | 319 | store = IStore(Packageset) |
2000 | 317 | packageset = store.find(Packageset, name=name).one() | 320 | packageset = store.find( |
2001 | 321 | Packageset, name=name, | ||
2002 | 322 | distroseries=ubuntu.currentseries).one() | ||
2003 | 318 | if packageset is not None: | 323 | if packageset is not None: |
2004 | 319 | return packageset | 324 | return packageset |
2005 | 320 | else: | 325 | else: |
2006 | @@ -475,48 +480,56 @@ | |||
2007 | 475 | ''', (sourcepackagename.id, archive.id))) | 480 | ''', (sourcepackagename.id, archive.id))) |
2008 | 476 | return rset | 481 | return rset |
2009 | 477 | 482 | ||
2011 | 478 | def isSourceUploadAllowed(self, archive, sourcepackagename, person): | 483 | def isSourceUploadAllowed( |
2012 | 484 | self, archive, sourcepackagename, person, distroseries=None): | ||
2013 | 479 | """See `IArchivePermissionSet`.""" | 485 | """See `IArchivePermissionSet`.""" |
2014 | 480 | sourcepackagename = self._nameToSourcePackageName(sourcepackagename) | 486 | sourcepackagename = self._nameToSourcePackageName(sourcepackagename) |
2015 | 481 | store = IStore(ArchivePermission) | 487 | store = IStore(ArchivePermission) |
2016 | 488 | if distroseries is None: | ||
2017 | 489 | ubuntu = getUtility(IDistributionSet).getByName('ubuntu') | ||
2018 | 490 | distroseries = ubuntu.currentseries | ||
2019 | 482 | 491 | ||
2020 | 483 | # Put together the parameters for the query that follows. | 492 | # Put together the parameters for the query that follows. |
2021 | 484 | archive_params = (ArchivePermissionType.UPLOAD, archive.id) | 493 | archive_params = (ArchivePermissionType.UPLOAD, archive.id) |
2022 | 494 | permission_params = (sourcepackagename.id, person.id, distroseries.id) | ||
2023 | 485 | query_params = ( | 495 | query_params = ( |
2024 | 486 | # Query parameters for the first WHERE clause. | 496 | # Query parameters for the first WHERE clause. |
2026 | 487 | (archive.id, sourcepackagename.id) + | 497 | (archive.id, distroseries.id, sourcepackagename.id) + |
2027 | 488 | # Query parameters for the second WHERE clause. | 498 | # Query parameters for the second WHERE clause. |
2029 | 489 | (sourcepackagename.id,) + (person.id,) + archive_params + | 499 | permission_params + archive_params + |
2030 | 490 | # Query parameters for the third WHERE clause. | 500 | # Query parameters for the third WHERE clause. |
2032 | 491 | (sourcepackagename.id,) + (person.id,) + archive_params) | 501 | permission_params + archive_params) |
2033 | 492 | 502 | ||
2034 | 493 | query = ''' | 503 | query = ''' |
2035 | 494 | SELECT CASE | 504 | SELECT CASE |
2036 | 495 | WHEN ( | 505 | WHEN ( |
2037 | 496 | SELECT COUNT(ap.id) | 506 | SELECT COUNT(ap.id) |
2039 | 497 | FROM packagesetsources pss, archivepermission ap | 507 | FROM packagesetsources pss, archivepermission ap, packageset ps |
2040 | 498 | WHERE | 508 | WHERE |
2041 | 499 | ap.archive = %s AND ap.explicit = TRUE | 509 | ap.archive = %s AND ap.explicit = TRUE |
2042 | 510 | AND ap.packageset = ps.id AND ps.distroseries = %s | ||
2043 | 500 | AND pss.sourcepackagename = %s | 511 | AND pss.sourcepackagename = %s |
2044 | 501 | AND pss.packageset = ap.packageset) > 0 | 512 | AND pss.packageset = ap.packageset) > 0 |
2045 | 502 | THEN ( | 513 | THEN ( |
2046 | 503 | SELECT COUNT(ap.id) | 514 | SELECT COUNT(ap.id) |
2047 | 504 | FROM | 515 | FROM |
2049 | 505 | packagesetsources pss, archivepermission ap, | 516 | packagesetsources pss, archivepermission ap, packageset ps, |
2050 | 506 | teamparticipation tp | 517 | teamparticipation tp |
2051 | 507 | WHERE | 518 | WHERE |
2052 | 508 | pss.sourcepackagename = %s | 519 | pss.sourcepackagename = %s |
2053 | 509 | AND ap.person = tp.team AND tp.person = %s | 520 | AND ap.person = tp.team AND tp.person = %s |
2054 | 521 | AND ap.packageset = ps.id AND ps.distroseries = %s | ||
2055 | 510 | AND pss.packageset = ap.packageset AND ap.explicit = TRUE | 522 | AND pss.packageset = ap.packageset AND ap.explicit = TRUE |
2056 | 511 | AND ap.permission = %s AND ap.archive = %s) | 523 | AND ap.permission = %s AND ap.archive = %s) |
2057 | 512 | ELSE ( | 524 | ELSE ( |
2058 | 513 | SELECT COUNT(ap.id) | 525 | SELECT COUNT(ap.id) |
2059 | 514 | FROM | 526 | FROM |
2061 | 515 | packagesetsources pss, archivepermission ap, | 527 | packagesetsources pss, archivepermission ap, packageset ps, |
2062 | 516 | teamparticipation tp, flatpackagesetinclusion fpsi | 528 | teamparticipation tp, flatpackagesetinclusion fpsi |
2063 | 517 | WHERE | 529 | WHERE |
2064 | 518 | pss.sourcepackagename = %s | 530 | pss.sourcepackagename = %s |
2065 | 519 | AND ap.person = tp.team AND tp.person = %s | 531 | AND ap.person = tp.team AND tp.person = %s |
2066 | 532 | AND ap.packageset = ps.id AND ps.distroseries = %s | ||
2067 | 520 | AND pss.packageset = fpsi.child AND fpsi.parent = ap.packageset | 533 | AND pss.packageset = fpsi.child AND fpsi.parent = ap.packageset |
2068 | 521 | AND ap.permission = %s AND ap.archive = %s) | 534 | AND ap.permission = %s AND ap.archive = %s) |
2069 | 522 | END AS number_of_permitted_package_sets; | 535 | END AS number_of_permitted_package_sets; |
2070 | 523 | 536 | ||
2071 | === modified file 'lib/lp/soyuz/model/packageset.py' | |||
2072 | --- lib/lp/soyuz/model/packageset.py 2009-07-25 16:33:39 +0000 | |||
2073 | +++ lib/lp/soyuz/model/packageset.py 2009-11-03 18:13:42 +0000 | |||
2074 | @@ -6,6 +6,7 @@ | |||
2075 | 6 | 6 | ||
2076 | 7 | import pytz | 7 | import pytz |
2077 | 8 | 8 | ||
2078 | 9 | from storm.exceptions import IntegrityError | ||
2079 | 9 | from storm.expr import In, SQL | 10 | from storm.expr import In, SQL |
2080 | 10 | from storm.locals import DateTime, Int, Reference, Storm, Unicode | 11 | from storm.locals import DateTime, Int, Reference, Storm, Unicode |
2081 | 11 | 12 | ||
2082 | @@ -13,12 +14,14 @@ | |||
2083 | 13 | from zope.interface import implements | 14 | from zope.interface import implements |
2084 | 14 | 15 | ||
2085 | 15 | from canonical.launchpad.interfaces.lpstorm import IMasterStore, IStore | 16 | from canonical.launchpad.interfaces.lpstorm import IMasterStore, IStore |
2086 | 17 | from canonical.launchpad.webapp.interfaces import NotFoundError | ||
2087 | 18 | from lp.registry.interfaces.distribution import IDistributionSet | ||
2088 | 16 | from lp.registry.interfaces.sourcepackagename import ( | 19 | from lp.registry.interfaces.sourcepackagename import ( |
2089 | 17 | ISourcePackageName, ISourcePackageNameSet) | 20 | ISourcePackageName, ISourcePackageNameSet) |
2090 | 18 | from lp.registry.model.sourcepackagename import SourcePackageName | 21 | from lp.registry.model.sourcepackagename import SourcePackageName |
2091 | 19 | from lp.soyuz.interfaces.packageset import ( | 22 | from lp.soyuz.interfaces.packageset import ( |
2094 | 20 | IPackageset, IPackagesetSet, NoSuchPackageSet) | 23 | DuplicatePackagesetName, IPackageset, IPackagesetSet, NoSuchPackageSet) |
2095 | 21 | 24 | from lp.soyuz.model.packagesetgroup import PackagesetGroup | |
2096 | 22 | 25 | ||
2097 | 23 | def _order_result_set(result_set): | 26 | def _order_result_set(result_set): |
2098 | 24 | """Default order for package set and source package name result sets.""" | 27 | """Default order for package set and source package name result sets.""" |
2099 | @@ -45,6 +48,12 @@ | |||
2100 | 45 | name = Unicode(name='name', allow_none=False) | 48 | name = Unicode(name='name', allow_none=False) |
2101 | 46 | description = Unicode(name='description', allow_none=False) | 49 | description = Unicode(name='description', allow_none=False) |
2102 | 47 | 50 | ||
2103 | 51 | distroseries_id = Int(name='distroseries', allow_none=False) | ||
2104 | 52 | distroseries = Reference(distroseries_id, 'DistroSeries.id') | ||
2105 | 53 | |||
2106 | 54 | packagesetgroup_id = Int(name='packagesetgroup', allow_none=False) | ||
2107 | 55 | packagesetgroup = Reference(packagesetgroup_id, 'PackagesetGroup.id') | ||
2108 | 56 | |||
2109 | 48 | def add(self, data): | 57 | def add(self, data): |
2110 | 49 | """See `IPackageset`.""" | 58 | """See `IPackageset`.""" |
2111 | 50 | handlers = ( | 59 | handlers = ( |
2112 | @@ -279,41 +288,101 @@ | |||
2113 | 279 | 288 | ||
2114 | 280 | def addSubsets(self, names): | 289 | def addSubsets(self, names): |
2115 | 281 | """See `IPackageset`.""" | 290 | """See `IPackageset`.""" |
2117 | 282 | clauses = (Packageset, In(Packageset.name, names)) | 291 | clauses = ( |
2118 | 292 | Packageset, In(Packageset.name, names), | ||
2119 | 293 | Packageset.distroseries == self.distroseries) | ||
2120 | 283 | self._api_add_or_remove(clauses, self._addDirectSuccessors) | 294 | self._api_add_or_remove(clauses, self._addDirectSuccessors) |
2121 | 284 | 295 | ||
2122 | 285 | def removeSubsets(self, names): | 296 | def removeSubsets(self, names): |
2123 | 286 | """See `IPackageset`.""" | 297 | """See `IPackageset`.""" |
2125 | 287 | clauses = (Packageset, In(Packageset.name, names)) | 298 | clauses = ( |
2126 | 299 | Packageset, In(Packageset.name, names), | ||
2127 | 300 | Packageset.distroseries == self.distroseries) | ||
2128 | 288 | self._api_add_or_remove(clauses, self._removeDirectSuccessors) | 301 | self._api_add_or_remove(clauses, self._removeDirectSuccessors) |
2129 | 289 | 302 | ||
2130 | 303 | def relatedSets(self): | ||
2131 | 304 | """See `IPackageset`.""" | ||
2132 | 305 | store = IStore(Packageset) | ||
2133 | 306 | result_set = store.find( | ||
2134 | 307 | Packageset, | ||
2135 | 308 | Packageset.packagesetgroup == self.packagesetgroup, | ||
2136 | 309 | Packageset.id != self.id) | ||
2137 | 310 | return _order_result_set(result_set) | ||
2138 | 311 | |||
2139 | 290 | 312 | ||
2140 | 291 | class PackagesetSet: | 313 | class PackagesetSet: |
2141 | 292 | """See `IPackagesetSet`.""" | 314 | """See `IPackagesetSet`.""" |
2142 | 293 | implements(IPackagesetSet) | 315 | implements(IPackagesetSet) |
2143 | 294 | 316 | ||
2145 | 295 | def new(self, name, description, owner): | 317 | def new( |
2146 | 318 | self, name, description, owner, distroseries=None, related_set=None): | ||
2147 | 296 | """See `IPackagesetSet`.""" | 319 | """See `IPackagesetSet`.""" |
2148 | 297 | store = IMasterStore(Packageset) | 320 | store = IMasterStore(Packageset) |
2149 | 321 | |||
2150 | 322 | packagesetgroup = None | ||
2151 | 323 | if related_set is not None: | ||
2152 | 324 | # Use the packagesetgroup of the `related_set`. | ||
2153 | 325 | packagesetgroup = related_set.packagesetgroup | ||
2154 | 326 | else: | ||
2155 | 327 | # We create the related internal PackagesetGroup for this | ||
2156 | 328 | # packageset so that we can later see related package sets across | ||
2157 | 329 | # distroserieses. | ||
2158 | 330 | packagesetgroup = PackagesetGroup() | ||
2159 | 331 | packagesetgroup.owner = owner | ||
2160 | 332 | store.add(packagesetgroup) | ||
2161 | 333 | |||
2162 | 334 | if distroseries is None: | ||
2163 | 335 | ubuntu = getUtility(IDistributionSet).getByName('ubuntu') | ||
2164 | 336 | distroseries = ubuntu.currentseries | ||
2165 | 337 | |||
2166 | 298 | packageset = Packageset() | 338 | packageset = Packageset() |
2167 | 339 | packageset.packagesetgroup = packagesetgroup | ||
2168 | 299 | packageset.name = name | 340 | packageset.name = name |
2169 | 300 | packageset.description = description | 341 | packageset.description = description |
2170 | 301 | packageset.owner = owner | 342 | packageset.owner = owner |
2171 | 343 | |||
2172 | 344 | packageset.distroseries = distroseries | ||
2173 | 345 | |||
2174 | 302 | store.add(packageset) | 346 | store.add(packageset) |
2175 | 347 | |||
2176 | 348 | # We need to ensure that the cached statements are flushed so that | ||
2177 | 349 | # the duplicate name constraint gets triggered here. | ||
2178 | 350 | try: | ||
2179 | 351 | store.flush() | ||
2180 | 352 | except IntegrityError: | ||
2181 | 353 | raise DuplicatePackagesetName() | ||
2182 | 354 | |||
2183 | 303 | return packageset | 355 | return packageset |
2184 | 304 | 356 | ||
2185 | 305 | def __getitem__(self, name): | 357 | def __getitem__(self, name): |
2186 | 306 | """See `IPackagesetSet`.""" | 358 | """See `IPackagesetSet`.""" |
2187 | 307 | return self.getByName(name) | 359 | return self.getByName(name) |
2188 | 308 | 360 | ||
2190 | 309 | def getByName(self, name): | 361 | def getByName(self, name, distroseries=None): |
2191 | 310 | """See `IPackagesetSet`.""" | 362 | """See `IPackagesetSet`.""" |
2192 | 311 | store = IStore(Packageset) | 363 | store = IStore(Packageset) |
2193 | 312 | if not isinstance(name, unicode): | 364 | if not isinstance(name, unicode): |
2194 | 313 | name = unicode(name, 'utf-8') | 365 | name = unicode(name, 'utf-8') |
2196 | 314 | package_set = store.find(Packageset, Packageset.name == name).one() | 366 | |
2197 | 367 | ubuntu = getUtility(IDistributionSet).getByName('ubuntu') | ||
2198 | 368 | extra_args = [] | ||
2199 | 369 | if distroseries is not None: | ||
2200 | 370 | # If the user just passed a distro series name, look it up. | ||
2201 | 371 | if isinstance(distroseries, basestring): | ||
2202 | 372 | try: | ||
2203 | 373 | distroseries = ubuntu[distroseries] | ||
2204 | 374 | except NotFoundError: | ||
2205 | 375 | raise NoSuchPackageSet(distroseries) | ||
2206 | 376 | extra_args.append(Packageset.distroseries == distroseries) | ||
2207 | 377 | else: | ||
2208 | 378 | extra_args.append(Packageset.distroseries == ubuntu.currentseries) | ||
2209 | 379 | |||
2210 | 380 | package_set = store.find( | ||
2211 | 381 | Packageset, Packageset.name == name, *extra_args).one() | ||
2212 | 382 | |||
2213 | 315 | if package_set is None: | 383 | if package_set is None: |
2214 | 316 | raise NoSuchPackageSet(name) | 384 | raise NoSuchPackageSet(name) |
2215 | 385 | |||
2216 | 317 | return package_set | 386 | return package_set |
2217 | 318 | 387 | ||
2218 | 319 | def getByOwner(self, owner): | 388 | def getByOwner(self, owner): |
2219 | 320 | 389 | ||
2220 | === added file 'lib/lp/soyuz/model/packagesetgroup.py' | |||
2221 | --- lib/lp/soyuz/model/packagesetgroup.py 1970-01-01 00:00:00 +0000 | |||
2222 | +++ lib/lp/soyuz/model/packagesetgroup.py 2009-11-03 18:13:41 +0000 | |||
2223 | @@ -0,0 +1,30 @@ | |||
2224 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | ||
2225 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
2226 | 3 | |||
2227 | 4 | __metaclass__ = type | ||
2228 | 5 | |||
2229 | 6 | __all__ = [ | ||
2230 | 7 | 'PackagesetGroup', | ||
2231 | 8 | ] | ||
2232 | 9 | |||
2233 | 10 | import pytz | ||
2234 | 11 | |||
2235 | 12 | from storm.locals import DateTime, Int, Reference, Storm | ||
2236 | 13 | |||
2237 | 14 | from zope.interface import implements | ||
2238 | 15 | |||
2239 | 16 | from lp.soyuz.interfaces.packagesetgroup import IPackagesetGroup | ||
2240 | 17 | |||
2241 | 18 | |||
2242 | 19 | class PackagesetGroup(Storm): | ||
2243 | 20 | """See `IPackageset`.""" | ||
2244 | 21 | implements(IPackagesetGroup) | ||
2245 | 22 | __storm_table__ = 'PackagesetGroup' | ||
2246 | 23 | id = Int(primary=True) | ||
2247 | 24 | |||
2248 | 25 | date_created = DateTime( | ||
2249 | 26 | name='date_created', allow_none=False, tzinfo=pytz.UTC) | ||
2250 | 27 | |||
2251 | 28 | owner_id = Int(name='owner', allow_none=False) | ||
2252 | 29 | owner = Reference(owner_id, 'Person.id') | ||
2253 | 30 | |||
2254 | 0 | 31 | ||
2255 | === modified file 'lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt' | |||
2256 | --- lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt 2009-10-13 10:05:58 +0000 | |||
2257 | +++ lib/lp/soyuz/stories/ppa/xx-ppa-workflow.txt 2009-11-03 18:13:40 +0000 | |||
2258 | @@ -354,6 +354,7 @@ | |||
2259 | 354 | * Set a maximum disk size: uploads will be rejected if the resulting | 354 | * Set a maximum disk size: uploads will be rejected if the resulting |
2260 | 355 | PPA size is exceeding the authorized size. | 355 | PPA size is exceeding the authorized size. |
2261 | 356 | * Set a per-archive build score delta. | 356 | * Set a per-archive build score delta. |
2262 | 357 | * Set external archive dependencies | ||
2263 | 357 | 358 | ||
2264 | 358 | In this case, the administrator may wish to amend the PPA so that it is | 359 | In this case, the administrator may wish to amend the PPA so that it is |
2265 | 359 | set up like the ubuntu security PPA, which is private but does not | 360 | set up like the ubuntu security PPA, which is private but does not |
2266 | @@ -367,6 +368,8 @@ | |||
2267 | 367 | True | 368 | True |
2268 | 368 | >>> admin_browser.getControl(name="field.relative_build_score").value | 369 | >>> admin_browser.getControl(name="field.relative_build_score").value |
2269 | 369 | '0' | 370 | '0' |
2270 | 371 | >>> admin_browser.getControl(name="field.external_dependencies").value | ||
2271 | 372 | '' | ||
2272 | 370 | 373 | ||
2273 | 371 | >>> admin_browser.getControl(name="field.enabled").value = False | 374 | >>> admin_browser.getControl(name="field.enabled").value = False |
2274 | 372 | >>> admin_browser.getControl(name="field.private").value = True | 375 | >>> admin_browser.getControl(name="field.private").value = True |
2275 | @@ -376,6 +379,9 @@ | |||
2276 | 376 | >>> admin_browser.getControl(name="field.authorized_size").value = '1' | 379 | >>> admin_browser.getControl(name="field.authorized_size").value = '1' |
2277 | 377 | >>> admin_browser.getControl( | 380 | >>> admin_browser.getControl( |
2278 | 378 | ... name="field.relative_build_score").value = '199' | 381 | ... name="field.relative_build_score").value = '199' |
2279 | 382 | >>> admin_browser.getControl( | ||
2280 | 383 | ... name="field.external_dependencies" | ||
2281 | 384 | ... ).value = "deb http://my.spethial.repo.com/ %(series)s main" | ||
2282 | 379 | >>> admin_browser.getControl("Save").click() | 385 | >>> admin_browser.getControl("Save").click() |
2283 | 380 | 386 | ||
2284 | 381 | Once confirmed the administrator is sent to the PPA page where he can | 387 | Once confirmed the administrator is sent to the PPA page where he can |
2285 | @@ -388,16 +394,33 @@ | |||
2286 | 388 | ... print msg | 394 | ... print msg |
2287 | 389 | This archive has been disabled. | 395 | This archive has been disabled. |
2288 | 390 | 396 | ||
2291 | 391 | We need go back to the "Administer archive" page to see the build score change | 397 | We need go back to the "Administer archive" page to see the build score and |
2292 | 392 | that was made: | 398 | external dependencies changes that were made: |
2293 | 393 | 399 | ||
2294 | 394 | >>> admin_browser.getLink("Administer archive").click() | 400 | >>> admin_browser.getLink("Administer archive").click() |
2295 | 395 | >>> admin_browser.getControl(name="field.relative_build_score").value | 401 | >>> admin_browser.getControl(name="field.relative_build_score").value |
2296 | 396 | '199' | 402 | '199' |
2297 | 403 | >>> admin_browser.getControl(name="field.external_dependencies").value | ||
2298 | 404 | 'deb http://my.spethial.repo.com/ %(series)s main' | ||
2299 | 405 | |||
2300 | 406 | The external dependencies field is validated to make sure it looks like | ||
2301 | 407 | a sources.list entry. If the field fails validation an error is displayed. | ||
2302 | 408 | |||
2303 | 409 | >>> admin_browser.getControl( | ||
2304 | 410 | ... name="field.external_dependencies" | ||
2305 | 411 | ... ).value = "deb not_a_url" | ||
2306 | 412 | >>> admin_browser.getControl("Save").click() | ||
2307 | 413 | >>> for error in get_feedback_messages(admin_browser.contents): | ||
2308 | 414 | ... print error | ||
2309 | 415 | There is 1 error. | ||
2310 | 416 | 'deb not_a_url' is not a complete and valid sources.list entry | ||
2311 | 417 | |||
2312 | 397 | 418 | ||
2313 | 398 | When the archive is private, the buildd secret must also be set, or an | 419 | When the archive is private, the buildd secret must also be set, or an |
2314 | 399 | error is issued: | 420 | error is issued: |
2315 | 400 | 421 | ||
2316 | 422 | >>> admin_browser.getControl( | ||
2317 | 423 | ... name="field.external_dependencies").value = "" | ||
2318 | 401 | >>> admin_browser.getControl(name="field.private").value = True | 424 | >>> admin_browser.getControl(name="field.private").value = True |
2319 | 402 | >>> admin_browser.getControl(name="field.buildd_secret").value = "" | 425 | >>> admin_browser.getControl(name="field.buildd_secret").value = "" |
2320 | 403 | >>> admin_browser.getControl("Save").click() | 426 | >>> admin_browser.getControl("Save").click() |
2321 | 404 | 427 | ||
2322 | === modified file 'lib/lp/soyuz/stories/webservice/xx-packageset.txt' | |||
2323 | --- lib/lp/soyuz/stories/webservice/xx-packageset.txt 2009-08-20 04:46:48 +0000 | |||
2324 | +++ lib/lp/soyuz/stories/webservice/xx-packageset.txt 2009-11-03 18:13:41 +0000 | |||
2325 | @@ -18,6 +18,9 @@ | |||
2326 | 18 | Please refer to the tests contained in the file above if you are really | 18 | Please refer to the tests contained in the file above if you are really |
2327 | 19 | interested in package sets and the complete functionality they offer. | 19 | interested in package sets and the complete functionality they offer. |
2328 | 20 | 20 | ||
2329 | 21 | |||
2330 | 22 | == General package set properties == | ||
2331 | 23 | |||
2332 | 21 | We start off by creating an 'umbrella' package set that will include all | 24 | We start off by creating an 'umbrella' package set that will include all |
2333 | 22 | source packages. | 25 | source packages. |
2334 | 23 | 26 | ||
2335 | @@ -52,16 +55,16 @@ | |||
2336 | 52 | Can we access it via the webservice API as well? | 55 | Can we access it via the webservice API as well? |
2337 | 53 | 56 | ||
2338 | 54 | >>> logout() | 57 | >>> logout() |
2340 | 55 | >>> umbrella = webservice.get("/package-sets/umbrella").jsonBody() | 58 | >>> umbrella = webservice.get("/package-sets/hoary/umbrella").jsonBody() |
2341 | 56 | >>> print umbrella['self_link'] | 59 | >>> print umbrella['self_link'] |
2343 | 57 | http://api.launchpad.dev/beta/package-sets/umbrella | 60 | http://api.launchpad.dev/beta/package-sets/hoary/umbrella |
2344 | 58 | 61 | ||
2345 | 59 | `PackageSet`s can be looked up by name. | 62 | `PackageSet`s can be looked up by name. |
2346 | 60 | 63 | ||
2347 | 61 | >>> response = webservice.named_get( | 64 | >>> response = webservice.named_get( |
2348 | 62 | ... '/package-sets', 'getByName', {}, name=u'umbrella') | 65 | ... '/package-sets', 'getByName', {}, name=u'umbrella') |
2349 | 63 | >>> print response.jsonBody()['self_link'] | 66 | >>> print response.jsonBody()['self_link'] |
2351 | 64 | http://api.launchpad.dev/beta/package-sets/umbrella | 67 | http://api.launchpad.dev/beta/package-sets/hoary/umbrella |
2352 | 65 | 68 | ||
2353 | 66 | When a `PackageSet` cannot be found, an error is returned. | 69 | When a `PackageSet` cannot be found, an error is returned. |
2354 | 67 | 70 | ||
2355 | @@ -70,9 +73,17 @@ | |||
2356 | 70 | >>> print response | 73 | >>> print response |
2357 | 71 | HTTP/1.1 400 Bad Request | 74 | HTTP/1.1 400 Bad Request |
2358 | 72 | ... | 75 | ... |
2360 | 73 | NoSuchPackageSet: No such packageset: 'not-found'. | 76 | No such package set (in the specified distro series): 'not-found'. |
2361 | 77 | ... | ||
2362 | 74 | <BLANKLINE> | 78 | <BLANKLINE> |
2363 | 75 | 79 | ||
2364 | 80 | Here's an example with a funny URL concoted by a "smart" user. | ||
2365 | 81 | |||
2366 | 82 | >>> response = webservice.get("/package-sets/lucid-plus-1/umbrella/+pwn") | ||
2367 | 83 | >>> print response | ||
2368 | 84 | HTTP/1.1 404 Not Found | ||
2369 | 85 | ... | ||
2370 | 86 | |||
2371 | 76 | Populate the 'umbrella' package set with source packages. | 87 | Populate the 'umbrella' package set with source packages. |
2372 | 77 | 88 | ||
2373 | 78 | >>> from canonical.launchpad.webapp.interfaces import ( | 89 | >>> from canonical.launchpad.webapp.interfaces import ( |
2374 | @@ -81,7 +92,7 @@ | |||
2375 | 81 | >>> store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR) | 92 | >>> store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR) |
2376 | 82 | >>> all_spns = store.find(SourcePackageName) | 93 | >>> all_spns = store.find(SourcePackageName) |
2377 | 83 | >>> response = webservice.named_post( | 94 | >>> response = webservice.named_post( |
2379 | 84 | ... '/package-sets/umbrella', 'addSources', {}, | 95 | ... '/package-sets/hoary/umbrella', 'addSources', {}, |
2380 | 85 | ... names=[spn.name for spn in all_spns]) | 96 | ... names=[spn.name for spn in all_spns]) |
2381 | 86 | >>> print response | 97 | >>> print response |
2382 | 87 | HTTP/1.1 200 Ok | 98 | HTTP/1.1 200 Ok |
2383 | @@ -91,7 +102,7 @@ | |||
2384 | 91 | exist will not fail. Non-existing source package names are *ignored*. | 102 | exist will not fail. Non-existing source package names are *ignored*. |
2385 | 92 | 103 | ||
2386 | 93 | >>> response = webservice.named_post( | 104 | >>> response = webservice.named_post( |
2388 | 94 | ... '/package-sets/umbrella', 'addSources', {}, | 105 | ... '/package-sets/hoary/umbrella', 'addSources', {}, |
2389 | 95 | ... names=[u'does-not-exist']) | 106 | ... names=[u'does-not-exist']) |
2390 | 96 | >>> print response | 107 | >>> print response |
2391 | 97 | HTTP/1.1 200 Ok | 108 | HTTP/1.1 200 Ok |
2392 | @@ -99,7 +110,7 @@ | |||
2393 | 99 | null | 110 | null |
2394 | 100 | 111 | ||
2395 | 101 | >>> response = webservice.named_post( | 112 | >>> response = webservice.named_post( |
2397 | 102 | ... '/package-sets/umbrella', 'removeSources', {}, | 113 | ... '/package-sets/hoary/umbrella', 'removeSources', {}, |
2398 | 103 | ... names=[u'does-not-exist']) | 114 | ... names=[u'does-not-exist']) |
2399 | 104 | >>> print response | 115 | >>> print response |
2400 | 105 | HTTP/1.1 200 Ok | 116 | HTTP/1.1 200 Ok |
2401 | @@ -109,7 +120,7 @@ | |||
2402 | 109 | Let's see what we got. | 120 | Let's see what we got. |
2403 | 110 | 121 | ||
2404 | 111 | >>> response = webservice.named_get( | 122 | >>> response = webservice.named_get( |
2406 | 112 | ... '/package-sets/umbrella', 'getSourcesIncluded', {}) | 123 | ... '/package-sets/hoary/umbrella', 'getSourcesIncluded', {}) |
2407 | 113 | >>> print response | 124 | >>> print response |
2408 | 114 | HTTP/1.1 200 Ok | 125 | HTTP/1.1 200 Ok |
2409 | 115 | ... | 126 | ... |
2410 | @@ -136,7 +147,7 @@ | |||
2411 | 136 | from the 'umbrella' package set. | 147 | from the 'umbrella' package set. |
2412 | 137 | 148 | ||
2413 | 138 | >>> response = webservice.named_post( | 149 | >>> response = webservice.named_post( |
2415 | 139 | ... '/package-sets/umbrella', 'removeSources', {}, | 150 | ... '/package-sets/hoary/umbrella', 'removeSources', {}, |
2416 | 140 | ... names=["foobar", "iceweasel"]) | 151 | ... names=["foobar", "iceweasel"]) |
2417 | 141 | >>> print response | 152 | >>> print response |
2418 | 142 | HTTP/1.1 200 Ok | 153 | HTTP/1.1 200 Ok |
2419 | @@ -146,7 +157,7 @@ | |||
2420 | 146 | from the list below. | 157 | from the list below. |
2421 | 147 | 158 | ||
2422 | 148 | >>> response = webservice.named_get( | 159 | >>> response = webservice.named_get( |
2424 | 149 | ... '/package-sets/umbrella', 'getSourcesIncluded', {}) | 160 | ... '/package-sets/hoary/umbrella', 'getSourcesIncluded', {}) |
2425 | 150 | >>> print response | 161 | >>> print response |
2426 | 151 | HTTP/1.1 200 Ok | 162 | HTTP/1.1 200 Ok |
2427 | 152 | ... | 163 | ... |
2428 | @@ -176,13 +187,13 @@ | |||
2429 | 176 | 187 | ||
2430 | 177 | >>> response = webservice.get("/package-sets/") | 188 | >>> response = webservice.get("/package-sets/") |
2431 | 178 | >>> print_payload(response) | 189 | >>> print_payload(response) |
2433 | 179 | http://api.launchpad.dev/beta/package-sets/umbrella | 190 | http://api.launchpad.dev/beta/package-sets/hoary/umbrella |
2434 | 180 | 191 | ||
2435 | 181 | Package sets may include other package sets (as subsets). At this point, | 192 | Package sets may include other package sets (as subsets). At this point, |
2436 | 182 | however, we only have the 'umbrella' package set. It hence has no subsets. | 193 | however, we only have the 'umbrella' package set. It hence has no subsets. |
2437 | 183 | 194 | ||
2438 | 184 | >>> response = webservice.named_get( | 195 | >>> response = webservice.named_get( |
2440 | 185 | ... '/package-sets/umbrella', 'setsIncluded', {}) | 196 | ... '/package-sets/hoary/umbrella', 'setsIncluded', {}) |
2441 | 186 | >>> print response | 197 | >>> print response |
2442 | 187 | HTTP/1.1 200 Ok | 198 | HTTP/1.1 200 Ok |
2443 | 188 | ... | 199 | ... |
2444 | @@ -206,6 +217,50 @@ | |||
2445 | 206 | HTTP/1.1 201 Created | 217 | HTTP/1.1 201 Created |
2446 | 207 | ... | 218 | ... |
2447 | 208 | 219 | ||
2448 | 220 | |||
2449 | 221 | === Package sets and distro series === | ||
2450 | 222 | |||
2451 | 223 | Every package set is associated with a distro series. | ||
2452 | 224 | |||
2453 | 225 | >>> from lazr.restful.testing.webservice import pprint_entry | ||
2454 | 226 | >>> mozilla = webservice.named_get( | ||
2455 | 227 | ... '/package-sets', 'getByName', {}, name=u'mozilla').jsonBody() | ||
2456 | 228 | >>> print mozilla['distroseries_link'] | ||
2457 | 229 | http://api.launchpad.dev/beta/ubuntu/hoary | ||
2458 | 230 | |||
2459 | 231 | |||
2460 | 232 | === Related package sets === | ||
2461 | 233 | |||
2462 | 234 | When adding a package set we can specify that is to be related to another set | ||
2463 | 235 | that exists already. | ||
2464 | 236 | |||
2465 | 237 | >>> grumpy = webservice.get("/ubuntu/grumpy").jsonBody() | ||
2466 | 238 | >>> print grumpy['self_link'] | ||
2467 | 239 | http://api.launchpad.dev/beta/ubuntu/grumpy | ||
2468 | 240 | |||
2469 | 241 | We are adding a new 'mozilla' package set to the 'grumpy' distro series and | ||
2470 | 242 | it is related to 'mozilla' in 'hoary'. | ||
2471 | 243 | |||
2472 | 244 | >>> response = webservice.named_post( | ||
2473 | 245 | ... '/package-sets', 'new', {}, | ||
2474 | 246 | ... name=u'mozilla', | ||
2475 | 247 | ... description=u'Contains all mozilla packages in grumpy', | ||
2476 | 248 | ... owner=name12['self_link'], distroseries=grumpy['self_link'], | ||
2477 | 249 | ... related_set=mozilla['self_link']) | ||
2478 | 250 | >>> print response | ||
2479 | 251 | HTTP/1.1 201 Created | ||
2480 | 252 | ... | ||
2481 | 253 | |||
2482 | 254 | >>> response = webservice.named_get( | ||
2483 | 255 | ... mozilla['self_link'], 'relatedSets', {}) | ||
2484 | 256 | >>> print_payload(response) | ||
2485 | 257 | http://api.launchpad.dev/beta/package-sets/grumpy/mozilla | ||
2486 | 258 | |||
2487 | 259 | |||
2488 | 260 | == Package set hierarchy == | ||
2489 | 261 | |||
2490 | 262 | More package sets are needed to set up the hierarchy described below. | ||
2491 | 263 | |||
2492 | 209 | >>> response = webservice.named_post( | 264 | >>> response = webservice.named_post( |
2493 | 210 | ... '/package-sets', 'new', {}, | 265 | ... '/package-sets', 'new', {}, |
2494 | 211 | ... name=u'firefox', description=u'Contains all firefox packages', | 266 | ... name=u'firefox', description=u'Contains all firefox packages', |
2495 | @@ -232,6 +287,18 @@ | |||
2496 | 232 | HTTP/1.1 201 Created | 287 | HTTP/1.1 201 Created |
2497 | 233 | ... | 288 | ... |
2498 | 234 | 289 | ||
2499 | 290 | The 'languagepack' package set will be removed later (in hoary). Let's add a | ||
2500 | 291 | set with the same name in 'grumpy' to make sure that the right one is found. | ||
2501 | 292 | |||
2502 | 293 | >>> response = webservice.named_post( | ||
2503 | 294 | ... '/package-sets', 'new', {}, | ||
2504 | 295 | ... name=u'languagepack', | ||
2505 | 296 | ... description=u'Contains all languagepack packages', | ||
2506 | 297 | ... owner=name12['self_link'], distroseries=grumpy['self_link']) | ||
2507 | 298 | >>> print response | ||
2508 | 299 | HTTP/1.1 201 Created | ||
2509 | 300 | ... | ||
2510 | 301 | |||
2511 | 235 | In order to test whether methods relating to package set hierarchies were | 302 | In order to test whether methods relating to package set hierarchies were |
2512 | 236 | exposed on the Launchpad API correctly we will define the following package | 303 | exposed on the Launchpad API correctly we will define the following package |
2513 | 237 | set hierarchy: | 304 | set hierarchy: |
2514 | @@ -245,27 +312,27 @@ | |||
2515 | 245 | * languagepack | 312 | * languagepack |
2516 | 246 | 313 | ||
2517 | 247 | >>> response = webservice.named_post( | 314 | >>> response = webservice.named_post( |
2519 | 248 | ... '/package-sets/umbrella', 'addSubsets', {}, | 315 | ... '/package-sets/hoary/umbrella', 'addSubsets', {}, |
2520 | 249 | ... names=[u'gnome', u'mozilla']) | 316 | ... names=[u'gnome', u'mozilla']) |
2521 | 250 | >>> print response | 317 | >>> print response |
2522 | 251 | HTTP/1.1 200 Ok | 318 | HTTP/1.1 200 Ok |
2523 | 252 | ... | 319 | ... |
2524 | 253 | 320 | ||
2525 | 254 | >>> response = webservice.named_post( | 321 | >>> response = webservice.named_post( |
2527 | 255 | ... '/package-sets/gnome', 'addSubsets', {}, names=[u'languagepack']) | 322 | ... '/package-sets/hoary/gnome', 'addSubsets', {}, names=[u'languagepack']) |
2528 | 256 | >>> print response | 323 | >>> print response |
2529 | 257 | HTTP/1.1 200 Ok | 324 | HTTP/1.1 200 Ok |
2530 | 258 | ... | 325 | ... |
2531 | 259 | 326 | ||
2532 | 260 | >>> response = webservice.named_post( | 327 | >>> response = webservice.named_post( |
2534 | 261 | ... '/package-sets/thunderbird', 'addSubsets', {}, | 328 | ... '/package-sets/hoary/thunderbird', 'addSubsets', {}, |
2535 | 262 | ... names=[u'languagepack']) | 329 | ... names=[u'languagepack']) |
2536 | 263 | >>> print response | 330 | >>> print response |
2537 | 264 | HTTP/1.1 200 Ok | 331 | HTTP/1.1 200 Ok |
2538 | 265 | ... | 332 | ... |
2539 | 266 | 333 | ||
2540 | 267 | >>> response = webservice.named_post( | 334 | >>> response = webservice.named_post( |
2542 | 268 | ... '/package-sets/mozilla', 'addSubsets', {}, | 335 | ... '/package-sets/hoary/mozilla', 'addSubsets', {}, |
2543 | 269 | ... names=[u'firefox', u'thunderbird']) | 336 | ... names=[u'firefox', u'thunderbird']) |
2544 | 270 | >>> print response | 337 | >>> print response |
2545 | 271 | HTTP/1.1 200 Ok | 338 | HTTP/1.1 200 Ok |
2546 | @@ -275,7 +342,7 @@ | |||
2547 | 275 | non-existing package sets will not fail. | 342 | non-existing package sets will not fail. |
2548 | 276 | 343 | ||
2549 | 277 | >>> response = webservice.named_post( | 344 | >>> response = webservice.named_post( |
2551 | 278 | ... '/package-sets/thunderbird', 'addSubsets', {}, | 345 | ... '/package-sets/hoary/thunderbird', 'addSubsets', {}, |
2552 | 279 | ... names=[u'does-not-exist']) | 346 | ... names=[u'does-not-exist']) |
2553 | 280 | >>> print response | 347 | >>> print response |
2554 | 281 | HTTP/1.1 200 Ok | 348 | HTTP/1.1 200 Ok |
2555 | @@ -283,7 +350,7 @@ | |||
2556 | 283 | null | 350 | null |
2557 | 284 | 351 | ||
2558 | 285 | >>> response = webservice.named_post( | 352 | >>> response = webservice.named_post( |
2560 | 286 | ... '/package-sets/thunderbird', 'removeSubsets', {}, | 353 | ... '/package-sets/hoary/thunderbird', 'removeSubsets', {}, |
2561 | 287 | ... names=[u'does-not-exist']) | 354 | ... names=[u'does-not-exist']) |
2562 | 288 | >>> print response | 355 | >>> print response |
2563 | 289 | HTTP/1.1 200 Ok | 356 | HTTP/1.1 200 Ok |
2564 | @@ -293,49 +360,49 @@ | |||
2565 | 293 | The 'umbrella' package set should have plenty of subsets now. | 360 | The 'umbrella' package set should have plenty of subsets now. |
2566 | 294 | 361 | ||
2567 | 295 | >>> response = webservice.named_get( | 362 | >>> response = webservice.named_get( |
2569 | 296 | ... '/package-sets/umbrella', 'setsIncluded', {}) | 363 | ... '/package-sets/hoary/umbrella', 'setsIncluded', {}) |
2570 | 297 | >>> print_payload(response) | 364 | >>> print_payload(response) |
2576 | 298 | http://api.launchpad.dev/beta/package-sets/firefox | 365 | http://api.launchpad.dev/beta/package-sets/hoary/firefox |
2577 | 299 | http://api.launchpad.dev/beta/package-sets/gnome | 366 | http://api.launchpad.dev/beta/package-sets/hoary/gnome |
2578 | 300 | http://api.launchpad.dev/beta/package-sets/languagepack | 367 | http://api.launchpad.dev/beta/package-sets/hoary/languagepack |
2579 | 301 | http://api.launchpad.dev/beta/package-sets/mozilla | 368 | http://api.launchpad.dev/beta/package-sets/hoary/mozilla |
2580 | 302 | http://api.launchpad.dev/beta/package-sets/thunderbird | 369 | http://api.launchpad.dev/beta/package-sets/hoary/thunderbird |
2581 | 303 | 370 | ||
2582 | 304 | However only two of the above are direct subsets. | 371 | However only two of the above are direct subsets. |
2583 | 305 | 372 | ||
2584 | 306 | >>> response = webservice.named_get( | 373 | >>> response = webservice.named_get( |
2586 | 307 | ... '/package-sets/umbrella', 'setsIncluded', {}, | 374 | ... '/package-sets/hoary/umbrella', 'setsIncluded', {}, |
2587 | 308 | ... direct_inclusion=True) | 375 | ... direct_inclusion=True) |
2588 | 309 | >>> print_payload(response) | 376 | >>> print_payload(response) |
2591 | 310 | http://api.launchpad.dev/beta/package-sets/gnome | 377 | http://api.launchpad.dev/beta/package-sets/hoary/gnome |
2592 | 311 | http://api.launchpad.dev/beta/package-sets/mozilla | 378 | http://api.launchpad.dev/beta/package-sets/hoary/mozilla |
2593 | 312 | 379 | ||
2594 | 313 | Let's ask the question the other way around what package sets are including | 380 | Let's ask the question the other way around what package sets are including |
2595 | 314 | a particular subset? | 381 | a particular subset? |
2596 | 315 | 382 | ||
2597 | 316 | >>> response = webservice.named_get( | 383 | >>> response = webservice.named_get( |
2599 | 317 | ... '/package-sets/languagepack', 'setsIncludedBy', {}) | 384 | ... '/package-sets/hoary/languagepack', 'setsIncludedBy', {}) |
2600 | 318 | >>> print_payload(response) | 385 | >>> print_payload(response) |
2605 | 319 | http://api.launchpad.dev/beta/package-sets/gnome | 386 | http://api.launchpad.dev/beta/package-sets/hoary/gnome |
2606 | 320 | http://api.launchpad.dev/beta/package-sets/mozilla | 387 | http://api.launchpad.dev/beta/package-sets/hoary/mozilla |
2607 | 321 | http://api.launchpad.dev/beta/package-sets/thunderbird | 388 | http://api.launchpad.dev/beta/package-sets/hoary/thunderbird |
2608 | 322 | http://api.launchpad.dev/beta/package-sets/umbrella | 389 | http://api.launchpad.dev/beta/package-sets/hoary/umbrella |
2609 | 323 | 390 | ||
2610 | 324 | The list of package sets that *directly* include 'languagepack' will be | 391 | The list of package sets that *directly* include 'languagepack' will be |
2611 | 325 | shorter because the transitive closure is ignored. | 392 | shorter because the transitive closure is ignored. |
2612 | 326 | 393 | ||
2613 | 327 | >>> response = webservice.named_get( | 394 | >>> response = webservice.named_get( |
2615 | 328 | ... '/package-sets/languagepack', 'setsIncludedBy', {}, | 395 | ... '/package-sets/hoary/languagepack', 'setsIncludedBy', {}, |
2616 | 329 | ... direct_inclusion=True) | 396 | ... direct_inclusion=True) |
2617 | 330 | >>> print_payload(response) | 397 | >>> print_payload(response) |
2620 | 331 | http://api.launchpad.dev/beta/package-sets/gnome | 398 | http://api.launchpad.dev/beta/package-sets/hoary/gnome |
2621 | 332 | http://api.launchpad.dev/beta/package-sets/thunderbird | 399 | http://api.launchpad.dev/beta/package-sets/hoary/thunderbird |
2622 | 333 | 400 | ||
2623 | 334 | We can remove subsets as well. In the example below 'thunderbird' will | 401 | We can remove subsets as well. In the example below 'thunderbird' will |
2624 | 335 | stop including 'languagepack'. | 402 | stop including 'languagepack'. |
2625 | 336 | 403 | ||
2626 | 337 | >>> response = webservice.named_post( | 404 | >>> response = webservice.named_post( |
2628 | 338 | ... '/package-sets/thunderbird', 'removeSubsets', {}, | 405 | ... '/package-sets/hoary/thunderbird', 'removeSubsets', {}, |
2629 | 339 | ... names=[u'languagepack']) | 406 | ... names=[u'languagepack']) |
2630 | 340 | >>> print response | 407 | >>> print response |
2631 | 341 | HTTP/1.1 200 Ok | 408 | HTTP/1.1 200 Ok |
2632 | @@ -344,37 +411,37 @@ | |||
2633 | 344 | And, here we go, now 'languagepack' has only one direct predecessor: 'gnome'. | 411 | And, here we go, now 'languagepack' has only one direct predecessor: 'gnome'. |
2634 | 345 | 412 | ||
2635 | 346 | >>> response = webservice.named_get( | 413 | >>> response = webservice.named_get( |
2637 | 347 | ... '/package-sets/languagepack', 'setsIncludedBy', {}, | 414 | ... '/package-sets/hoary/languagepack', 'setsIncludedBy', {}, |
2638 | 348 | ... direct_inclusion=True) | 415 | ... direct_inclusion=True) |
2639 | 349 | >>> print_payload(response) | 416 | >>> print_payload(response) |
2641 | 350 | http://api.launchpad.dev/beta/package-sets/gnome | 417 | http://api.launchpad.dev/beta/package-sets/hoary/gnome |
2642 | 351 | 418 | ||
2643 | 352 | Let's add a few source packages to the 'firefox' and the 'thunderbird' | 419 | Let's add a few source packages to the 'firefox' and the 'thunderbird' |
2644 | 353 | package sets. | 420 | package sets. |
2645 | 354 | 421 | ||
2646 | 355 | >>> response = webservice.named_post( | 422 | >>> response = webservice.named_post( |
2648 | 356 | ... '/package-sets/firefox', 'addSources', {}, | 423 | ... '/package-sets/hoary/firefox', 'addSources', {}, |
2649 | 357 | ... names=['at', 'mozilla-firefox', 'language-pack-de']) | 424 | ... names=['at', 'mozilla-firefox', 'language-pack-de']) |
2650 | 358 | >>> print response | 425 | >>> print response |
2651 | 359 | HTTP/1.1 200 Ok | 426 | HTTP/1.1 200 Ok |
2652 | 360 | ... | 427 | ... |
2653 | 361 | 428 | ||
2654 | 362 | >>> response = webservice.named_get( | 429 | >>> response = webservice.named_get( |
2656 | 363 | ... '/package-sets/firefox', 'getSourcesIncluded', {}) | 430 | ... '/package-sets/hoary/firefox', 'getSourcesIncluded', {}) |
2657 | 364 | >>> print response | 431 | >>> print response |
2658 | 365 | HTTP/1.1 200 Ok | 432 | HTTP/1.1 200 Ok |
2659 | 366 | ... | 433 | ... |
2660 | 367 | ["at", "language-pack-de", "mozilla-firefox"] | 434 | ["at", "language-pack-de", "mozilla-firefox"] |
2661 | 368 | 435 | ||
2662 | 369 | >>> response = webservice.named_post( | 436 | >>> response = webservice.named_post( |
2664 | 370 | ... '/package-sets/thunderbird', 'addSources', {}, | 437 | ... '/package-sets/hoary/thunderbird', 'addSources', {}, |
2665 | 371 | ... names=['at', 'cnews', 'thunderbird', 'language-pack-de']) | 438 | ... names=['at', 'cnews', 'thunderbird', 'language-pack-de']) |
2666 | 372 | >>> print response | 439 | >>> print response |
2667 | 373 | HTTP/1.1 200 Ok | 440 | HTTP/1.1 200 Ok |
2668 | 374 | ... | 441 | ... |
2669 | 375 | 442 | ||
2670 | 376 | >>> response = webservice.named_get( | 443 | >>> response = webservice.named_get( |
2672 | 377 | ... '/package-sets/thunderbird', 'getSourcesIncluded', {}) | 444 | ... '/package-sets/hoary/thunderbird', 'getSourcesIncluded', {}) |
2673 | 378 | >>> print response | 445 | >>> print response |
2674 | 379 | HTTP/1.1 200 Ok | 446 | HTTP/1.1 200 Ok |
2675 | 380 | ... | 447 | ... |
2676 | @@ -386,9 +453,9 @@ | |||
2677 | 386 | ... '/package-sets/', 'setsIncludingSource', {}, | 453 | ... '/package-sets/', 'setsIncludingSource', {}, |
2678 | 387 | ... sourcepackagename=u'mozilla-firefox') | 454 | ... sourcepackagename=u'mozilla-firefox') |
2679 | 388 | >>> print_payload(response) | 455 | >>> print_payload(response) |
2683 | 389 | http://api.launchpad.dev/beta/package-sets/firefox | 456 | http://api.launchpad.dev/beta/package-sets/hoary/firefox |
2684 | 390 | http://api.launchpad.dev/beta/package-sets/mozilla | 457 | http://api.launchpad.dev/beta/package-sets/hoary/mozilla |
2685 | 391 | http://api.launchpad.dev/beta/package-sets/umbrella | 458 | http://api.launchpad.dev/beta/package-sets/hoary/umbrella |
2686 | 392 | 459 | ||
2687 | 393 | Which package sets include the 'mozilla-firefox' source package *directly*? | 460 | Which package sets include the 'mozilla-firefox' source package *directly*? |
2688 | 394 | 461 | ||
2689 | @@ -397,8 +464,8 @@ | |||
2690 | 397 | ... sourcepackagename=u'mozilla-firefox', | 464 | ... sourcepackagename=u'mozilla-firefox', |
2691 | 398 | ... direct_inclusion=True) | 465 | ... direct_inclusion=True) |
2692 | 399 | >>> print_payload(response) | 466 | >>> print_payload(response) |
2695 | 400 | http://api.launchpad.dev/beta/package-sets/firefox | 467 | http://api.launchpad.dev/beta/package-sets/hoary/firefox |
2696 | 401 | http://api.launchpad.dev/beta/package-sets/umbrella | 468 | http://api.launchpad.dev/beta/package-sets/hoary/umbrella |
2697 | 402 | 469 | ||
2698 | 403 | If a non-existing source package name is passed it returns an error. | 470 | If a non-existing source package name is passed it returns an error. |
2699 | 404 | 471 | ||
2700 | @@ -414,9 +481,9 @@ | |||
2701 | 414 | What source packages are shared by the 'firefox' and the 'thunderbird' | 481 | What source packages are shared by the 'firefox' and the 'thunderbird' |
2702 | 415 | package sets? | 482 | package sets? |
2703 | 416 | 483 | ||
2705 | 417 | >>> thunderbird = webservice.get("/package-sets/thunderbird").jsonBody() | 484 | >>> thunderbird = webservice.get("/package-sets/hoary/thunderbird").jsonBody() |
2706 | 418 | >>> response = webservice.named_get( | 485 | >>> response = webservice.named_get( |
2708 | 419 | ... '/package-sets/firefox', 'getSourcesSharedBy', {}, | 486 | ... '/package-sets/hoary/firefox', 'getSourcesSharedBy', {}, |
2709 | 420 | ... other_package_set=thunderbird['self_link']) | 487 | ... other_package_set=thunderbird['self_link']) |
2710 | 421 | >>> print response | 488 | >>> print response |
2711 | 422 | HTTP/1.1 200 Ok | 489 | HTTP/1.1 200 Ok |
2712 | @@ -426,16 +493,16 @@ | |||
2713 | 426 | How about the complement set i.e. the packages not shared? | 493 | How about the complement set i.e. the packages not shared? |
2714 | 427 | 494 | ||
2715 | 428 | >>> response = webservice.named_get( | 495 | >>> response = webservice.named_get( |
2717 | 429 | ... '/package-sets/firefox', 'getSourcesNotSharedBy', {}, | 496 | ... '/package-sets/hoary/firefox', 'getSourcesNotSharedBy', {}, |
2718 | 430 | ... other_package_set=thunderbird['self_link']) | 497 | ... other_package_set=thunderbird['self_link']) |
2719 | 431 | >>> print response | 498 | >>> print response |
2720 | 432 | HTTP/1.1 200 Ok | 499 | HTTP/1.1 200 Ok |
2721 | 433 | ... | 500 | ... |
2722 | 434 | ["mozilla-firefox"] | 501 | ["mozilla-firefox"] |
2723 | 435 | 502 | ||
2725 | 436 | >>> firefox = webservice.get("/package-sets/firefox").jsonBody() | 503 | >>> firefox = webservice.get("/package-sets/hoary/firefox").jsonBody() |
2726 | 437 | >>> response = webservice.named_get( | 504 | >>> response = webservice.named_get( |
2728 | 438 | ... '/package-sets/thunderbird', 'getSourcesNotSharedBy', {}, | 505 | ... '/package-sets/hoary/thunderbird', 'getSourcesNotSharedBy', {}, |
2729 | 439 | ... other_package_set=firefox['self_link']) | 506 | ... other_package_set=firefox['self_link']) |
2730 | 440 | >>> print response | 507 | >>> print response |
2731 | 441 | HTTP/1.1 200 Ok | 508 | HTTP/1.1 200 Ok |
2732 | @@ -461,7 +528,7 @@ | |||
2733 | 461 | >>> response = webservice.named_post( | 528 | >>> response = webservice.named_post( |
2734 | 462 | ... ubuntu['main_archive_link'], 'newPackagesetUploader', {}, | 529 | ... ubuntu['main_archive_link'], 'newPackagesetUploader', {}, |
2735 | 463 | ... person=name12['self_link'], | 530 | ... person=name12['self_link'], |
2737 | 464 | ... packageset='firefox') | 531 | ... packageset=firefox['self_link']) |
2738 | 465 | >>> print response | 532 | >>> print response |
2739 | 466 | HTTP/1.1 201 Created | 533 | HTTP/1.1 201 Created |
2740 | 467 | ... | 534 | ... |
2741 | @@ -489,7 +556,7 @@ | |||
2742 | 489 | >>> response = webservice.named_post( | 556 | >>> response = webservice.named_post( |
2743 | 490 | ... ubuntu['main_archive_link'], 'newPackagesetUploader', {}, | 557 | ... ubuntu['main_archive_link'], 'newPackagesetUploader', {}, |
2744 | 491 | ... person=name12['self_link'], | 558 | ... person=name12['self_link'], |
2746 | 492 | ... packageset='mozilla') | 559 | ... packageset=mozilla['self_link']) |
2747 | 493 | >>> print response | 560 | >>> print response |
2748 | 494 | HTTP/1.1 201 Created | 561 | HTTP/1.1 201 Created |
2749 | 495 | ... | 562 | ... |
2750 | @@ -499,7 +566,7 @@ | |||
2751 | 499 | 566 | ||
2752 | 500 | >>> response = webservice.named_get( | 567 | >>> response = webservice.named_get( |
2753 | 501 | ... ubuntu['main_archive_link'], 'getUploadersForPackageset', {}, | 568 | ... ubuntu['main_archive_link'], 'getUploadersForPackageset', {}, |
2755 | 502 | ... packageset='firefox') | 569 | ... packageset=firefox['self_link']) |
2756 | 503 | >>> print_payload(response) | 570 | >>> print_payload(response) |
2757 | 504 | http://.../+archive/primary/+upload/name12?type=packageset&item=firefox | 571 | http://.../+archive/primary/+upload/name12?type=packageset&item=firefox |
2758 | 505 | 572 | ||
2759 | @@ -508,7 +575,7 @@ | |||
2760 | 508 | 575 | ||
2761 | 509 | >>> response = webservice.named_get( | 576 | >>> response = webservice.named_get( |
2762 | 510 | ... ubuntu['main_archive_link'], 'getUploadersForPackageset', {}, | 577 | ... ubuntu['main_archive_link'], 'getUploadersForPackageset', {}, |
2764 | 511 | ... packageset='firefox', direct_permissions=False) | 578 | ... packageset=firefox['self_link'], direct_permissions=False) |
2765 | 512 | >>> print_payload(response) | 579 | >>> print_payload(response) |
2766 | 513 | http://.../+archive/primary/+upload/name12?type=packageset&item=firefox | 580 | http://.../+archive/primary/+upload/name12?type=packageset&item=firefox |
2767 | 514 | http://.../+archive/primary/+upload/name12?type=packageset&item=mozilla | 581 | http://.../+archive/primary/+upload/name12?type=packageset&item=mozilla |
2768 | @@ -518,7 +585,7 @@ | |||
2769 | 518 | >>> response = webservice.named_post( | 585 | >>> response = webservice.named_post( |
2770 | 519 | ... ubuntu['main_archive_link'], 'deletePackagesetUploader', {}, | 586 | ... ubuntu['main_archive_link'], 'deletePackagesetUploader', {}, |
2771 | 520 | ... person=name12['self_link'], | 587 | ... person=name12['self_link'], |
2773 | 521 | ... packageset='mozilla') | 588 | ... packageset=mozilla['self_link']) |
2774 | 522 | >>> print response | 589 | >>> print response |
2775 | 523 | HTTP/1.1 200 Ok | 590 | HTTP/1.1 200 Ok |
2776 | 524 | ... | 591 | ... |
2777 | @@ -528,7 +595,7 @@ | |||
2778 | 528 | 595 | ||
2779 | 529 | >>> response = webservice.named_get( | 596 | >>> response = webservice.named_get( |
2780 | 530 | ... ubuntu['main_archive_link'], 'getUploadersForPackageset', {}, | 597 | ... ubuntu['main_archive_link'], 'getUploadersForPackageset', {}, |
2782 | 531 | ... packageset='firefox', direct_permissions=False) | 598 | ... packageset=firefox['self_link'], direct_permissions=False) |
2783 | 532 | >>> print_payload(response) | 599 | >>> print_payload(response) |
2784 | 533 | http://.../+archive/primary/+upload/name12?type=packageset&item=firefox | 600 | http://.../+archive/primary/+upload/name12?type=packageset&item=firefox |
2785 | 534 | 601 | ||
2786 | @@ -538,7 +605,7 @@ | |||
2787 | 538 | >>> response = webservice.named_post( | 605 | >>> response = webservice.named_post( |
2788 | 539 | ... ubuntu['main_archive_link'], 'newPackagesetUploader', {}, | 606 | ... ubuntu['main_archive_link'], 'newPackagesetUploader', {}, |
2789 | 540 | ... person=cprov['self_link'], | 607 | ... person=cprov['self_link'], |
2791 | 541 | ... packageset='mozilla') | 608 | ... packageset=mozilla['self_link']) |
2792 | 542 | >>> print response | 609 | >>> print response |
2793 | 543 | HTTP/1.1 201 Created | 610 | HTTP/1.1 201 Created |
2794 | 544 | ... | 611 | ... |
2795 | @@ -546,7 +613,7 @@ | |||
2796 | 546 | >>> response = webservice.named_post( | 613 | >>> response = webservice.named_post( |
2797 | 547 | ... ubuntu['main_archive_link'], 'newPackagesetUploader', {}, | 614 | ... ubuntu['main_archive_link'], 'newPackagesetUploader', {}, |
2798 | 548 | ... person=cprov['self_link'], | 615 | ... person=cprov['self_link'], |
2800 | 549 | ... packageset='thunderbird') | 616 | ... packageset=thunderbird['self_link']) |
2801 | 550 | >>> print response | 617 | >>> print response |
2802 | 551 | HTTP/1.1 201 Created | 618 | HTTP/1.1 201 Created |
2803 | 552 | ... | 619 | ... |
2804 | @@ -599,6 +666,39 @@ | |||
2805 | 599 | ... | 666 | ... |
2806 | 600 | true | 667 | true |
2807 | 601 | 668 | ||
2808 | 669 | Archive permissions have distro series scope. We did not specify a distro | ||
2809 | 670 | series in the query above. Hence the `currentseries` in Ubuntu is assumed | ||
2810 | 671 | ('hoary'). | ||
2811 | 672 | The following query (note the additional 'distroseries' parameter) is | ||
2812 | 673 | thus equivalent: | ||
2813 | 674 | |||
2814 | 675 | >>> print ubuntu['current_series_link'] | ||
2815 | 676 | http://api.launchpad.dev/beta/ubuntu/hoary | ||
2816 | 677 | >>> hoary = webservice.get("/ubuntu/hoary").jsonBody() | ||
2817 | 678 | >>> print hoary['self_link'] | ||
2818 | 679 | http://api.launchpad.dev/beta/ubuntu/hoary | ||
2819 | 680 | |||
2820 | 681 | >>> response = webservice.named_get( | ||
2821 | 682 | ... ubuntu['main_archive_link'], 'isSourceUploadAllowed', | ||
2822 | 683 | ... {}, sourcepackagename='mozilla-firefox', | ||
2823 | 684 | ... person=cprov['self_link'], distroseries=hoary['self_link']) | ||
2824 | 685 | >>> print(response) | ||
2825 | 686 | HTTP/1.1 200 Ok | ||
2826 | 687 | ... | ||
2827 | 688 | true | ||
2828 | 689 | |||
2829 | 690 | Since cprov's upload permission is limited to the current distro series | ||
2830 | 691 | ('hoary') checking the same permission for 'grumpy' will fail. | ||
2831 | 692 | |||
2832 | 693 | >>> response = webservice.named_get( | ||
2833 | 694 | ... ubuntu['main_archive_link'], 'isSourceUploadAllowed', | ||
2834 | 695 | ... {}, sourcepackagename='mozilla-firefox', | ||
2835 | 696 | ... person=cprov['self_link'], distroseries=grumpy['self_link']) | ||
2836 | 697 | >>> print(response) | ||
2837 | 698 | HTTP/1.1 200 Ok | ||
2838 | 699 | ... | ||
2839 | 700 | false | ||
2840 | 701 | |||
2841 | 602 | 'name12' should not be allowed to upload the 'thunderbird' source package. | 702 | 'name12' should not be allowed to upload the 'thunderbird' source package. |
2842 | 603 | 703 | ||
2843 | 604 | >>> response = webservice.named_get( | 704 | >>> response = webservice.named_get( |
2844 | @@ -610,6 +710,80 @@ | |||
2845 | 610 | ... | 710 | ... |
2846 | 611 | false | 711 | false |
2847 | 612 | 712 | ||
2848 | 713 | Let's create a (related) package set in 'grumpy' and authorize 'name12' to | ||
2849 | 714 | upload to it. | ||
2850 | 715 | |||
2851 | 716 | This will fail since 'name12' has no permissions applying to 'grumpy' yet. | ||
2852 | 717 | |||
2853 | 718 | >>> response = webservice.named_get( | ||
2854 | 719 | ... ubuntu['main_archive_link'], 'isSourceUploadAllowed', | ||
2855 | 720 | ... {}, sourcepackagename='thunderbird', | ||
2856 | 721 | ... person=name12['self_link'], distroseries=grumpy['self_link']) | ||
2857 | 722 | >>> print(response) | ||
2858 | 723 | HTTP/1.1 200 Ok | ||
2859 | 724 | ... | ||
2860 | 725 | false | ||
2861 | 726 | |||
2862 | 727 | Create a new package set ('grouchy-thunderbird') in 'grumpy'. | ||
2863 | 728 | |||
2864 | 729 | >>> response = webservice.named_post( | ||
2865 | 730 | ... '/package-sets', 'new', {}, | ||
2866 | 731 | ... name=u'grouchy-thunderbird', | ||
2867 | 732 | ... description=u'Contains all thunderbird packages in grumpy', | ||
2868 | 733 | ... owner=name12['self_link'], distroseries=grumpy['self_link'], | ||
2869 | 734 | ... related_set=thunderbird['self_link']) | ||
2870 | 735 | >>> print response | ||
2871 | 736 | HTTP/1.1 201 Created | ||
2872 | 737 | ... | ||
2873 | 738 | |||
2874 | 739 | >>> response = webservice.named_get( | ||
2875 | 740 | ... thunderbird['self_link'], 'relatedSets', {}) | ||
2876 | 741 | >>> print_payload(response) | ||
2877 | 742 | http://api.launchpad.dev/beta/package-sets/grumpy/grouchy-thunderbird | ||
2878 | 743 | |||
2879 | 744 | Associate 'grouchy-thunderbird' with the appropriate source packages. | ||
2880 | 745 | |||
2881 | 746 | >>> response = webservice.named_post( | ||
2882 | 747 | ... '/package-sets/grumpy/grouchy-thunderbird', 'addSources', {}, | ||
2883 | 748 | ... names=['thunderbird', 'language-pack-de']) | ||
2884 | 749 | >>> print response | ||
2885 | 750 | HTTP/1.1 200 Ok | ||
2886 | 751 | ... | ||
2887 | 752 | |||
2888 | 753 | Grant 'name12' upload permissions to 'grouchy-thunderbird' in 'grumpy'. | ||
2889 | 754 | |||
2890 | 755 | >>> grouchy_bird = webservice.get( | ||
2891 | 756 | ... "/package-sets/grumpy/grouchy-thunderbird").jsonBody() | ||
2892 | 757 | |||
2893 | 758 | >>> response = webservice.named_post( | ||
2894 | 759 | ... ubuntu['main_archive_link'], 'newPackagesetUploader', {}, | ||
2895 | 760 | ... person=name12['self_link'], | ||
2896 | 761 | ... packageset=grouchy_bird['self_link']) | ||
2897 | 762 | >>> print response | ||
2898 | 763 | HTTP/1.1 201 Created | ||
2899 | 764 | ... | ||
2900 | 765 | |||
2901 | 766 | Does the new archive permission show up? | ||
2902 | 767 | |||
2903 | 768 | >>> response = webservice.named_get( | ||
2904 | 769 | ... ubuntu['main_archive_link'], 'getPackagesetsForUploader', {}, | ||
2905 | 770 | ... person=name12['self_link']) | ||
2906 | 771 | >>> print_payload(response) | ||
2907 | 772 | http://...+archive/primary/+upload/name12?type=packageset&item=firefox | ||
2908 | 773 | http://...+archive/primary/+upload/name12?type=packageset&item=grouchy-thunderbird | ||
2909 | 774 | |||
2910 | 775 | And now 'name12' should be authorized to upload source package | ||
2911 | 776 | 'thunderbird' in 'grumpy'. | ||
2912 | 777 | |||
2913 | 778 | >>> response = webservice.named_get( | ||
2914 | 779 | ... ubuntu['main_archive_link'], 'isSourceUploadAllowed', | ||
2915 | 780 | ... {}, sourcepackagename='thunderbird', | ||
2916 | 781 | ... person=name12['self_link'], distroseries=grumpy['self_link']) | ||
2917 | 782 | >>> print(response) | ||
2918 | 783 | HTTP/1.1 200 Ok | ||
2919 | 784 | ... | ||
2920 | 785 | true | ||
2921 | 786 | |||
2922 | 613 | Sometimes it's also interesting to see what package set based upload | 787 | Sometimes it's also interesting to see what package set based upload |
2923 | 614 | permissions apply to a source package irrespective of the principal. | 788 | permissions apply to a source package irrespective of the principal. |
2924 | 615 | 789 | ||
2925 | 616 | 790 | ||
2926 | === modified file 'lib/lp/soyuz/templates/person-archive-subscriptions.pt' | |||
2927 | --- lib/lp/soyuz/templates/person-archive-subscriptions.pt 2009-09-18 07:46:03 +0000 | |||
2928 | +++ lib/lp/soyuz/templates/person-archive-subscriptions.pt 2009-11-03 18:13:39 +0000 | |||
2929 | @@ -34,7 +34,7 @@ | |||
2930 | 34 | </td> | 34 | </td> |
2931 | 35 | <td> | 35 | <td> |
2932 | 36 | <tal:active condition="token"> | 36 | <tal:active condition="token"> |
2934 | 37 | <a tal:attributes="href subscription/fmt:url" class="info"> | 37 | <a tal:attributes="href subscription/fmt:url" class="sprite info"> |
2935 | 38 | View | 38 | View |
2936 | 39 | </a> | 39 | </a> |
2937 | 40 | </tal:active> | 40 | </tal:active> |
2938 | 41 | 41 | ||
2939 | === added file 'lib/lp/soyuz/tests/test_packageset.py' | |||
2940 | --- lib/lp/soyuz/tests/test_packageset.py 1970-01-01 00:00:00 +0000 | |||
2941 | +++ lib/lp/soyuz/tests/test_packageset.py 2009-11-03 18:13:43 +0000 | |||
2942 | @@ -0,0 +1,187 @@ | |||
2943 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | ||
2944 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
2945 | 3 | |||
2946 | 4 | """Test Packageset features.""" | ||
2947 | 5 | |||
2948 | 6 | from zope.component import getUtility | ||
2949 | 7 | |||
2950 | 8 | from canonical.testing import LaunchpadZopelessLayer | ||
2951 | 9 | |||
2952 | 10 | from lp.testing import TestCaseWithFactory | ||
2953 | 11 | from lp.registry.interfaces.distribution import IDistributionSet | ||
2954 | 12 | from lp.registry.interfaces.distroseries import DistroSeriesStatus | ||
2955 | 13 | from lp.soyuz.interfaces.packageset import ( | ||
2956 | 14 | DuplicatePackagesetName, IPackagesetSet) | ||
2957 | 15 | |||
2958 | 16 | |||
2959 | 17 | class TestPackagesetSet(TestCaseWithFactory): | ||
2960 | 18 | |||
2961 | 19 | layer = LaunchpadZopelessLayer | ||
2962 | 20 | |||
2963 | 21 | def setUp(self): | ||
2964 | 22 | """Setup a distribution with multiple distroseries.""" | ||
2965 | 23 | super(TestPackagesetSet, self).setUp() | ||
2966 | 24 | self.distribution = getUtility(IDistributionSet).getByName( | ||
2967 | 25 | 'ubuntu') | ||
2968 | 26 | self.distroseries_current = self.distribution.currentseries | ||
2969 | 27 | self.distroseries_experimental = self.factory.makeDistroRelease( | ||
2970 | 28 | distribution = self.distribution, name="experimental", | ||
2971 | 29 | status=DistroSeriesStatus.EXPERIMENTAL) | ||
2972 | 30 | |||
2973 | 31 | self.person1 = self.factory.makePerson( | ||
2974 | 32 | name='hacker', displayname=u'Happy Hacker') | ||
2975 | 33 | |||
2976 | 34 | self.packageset_set = getUtility(IPackagesetSet) | ||
2977 | 35 | |||
2978 | 36 | def test_new_defaults_to_current_distroseries(self): | ||
2979 | 37 | # If the distroseries is not provided, the current development | ||
2980 | 38 | # distroseries will be assumed. | ||
2981 | 39 | packageset = self.packageset_set.new( | ||
2982 | 40 | u'kernel', u'Contains all OS kernel packages', self.person1) | ||
2983 | 41 | |||
2984 | 42 | self.failUnlessEqual( | ||
2985 | 43 | self.distroseries_current, packageset.distroseries) | ||
2986 | 44 | |||
2987 | 45 | def test_new_with_specified_distroseries(self): | ||
2988 | 46 | # A distroseries can be provided when creating a package set. | ||
2989 | 47 | packageset = self.packageset_set.new( | ||
2990 | 48 | u'kernel', u'Contains all OS kernel packages', self.person1, | ||
2991 | 49 | distroseries=self.distroseries_experimental) | ||
2992 | 50 | |||
2993 | 51 | self.failUnlessEqual( | ||
2994 | 52 | self.distroseries_experimental, packageset.distroseries) | ||
2995 | 53 | |||
2996 | 54 | def test_new_creates_new_packageset_group(self): | ||
2997 | 55 | # Creating a new packageset should also create a new packageset | ||
2998 | 56 | # group with the same owner. | ||
2999 | 57 | packageset = self.packageset_set.new( | ||
3000 | 58 | u'kernel', u'Contains all OS kernel packages', self.person1, | ||
3001 | 59 | distroseries=self.distroseries_experimental) | ||
3002 | 60 | |||
3003 | 61 | self.failUnlessEqual( | ||
3004 | 62 | self.person1, packageset.packagesetgroup.owner) | ||
3005 | 63 | |||
3006 | 64 | def test_new_duplicate_name_for_same_distroseries(self): | ||
3007 | 65 | # Creating a packageset with a duplicate name for the | ||
3008 | 66 | # given distroseries will fail. | ||
3009 | 67 | packageset = self.packageset_set.new( | ||
3010 | 68 | u'kernel', u'Contains all OS kernel packages', self.person1, | ||
3011 | 69 | distroseries=self.distroseries_experimental) | ||
3012 | 70 | |||
3013 | 71 | self.failUnlessRaises( | ||
3014 | 72 | DuplicatePackagesetName, self.packageset_set.new, | ||
3015 | 73 | u'kernel', u'A packageset with a duplicate name', self.person1, | ||
3016 | 74 | distroseries=self.distroseries_experimental) | ||
3017 | 75 | |||
3018 | 76 | def test_new_duplicate_name_for_different_distroseries(self): | ||
3019 | 77 | # Creating a packageset with a duplicate name but for a different | ||
3020 | 78 | # series is no problem. | ||
3021 | 79 | packageset = self.packageset_set.new( | ||
3022 | 80 | u'kernel', u'Contains all OS kernel packages', self.person1) | ||
3023 | 81 | |||
3024 | 82 | packageset2 = self.packageset_set.new( | ||
3025 | 83 | u'kernel', u'A packageset with a duplicate name', self.person1, | ||
3026 | 84 | distroseries=self.distroseries_experimental) | ||
3027 | 85 | self.assertEqual(packageset.name, packageset2.name) | ||
3028 | 86 | |||
3029 | 87 | def test_new_related_packageset(self): | ||
3030 | 88 | # Creating a new package set while specifying a `related_set` should | ||
3031 | 89 | # have the effect that the former ends up in the same group as the | ||
3032 | 90 | # latter. | ||
3033 | 91 | pset1 = self.packageset_set.new( | ||
3034 | 92 | u'kernel', u'Contains all OS kernel packages', self.person1) | ||
3035 | 93 | |||
3036 | 94 | pset2 = self.packageset_set.new( | ||
3037 | 95 | u'kernel', u'A related package set.', self.person1, | ||
3038 | 96 | distroseries=self.distroseries_experimental, related_set=pset1) | ||
3039 | 97 | self.assertEqual(pset1.packagesetgroup, pset2.packagesetgroup) | ||
3040 | 98 | |||
3041 | 99 | def test_get_by_name_in_current_distroseries(self): | ||
3042 | 100 | # IPackagesetSet.getByName() will return the package set in the | ||
3043 | 101 | # current distroseries if the optional `distroseries` parameter is | ||
3044 | 102 | # omitted. | ||
3045 | 103 | pset1 = self.packageset_set.new( | ||
3046 | 104 | u'kernel', u'Contains all OS kernel packages', self.person1) | ||
3047 | 105 | pset2 = self.packageset_set.new( | ||
3048 | 106 | u'kernel', u'A related package set.', self.person1, | ||
3049 | 107 | distroseries=self.distroseries_experimental, related_set=pset1) | ||
3050 | 108 | pset_found = getUtility(IPackagesetSet).getByName('kernel') | ||
3051 | 109 | self.assertEqual(pset1, pset_found) | ||
3052 | 110 | |||
3053 | 111 | def test_get_by_name_in_specified_distroseries(self): | ||
3054 | 112 | # IPackagesetSet.getByName() will return the package set in the | ||
3055 | 113 | # specified distroseries. | ||
3056 | 114 | pset1 = self.packageset_set.new( | ||
3057 | 115 | u'kernel', u'Contains all OS kernel packages', self.person1) | ||
3058 | 116 | pset2 = self.packageset_set.new( | ||
3059 | 117 | u'kernel', u'A related package set.', self.person1, | ||
3060 | 118 | distroseries=self.distroseries_experimental, related_set=pset1) | ||
3061 | 119 | pset_found = getUtility(IPackagesetSet).getByName( | ||
3062 | 120 | 'kernel', distroseries=self.distroseries_experimental) | ||
3063 | 121 | self.assertEqual(pset2, pset_found) | ||
3064 | 122 | |||
3065 | 123 | |||
3066 | 124 | class TestPackageset(TestCaseWithFactory): | ||
3067 | 125 | |||
3068 | 126 | layer = LaunchpadZopelessLayer | ||
3069 | 127 | |||
3070 | 128 | def setUp(self): | ||
3071 | 129 | """Setup a distribution with multiple distroseries.""" | ||
3072 | 130 | super(TestPackageset, self).setUp() | ||
3073 | 131 | self.distribution = getUtility(IDistributionSet).getByName( | ||
3074 | 132 | 'ubuntu') | ||
3075 | 133 | self.distroseries_current = self.distribution.currentseries | ||
3076 | 134 | self.distroseries_experimental = self.factory.makeDistroRelease( | ||
3077 | 135 | distribution = self.distribution, name="experimental", | ||
3078 | 136 | status=DistroSeriesStatus.EXPERIMENTAL) | ||
3079 | 137 | self.distroseries_experimental2 = self.factory.makeDistroRelease( | ||
3080 | 138 | distribution = self.distribution, name="experimental2", | ||
3081 | 139 | status=DistroSeriesStatus.EXPERIMENTAL) | ||
3082 | 140 | |||
3083 | 141 | self.person1 = self.factory.makePerson( | ||
3084 | 142 | name='hacker', displayname=u'Happy Hacker') | ||
3085 | 143 | |||
3086 | 144 | self.packageset_set = getUtility(IPackagesetSet) | ||
3087 | 145 | |||
3088 | 146 | def test_no_related_sets(self): | ||
3089 | 147 | # If the package set is the only one in the group the result set | ||
3090 | 148 | # returned by relatedSets() is empty. | ||
3091 | 149 | packageset = self.packageset_set.new( | ||
3092 | 150 | u'kernel', u'Contains all OS kernel packages', self.person1) | ||
3093 | 151 | |||
3094 | 152 | self.failUnlessEqual(packageset.relatedSets().count(), 0) | ||
3095 | 153 | |||
3096 | 154 | def test_related_set_found(self): | ||
3097 | 155 | # Creating a new package set while specifying a `related_set` should | ||
3098 | 156 | # have the effect that the former ends up in the same group as the | ||
3099 | 157 | # latter. | ||
3100 | 158 | |||
3101 | 159 | # The original package set. | ||
3102 | 160 | pset1 = self.packageset_set.new( | ||
3103 | 161 | u'kernel', u'Contains all OS kernel packages', self.person1) | ||
3104 | 162 | |||
3105 | 163 | # A related package set. | ||
3106 | 164 | pset2 = self.packageset_set.new( | ||
3107 | 165 | u'kernel', u'A related package set.', self.person1, | ||
3108 | 166 | distroseries=self.distroseries_experimental, related_set=pset1) | ||
3109 | 167 | self.assertEqual(pset1.packagesetgroup, pset2.packagesetgroup) | ||
3110 | 168 | |||
3111 | 169 | # An unrelated package set with the same name. | ||
3112 | 170 | pset3 = self.packageset_set.new( | ||
3113 | 171 | u'kernel', u'Unrelated package set.', self.person1, | ||
3114 | 172 | distroseries=self.distroseries_experimental2) | ||
3115 | 173 | self.assertNotEqual(pset2.packagesetgroup, pset3.packagesetgroup) | ||
3116 | 174 | |||
3117 | 175 | # Make sure 'pset2' is related to 'pset1'. | ||
3118 | 176 | related = pset1.relatedSets() | ||
3119 | 177 | self.assertEqual(related.count(), 1) | ||
3120 | 178 | self.assertEqual(related[0], pset2) | ||
3121 | 179 | |||
3122 | 180 | # And the other way around .. | ||
3123 | 181 | related = pset2.relatedSets() | ||
3124 | 182 | self.assertEqual(related.count(), 1) | ||
3125 | 183 | self.assertEqual(related[0], pset1) | ||
3126 | 184 | |||
3127 | 185 | # Unsurprisingly, the unrelated package set is not associated with any | ||
3128 | 186 | # other package set. | ||
3129 | 187 | self.failUnlessEqual(pset3.relatedSets().count(), 0) | ||
3130 | 0 | 188 | ||
3131 | === modified file 'scripts/ftpmaster-tools/_syncorigins.py' | |||
3132 | --- scripts/ftpmaster-tools/_syncorigins.py 2009-07-23 02:33:14 +0000 | |||
3133 | +++ scripts/ftpmaster-tools/_syncorigins.py 2009-11-03 18:13:42 +0000 | |||
3134 | @@ -12,7 +12,7 @@ | |||
3135 | 12 | "debian": { | 12 | "debian": { |
3136 | 13 | "name": "Debian", | 13 | "name": "Debian", |
3137 | 14 | "url": "http://ftp.debian.org/debian/", | 14 | "url": "http://ftp.debian.org/debian/", |
3139 | 15 | "default suite": "unstable", | 15 | "default suite": "testing", |
3140 | 16 | "default component": "main", | 16 | "default component": "main", |
3141 | 17 | "dsc": "must be signed and valid" | 17 | "dsc": "must be signed and valid" |
3142 | 18 | }, | 18 | }, |
3143 | 19 | 19 | ||
3144 | === modified file 'utilities/pgmassacre.py' | |||
3145 | --- utilities/pgmassacre.py 2009-06-24 20:15:50 +0000 | |||
3146 | +++ utilities/pgmassacre.py 2009-11-03 18:13:41 +0000 | |||
3147 | @@ -11,6 +11,7 @@ | |||
3148 | 11 | 11 | ||
3149 | 12 | # Nothing but system installed libraries - this script sometimes | 12 | # Nothing but system installed libraries - this script sometimes |
3150 | 13 | # gets installed standalone with no Launchpad tree available. | 13 | # gets installed standalone with no Launchpad tree available. |
3151 | 14 | from distutils.version import LooseVersion | ||
3152 | 14 | import sys | 15 | import sys |
3153 | 15 | import time | 16 | import time |
3154 | 16 | import psycopg2 | 17 | import psycopg2 |
3155 | @@ -184,12 +185,20 @@ | |||
3156 | 184 | error_msg = None | 185 | error_msg = None |
3157 | 185 | con = connect() | 186 | con = connect() |
3158 | 186 | con.set_isolation_level(0) # Autocommit required for CREATE DATABASE. | 187 | con.set_isolation_level(0) # Autocommit required for CREATE DATABASE. |
3159 | 188 | create_db_cmd = """ | ||
3160 | 189 | CREATE DATABASE %s WITH ENCODING='UTF8' TEMPLATE=%s | ||
3161 | 190 | """ % (database, template) | ||
3162 | 191 | # 8.4 allows us to create empty databases with a different locale | ||
3163 | 192 | # to template1 by using the template0 database as a template. | ||
3164 | 193 | # We make use of this feature so we don't have to care what locale | ||
3165 | 194 | # was used to create the database cluster rather than requiring it | ||
3166 | 195 | # to be rebuilt in the C locale. | ||
3167 | 196 | if pg_version >= LooseVersion("8.4.0") and template == "template0": | ||
3168 | 197 | create_db_cmd += "LC_COLLATE='C' LC_CTYPE='C'" | ||
3169 | 187 | while now < start + 20: | 198 | while now < start + 20: |
3170 | 188 | cur = con.cursor() | 199 | cur = con.cursor() |
3171 | 189 | try: | 200 | try: |
3175 | 190 | cur.execute( | 201 | cur.execute(create_db_cmd) |
3173 | 191 | "CREATE DATABASE %s WITH ENCODING='UTF8' TEMPLATE=%s" | ||
3174 | 192 | % (database, template)) | ||
3176 | 193 | con.close() | 202 | con.close() |
3177 | 194 | return 0 | 203 | return 0 |
3178 | 195 | except psycopg2.Error, exception: | 204 | except psycopg2.Error, exception: |
3179 | @@ -219,6 +228,7 @@ | |||
3180 | 219 | 228 | ||
3181 | 220 | 229 | ||
3182 | 221 | options = None | 230 | options = None |
3183 | 231 | pg_version = None # LooseVersion - Initialized in main() | ||
3184 | 222 | 232 | ||
3185 | 223 | 233 | ||
3186 | 224 | def main(): | 234 | def main(): |
3187 | @@ -243,6 +253,12 @@ | |||
3188 | 243 | 253 | ||
3189 | 244 | con = connect() | 254 | con = connect() |
3190 | 245 | cur = con.cursor() | 255 | cur = con.cursor() |
3191 | 256 | |||
3192 | 257 | # Store the database version for version specific code. | ||
3193 | 258 | global pg_version | ||
3194 | 259 | cur.execute("show server_version") | ||
3195 | 260 | pg_version = LooseVersion(cur.fetchone()[0]) | ||
3196 | 261 | |||
3197 | 246 | # Ensure the template database exists. | 262 | # Ensure the template database exists. |
3198 | 247 | if options.template is not None: | 263 | if options.template is not None: |
3199 | 248 | cur.execute( | 264 | cur.execute( |
Summary
-------
In a previous branch, I removed the stylesheet for a.info, since it
was interfering with the "info" class for sprites. This broke a couple
of links. This was corrected by setting class="sprite info".
See the "All downloads" link on https:/ /edge.launchpad .net/bzr
BTW, I also merged devel into db-devel, so that I won't have
to worry about conflicts when pqm is finally working.
Demo and Q/A
------------
* Open https:/ /launchpad. dev/firefox
The other page where this occurs is difficult to view, since
you must be subscribed to a Private PPA. You can subscribe
the name16 (foo.bar) user on launchpad.dev with the following
sql statements.
UPDATE Archive SET private = TRUE, buildd_secret = 'foo' WHERE id = 13;
INSERT INTO ArchiveSubscriber (archive, registrant, subscriber, status)
VALUES (13, 1, 16, 1);
INSERT INTO ArchiveAuthToken (archive, person, token)
VALUES (13, 16, 'asdf');
* https:/ /launchpad. dev/~name16/ +archivesubscri ptions