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
=== modified file 'lib/lp/archivepublisher/config.py'
--- lib/lp/archivepublisher/config.py 2009-10-26 18:40:04 +0000
+++ lib/lp/archivepublisher/config.py 2010-02-19 16:14:15 +0000
@@ -66,6 +66,18 @@
66 pubconf.archiveroot = os.path.join(66 pubconf.archiveroot = os.path.join(
67 pubconf.distroroot, archive.distribution.name + '-debug')67 pubconf.distroroot, archive.distribution.name + '-debug')
68 update_pub_config(pubconf)68 update_pub_config(pubconf)
69 elif archive.is_copy:
70 pubconf.distroroot = config.archivepublisher.root
71 pubconf.archiveroot = os.path.join(
72 pubconf.distroroot,
73 archive.distribution.name + '-' + archive.name)
74 # Multiple copy archives can exist on the same machine so the
75 # temp areas need to be unique also.
76 pubconf.temproot = pubconf.archiveroot + '-temp'
77 update_pub_config(pubconf)
78 pubconf.overrideroot = pubconf.archiveroot + '-overrides'
79 pubconf.cacheroot = pubconf.archiveroot + '-cache'
80 pubconf.miscroot = pubconf.archiveroot + '-misc'
69 else:81 else:
70 raise AssertionError(82 raise AssertionError(
71 "Unknown archive purpose %s when getting publisher config.",83 "Unknown archive purpose %s when getting publisher config.",
7284
=== modified file 'lib/lp/archivepublisher/tests/publisher-config.txt'
--- lib/lp/archivepublisher/tests/publisher-config.txt 2009-05-15 09:51:48 +0000
+++ lib/lp/archivepublisher/tests/publisher-config.txt 2010-02-19 16:14:15 +0000
@@ -202,3 +202,32 @@
202 hoary-test:202 hoary-test:
203 Architectures: amd64, i386203 Architectures: amd64, i386
204 Components: main, multiverse, restricted, universe204 Components: main, multiverse, restricted, universe
205
206
207== COPY ==
208
209In the case of copy archives (used for rebuild testing) the archiveroot
210is of the form distroroot/distroname-archivename
211
212 >>> copy_archive = getUtility(IArchiveSet).new(
213 ... purpose=ArchivePurpose.COPY, owner=ubuntutest.owner,
214 ... distribution=ubuntutest, name="rebuildtest99")
215
216 >>> copy_config = getPubConfig(copy_archive)
217
218 >>> dump_config(copy_config)
219 stayofexecution: 5.0
220 distroroot: /var/tmp/archive
221 archiveroot: /var/tmp/archive/ubuntutest-rebuildtest99
222 poolroot: /var/tmp/archive/ubuntutest-rebuildtest99/pool
223 distsroot: /var/tmp/archive/ubuntutest-rebuildtest99/dists
224 overrideroot: /var/tmp/archive/ubuntutest-rebuildtest99-overrides
225 cacheroot: /var/tmp/archive/ubuntutest-rebuildtest99-cache
226 miscroot: /var/tmp/archive/ubuntutest-rebuildtest99-misc
227 temproot: /var/tmp/archive/ubuntutest-rebuildtest99-temp
228 breezy-autotest:
229 Architectures:
230 Components: main, multiverse, restricted, universe
231 hoary-test:
232 Architectures: amd64, i386
233 Components: main, multiverse, restricted, universe