Merge lp:~julian-edwards/launchpad/publish-copy-archives-bug-520520-cron-job 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-cron-job
Merge into: lp:launchpad
Diff against target: 88 lines (+84/-0)
1 file modified
cronscripts/publishing/cron.publish-copy-archives (+84/-0)
To merge this branch: bzr merge lp:~julian-edwards/launchpad/publish-copy-archives-bug-520520-cron-job
Reviewer Review Type Date Requested Status
Michael Nelson (community) code Approve
Review via email: mp+20119@code.launchpad.net

Commit message

Cron job bash script glue to publish 'copy' archives.

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

= Summary =
New bash cron script to publish COPY archives

== Proposed fix ==
This is some glue to pull in the various bits necessary to run the publisher.
It's largely a copy of the existing cron.publish-ftpmaster but with some un-
needed stuff removed.

Yeah, it's bash. It blows. No, there's no tests.

Revision history for this message
Michael Nelson (michael.nelson) wrote :

Hi Julian,

When I first looked at this, I was wondering why you don't define DISTRONAME earlier and then do:

ARCHIVEROOT=/srv/launchpad.net/DISTRONAME-archive/DISTRONAME

etc., but I see that it's the same in cron.publish-ftpmaster.

Also, another thing that's been inherited from the ftpmaster - the comment at the top about LPCONFIG coming from the environment so we can run it unaltered on dogfood, but then the check before copying indices that "$LPCONFIG" = "$PRODUCTION_CONFIG"... wouldn't we want to copy the indices on df?

I'm assuming this is what you've been testing like crazy on df yesterday...

15:00 < noodles> bigjools: this bash script - is it what you've been testing on df yesterday?
15:01 < bigjools> and today, yes

Great.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'cronscripts/publishing/cron.publish-copy-archives'
--- cronscripts/publishing/cron.publish-copy-archives 1970-01-01 00:00:00 +0000
+++ cronscripts/publishing/cron.publish-copy-archives 2010-02-25 12:10:37 +0000
@@ -0,0 +1,84 @@
1#!/bin/sh
2#
3# Copyright 2009 Canonical Ltd. This software is licensed under the
4# GNU Affero General Public License version 3 (see the file LICENSE).
5
6# LPCONFIG will come from the environment so this script can run unaltered
7# on dogfood.
8if [ -z $LPCONFIG ]; then
9 echo LPCONFIG must be set to run this script.
10 exit 1
11fi
12
13set -x
14set -e
15set -u
16
17#
18# This script publishes the COPY (rebuild) archvies *only*.
19#
20
21
22# Informational -- this *MUST* match the database.
23ARCHIVEROOT=/srv/launchpad.net/ubuntu-archive/ubuntu
24DISTSROOT=$ARCHIVEROOT/dists
25OVERRIDEROOT=$ARCHIVEROOT/../ubuntu-overrides
26INDICES=$ARCHIVEROOT/indices
27PRODUCTION_CONFIG=ftpmaster
28
29if [ "$LPCONFIG" = "$PRODUCTION_CONFIG" ]; then
30 GNUPGHOME=/srv/launchpad.net/ubuntu-archive/gnupg-home
31else
32 echo GPG keys will come from ~/.gnupg
33 # GNUPGHOME does not need to be set, keys can come from ~/.gnupg.
34fi
35
36# Configuration options.
37LAUNCHPADROOT=/srv/launchpad.net/codelines/current
38LOCKFILE=/srv/launchpad.net/ubuntu-archive/cron.daily.lock
39DISTRONAME=ubuntu
40TOUCHLIST=$ARCHIVEROOT/project/trace/$(hostname --fqdn)
41
42# Manipulate the environment.
43export GNUPGHOME
44PATH=$PATH:$LAUNCHPADROOT/scripts:$LAUNCHPADROOT/cronscripts:$LAUNCHPADROOT/cronscripts/publishing:$LAUNCHPADROOT/scripts/ftpmaster-tools
45
46# Claim the lock.
47if ! lockfile -r1 $LOCKFILE; then
48 echo "Could not claim lock file."
49 exit 1
50fi
51
52# Lock claimed.
53
54cleanup () {
55 echo "Cleaning up lockfile."
56 rm -f $LOCKFILE
57}
58
59trap cleanup EXIT
60
61# Process the accepted queue into the publishing records.
62process-accepted.py --copy-archive -v -v -v $DISTRONAME
63
64# Publish the packages to disk.
65publish-distro.py -v -v --copy-archive -d $DISTRONAME
66
67set +x
68
69echo Removing uncompressed Packages and Sources files
70find ${DISTSROOT} \( -name "Packages" -o -name "Sources" \) -exec rm "{}" \;
71
72# Copy in the indices.
73if [ "$LPCONFIG" = "$PRODUCTION_CONFIG" ]; then
74 echo Copying the indices into place.
75 rm -f $INDICES/override.*
76 cp $OVERRIDEROOT/override.* $INDICES
77fi
78
79# Touch everything you asked us to do.
80if [ "$LPCONFIG" = "$PRODUCTION_CONFIG" ]; then
81 for FILE in $TOUCHLIST; do
82 touch "$FILE"
83 done
84fi