Merge lp:~cjwatson/launchpad/634831-germinate-unhardcode into lp:launchpad

Proposed by Colin Watson
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merged at revision: 12023
Proposed branch: lp:~cjwatson/launchpad/634831-germinate-unhardcode
Merge into: lp:launchpad
Diff against target: 44 lines (+14/-9)
1 file modified
cronscripts/publishing/cron.germinate (+14/-9)
To merge this branch: bzr merge lp:~cjwatson/launchpad/634831-germinate-unhardcode
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) code Approve
Review via email: mp+39863@code.launchpad.net

Commit message

[r=jelmer][ui=none][bug=634831] cron.germinate: Avoid relying on implementation details of germinate: use -m option rather than writing to archive.ubuntu.com_* files

Description of the change

Summary

Bug 634831 asks for a change in germinate to make it possible to process input from multiple PPAs. This change is blocked because Launchpad's cron.germinate script relies on an internal implementation detail of germinate which now needs to change (perhaps not in exactly the way suggested in the patch for that bug, but it clearly needs to change somehow).

Proposed fix

The reason for this code in cron.germinate is to take copies of input files in case the archive changes under our feet (e.g. cron.germinate overlaps the next publisher run, or something like that). Currently, it just inserts them into germinate's current cached locations for archive.ubuntu.com URLs. Instead, it would be better to construct a local dists tree and point germinate at that using a file:// URL.

Pre-implementation notes

I haven't discussed this bug with anyone, sorry. This is partly because everyone keeps telling me the platform team owns cron.germinate. :-)

Implementation details

Nothing of note. I think this should be slightly faster than the previous implementation as it only decompresses Packages files once rather than once for each of the six seed collections (ubuntu kubuntu edubuntu xubuntu mythbuntu netbook).

Tests

cron.germinate has no proper tests, but it only generates a couple of output files and this patch shouldn't change them, so it's easy to confirm that. I tested this on mawson by taking a copy of the output directory (/srv/launchpad.net/ubuntu-archive/ubuntu-misc), running the new cron.germinate script (with no arguments), and then running 'diff -ru' on the old and new output directories to confirm that the output was identical.

Demo and Q/A

See the "Tests" section.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
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/cron.germinate'
2--- cronscripts/publishing/cron.germinate 2010-09-06 09:46:01 +0000
3+++ cronscripts/publishing/cron.germinate 2010-11-02 16:14:46 +0000
4@@ -37,10 +37,21 @@
5 # Clean up temporary files
6 rm -f germinate.output ALL ALL.sources UBUNTU-* KUBUNTU-* EDUBUNTU-* XUBUNTU-* MYTHBUNTU-* NETBOOK-*
7 rm -f all_* all.sources_*
8+rm -rf dists
9
10-# Grab a local copy of Sources files
11+# Grab local copies of Sources and Packages files, to avoid problems in case
12+# the archive changes under our feet.
13 for component in main universe restricted multiverse; do
14- zcat $ARCHIVEROOT/dists/"$suite"/"$component"/source/Sources.gz > archive.ubuntu.com_"$suite"_"$component"_Sources;
15+ base="dists/$suite/$component"
16+ mkdir -p "$base/source"
17+ zcat "$ARCHIVEROOT/$base/source/Sources.gz" > "$base/source/Sources"
18+ for arch in i386 amd64 powerpc armel; do
19+ mkdir -p "$base/binary-$arch" "$base/debian-installer/binary-$arch"
20+ zcat "$ARCHIVEROOT/$base/binary-$arch/Packages.gz" \
21+ > "$base/binary-$arch/Packages"
22+ zcat "$ARCHIVEROOT/$base/debian-installer/binary-$arch/Packages.gz" \
23+ > "$base/debian-installer/binary-$arch/Packages"
24+ done
25 done
26
27 > "$MISCROOT/more-extra.override.$suite.main.new"
28@@ -50,15 +61,9 @@
29 DISTRO="$(echo $distro | tr a-z A-Z)"
30 germinate_suite="$distro.$suite"
31 for arch in i386 amd64 powerpc armel; do
32- # Grab local copy of Packages and InstallerPackages files
33- for component in main universe restricted multiverse; do
34- zcat $ARCHIVEROOT/dists/"$suite"/"$component"/binary-$arch/Packages.gz > archive.ubuntu.com_"$suite"_"$component"_Packages
35- zcat $ARCHIVEROOT/dists/"$suite"/"$component"/debian-installer/binary-$arch/Packages.gz > archive.ubuntu.com_"$suite"_"$component"_InstallerPackages
36- done
37-
38 # Run germinate
39 echo " **************** $distro/$suite/$arch ********************* " >> germinate.output
40- germinate --no-rdepends -s "$germinate_suite" -d "$suite" -c "$germinate_components" -a $arch >> germinate.output 2>&1
41+ germinate --no-rdepends -m "file://$(pwd)/" -s "$germinate_suite" -d "$suite" -c "$germinate_components" -a $arch >> germinate.output 2>&1
42
43 # The structure file is generally useful; keep per distro/suite/arch
44 # copies for convenience