Merge lp:~julian-edwards/launchpad/publish-copy-archives-bug-520520-getPubConfig into lp:launchpad

Proposed by Julian Edwards
Status: Merged
Merged at revision: not available
Proposed branch: lp:~julian-edwards/launchpad/publish-copy-archives-bug-520520-getPubConfig
Merge into: lp:launchpad
Diff against target: 59 lines (+41/-0)
2 files modified
lib/lp/archivepublisher/config.py (+12/-0)
lib/lp/archivepublisher/tests/publisher-config.txt (+29/-0)
To merge this branch: bzr merge lp:~julian-edwards/launchpad/publish-copy-archives-bug-520520-getPubConfig
Reviewer Review Type Date Requested Status
Guilherme Salgado (community) code Approve
Review via email: mp+19721@code.launchpad.net

Commit message

Fix getPubConfig so it handles copy archives

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

= Summary =
Fix getPubConfig so it handles copy archives

== Proposed fix ==
getPubConfig() is a function in the archivepublisher module that returns a
publisher config for the, err, publisher. The config varies depending on what
type of archive is being published. Note that this is not a canonical.config
object, it's some old Soyuz crack.

This branch adds the necessary changes to make publishing of Copy archives a
reality. It's another of the many branches I'm doing to fix bug 520520.

== Implementation details ==
It's utterly trivial. Read the diff :)

== Tests ==
bin/test -cvvt publisher-config.txt

== Demo and Q/A ==

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/archivepublisher/config.py
  lib/lp/archivepublisher/tests/publisher-config.txt

Revision history for this message
Guilherme Salgado (salgado) wrote :

<salgado> bigjools, I was just wondering if it'd be possible to use a newly created distribution in that test, to have it not depending on any sample data
<bigjools> salgado: that would be quite a lot of work :/
<salgado> I imagined
<bigjools> the other tests in the file all do the same thing
<salgado> bigjools, do we need to have the suffixes hard-coded there? can't we take them from a constant somewhere?
<bigjools> salgado: that's the only place they will appear - is there a benefit to doing that?
<salgado> in that case, no

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/archivepublisher/config.py'
2--- lib/lp/archivepublisher/config.py 2009-10-26 18:40:04 +0000
3+++ lib/lp/archivepublisher/config.py 2010-02-19 16:14:15 +0000
4@@ -66,6 +66,18 @@
5 pubconf.archiveroot = os.path.join(
6 pubconf.distroroot, archive.distribution.name + '-debug')
7 update_pub_config(pubconf)
8+ elif archive.is_copy:
9+ pubconf.distroroot = config.archivepublisher.root
10+ pubconf.archiveroot = os.path.join(
11+ pubconf.distroroot,
12+ archive.distribution.name + '-' + archive.name)
13+ # Multiple copy archives can exist on the same machine so the
14+ # temp areas need to be unique also.
15+ pubconf.temproot = pubconf.archiveroot + '-temp'
16+ update_pub_config(pubconf)
17+ pubconf.overrideroot = pubconf.archiveroot + '-overrides'
18+ pubconf.cacheroot = pubconf.archiveroot + '-cache'
19+ pubconf.miscroot = pubconf.archiveroot + '-misc'
20 else:
21 raise AssertionError(
22 "Unknown archive purpose %s when getting publisher config.",
23
24=== modified file 'lib/lp/archivepublisher/tests/publisher-config.txt'
25--- lib/lp/archivepublisher/tests/publisher-config.txt 2009-05-15 09:51:48 +0000
26+++ lib/lp/archivepublisher/tests/publisher-config.txt 2010-02-19 16:14:15 +0000
27@@ -202,3 +202,32 @@
28 hoary-test:
29 Architectures: amd64, i386
30 Components: main, multiverse, restricted, universe
31+
32+
33+== COPY ==
34+
35+In the case of copy archives (used for rebuild testing) the archiveroot
36+is of the form distroroot/distroname-archivename
37+
38+ >>> copy_archive = getUtility(IArchiveSet).new(
39+ ... purpose=ArchivePurpose.COPY, owner=ubuntutest.owner,
40+ ... distribution=ubuntutest, name="rebuildtest99")
41+
42+ >>> copy_config = getPubConfig(copy_archive)
43+
44+ >>> dump_config(copy_config)
45+ stayofexecution: 5.0
46+ distroroot: /var/tmp/archive
47+ archiveroot: /var/tmp/archive/ubuntutest-rebuildtest99
48+ poolroot: /var/tmp/archive/ubuntutest-rebuildtest99/pool
49+ distsroot: /var/tmp/archive/ubuntutest-rebuildtest99/dists
50+ overrideroot: /var/tmp/archive/ubuntutest-rebuildtest99-overrides
51+ cacheroot: /var/tmp/archive/ubuntutest-rebuildtest99-cache
52+ miscroot: /var/tmp/archive/ubuntutest-rebuildtest99-misc
53+ temproot: /var/tmp/archive/ubuntutest-rebuildtest99-temp
54+ breezy-autotest:
55+ Architectures:
56+ Components: main, multiverse, restricted, universe
57+ hoary-test:
58+ Architectures: amd64, i386
59+ Components: main, multiverse, restricted, universe