Merge lp:~jtv/launchpad/db-bug-752181 into lp:launchpad/db-devel

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: 10409
Proposed branch: lp:~jtv/launchpad/db-bug-752181
Merge into: lp:launchpad/db-devel
Diff against target: 67 lines (+12/-6)
4 files modified
cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/30-copy-indices (+3/-2)
cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/README.txt (+3/-0)
lib/lp/archivepublisher/scripts/publish_ftpmaster.py (+2/-1)
lib/lp/archivepublisher/tests/test_publish_ftpmaster.py (+4/-3)
To merge this branch: bzr merge lp:~jtv/launchpad/db-bug-752181
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+56903@code.launchpad.net

Commit message

[r=adeuring][bug=752181] Pass OVERRIDEROOT to publish-distro plugins.

Description of the change

= Summary =

In replacing the system-specific and distro-specific parts of the cron.publish-ftpmaster script with run-parts plugins, I forgot to pass a parameter from the archives' publisher config to the publish-distro plugins: OVERRIDEROOT. It was hard-coded in the old script.

== Proposed fix ==

Take OVERRIDEROOT from the archive-configuration model object (it's actually a separate thing from lazr config) and passes it to the script.

== Pre-implementation notes ==

William notes that the indices directory may not exist yet. So I changed the plugin script to create it if necessary.

== Implementation details ==

I was careless in my unit-testing of the new python-based publish-ftpmaster script. The two tests for parameters being passed to the plugin scripts would fail if I passed too many, but not if I passed too few (which is what really needs testing). Proper TDD would have shown me this as I ran the test before implementing the feature. That wasn't really feasible for such a large and radical branch though; in retrospect it might have been possible to break it down into smaller branches somehow.

== Tests ==

{{{
./bin/test lp.archivepublisher.tests.test_publish_ftpmaster -t passes_parameters
}}}

== Demo and Q/A ==

We run publish-ftpmaster on dogfood and watch for error output or missing results.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/30-copy-indices
  cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/README.txt
  lib/lp/archivepublisher/scripts/publish_ftpmaster.py
  lib/lp/archivepublisher/tests/test_publish_ftpmaster.py

To post a comment you must log in.
Revision history for this message
Abel Deuring (adeuring) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/30-copy-indices'
2--- cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/30-copy-indices 2011-03-28 09:18:42 +0000
3+++ cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/30-copy-indices 2011-04-08 09:29:08 +0000
4@@ -2,7 +2,8 @@
5
6 echo "$(date -R): Copying the indices into place."
7
8-INDICES="$ARCHIVEROOT/indices"
9+INDICES=$ARCHIVEROOT/indices
10
11+mkdir -p -- $INDICES
12 rm -f -- "$INDICES/override"
13-cp -- "$OVERRIDEROOT"/override.* "$INDICES/"
14+cp -- $OVERRIDEROOT/override.* $INDICES/
15
16=== modified file 'cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/README.txt'
17--- cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/README.txt 2011-03-31 08:38:55 +0000
18+++ cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/README.txt 2011-04-08 09:29:08 +0000
19@@ -18,5 +18,8 @@
20 DISTSROOT - the archive's dists root directory
21 (e.g. /srv/launchpad.net/ubuntu-archive/ubuntu/dists )
22
23+OVERRIDEROOT - the archive's overrides root directory
24+(e.g. /srv/launchpad.net/ubuntu-overrides )
25+
26 The script's PATH will be extended with the Launchpad source tree's
27 cronscripts/publishing directory.
28
29=== modified file 'lib/lp/archivepublisher/scripts/publish_ftpmaster.py'
30--- lib/lp/archivepublisher/scripts/publish_ftpmaster.py 2011-04-01 07:12:44 +0000
31+++ lib/lp/archivepublisher/scripts/publish_ftpmaster.py 2011-04-08 09:29:08 +0000
32@@ -256,8 +256,9 @@
33 """Execute the publish-distro hooks."""
34 archive_config = self.configs[archive.purpose]
35 env = {
36+ 'ARCHIVEROOT': archive_config.archiveroot,
37 'DISTSROOT': archive_config.distsroot,
38- 'ARCHIVEROOT': archive_config.archiveroot,
39+ 'OVERRIDEROOT': archive_config.overrideroot,
40 }
41 self.runParts('publish-distro.d', env)
42
43
44=== modified file 'lib/lp/archivepublisher/tests/test_publish_ftpmaster.py'
45--- lib/lp/archivepublisher/tests/test_publish_ftpmaster.py 2011-03-31 11:25:53 +0000
46+++ lib/lp/archivepublisher/tests/test_publish_ftpmaster.py 2011-04-08 09:29:08 +0000
47@@ -479,8 +479,9 @@
48 script.runPublishDistroParts(distro.main_archive)
49 args, kwargs = script.runParts.calls[0]
50 parts_dir, env = args
51- required_parameters = set(["DISTSROOT", "ARCHIVEROOT"])
52- missing_parameters = set(env.keys()).difference(required_parameters)
53+ required_parameters = set([
54+ "ARCHIVEROOT", "DISTSROOT", "OVERRIDEROOT"])
55+ missing_parameters = required_parameters.difference(set(env.keys()))
56 self.assertEqual(set(), missing_parameters)
57
58 def test_installDists_sets_done_pub(self):
59@@ -642,7 +643,7 @@
60 args, kwargs = script.runParts.calls[0]
61 parts_dir, env = args
62 required_parameters = set(["ARCHIVEROOTS", "SECURITY_UPLOAD_ONLY"])
63- missing_parameters = set(env.keys()).difference(required_parameters)
64+ missing_parameters = required_parameters.difference(set(env.keys()))
65 self.assertEqual(set(), missing_parameters)
66
67 def test_publishSecurityUploads_skips_pub_if_no_security_updates(self):

Subscribers

People subscribed via source and target branches

to status/vote changes: