~launchpad-pqm/launchpad/devel

10382.3.1 by Julian Edwards
first cut of cron job for copy archives
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.
8
if [ -z $LPCONFIG ]; then
9
    echo LPCONFIG must be set to run this script.
10
    exit 1
11
fi
12
13
set -e
14
set -u
15
10382.3.2 by Julian Edwards
remove unused stuff
16
#
17
# This script publishes the COPY (rebuild) archvies *only*.
18
#
19
10382.3.1 by Julian Edwards
first cut of cron job for copy archives
20
21
# Informational -- this *MUST* match the database.
10678.2.1 by Julian Edwards
Changes to cron.publish-copy-archives copied from the actual changes made in production to get it working
22
ARCHIVEROOT=/srv/launchpad.net/rebuild-test/ubuntu
10382.3.1 by Julian Edwards
first cut of cron job for copy archives
23
DISTSROOT=$ARCHIVEROOT/dists
24
OVERRIDEROOT=$ARCHIVEROOT/../ubuntu-overrides
25
INDICES=$ARCHIVEROOT/indices
11049.1.2 by Julian Edwards
Fix cronscripts that know too much about LPCONFIG
26
PRODUCTION_CONFIG=ftpmaster-publish
10382.3.1 by Julian Edwards
first cut of cron job for copy archives
27
28
if [ "$LPCONFIG" = "$PRODUCTION_CONFIG" ]; then
10678.2.1 by Julian Edwards
Changes to cron.publish-copy-archives copied from the actual changes made in production to get it working
29
    GNUPGHOME=/srv/launchpad.net/rebuild-test/gnupg-home
10382.3.1 by Julian Edwards
first cut of cron job for copy archives
30
else
10382.3.2 by Julian Edwards
remove unused stuff
31
    echo GPG keys will come from ~/.gnupg
10382.3.1 by Julian Edwards
first cut of cron job for copy archives
32
    # GNUPGHOME does not need to be set, keys can come from ~/.gnupg.
33
fi
34
35
# Configuration options.
10678.2.1 by Julian Edwards
Changes to cron.publish-copy-archives copied from the actual changes made in production to get it working
36
LAUNCHPADROOT=/srv/launchpad.net/production/launchpad
37
LOCKFILE=/srv/launchpad.net/rebuild-test/cron.daily.lock
10382.3.1 by Julian Edwards
first cut of cron job for copy archives
38
DISTRONAME=ubuntu
39
40
# Manipulate the environment.
41
export GNUPGHOME
42
PATH=$PATH:$LAUNCHPADROOT/scripts:$LAUNCHPADROOT/cronscripts:$LAUNCHPADROOT/cronscripts/publishing:$LAUNCHPADROOT/scripts/ftpmaster-tools
43
44
# Claim the lock.
45
if ! lockfile -r1 $LOCKFILE; then
46
  echo "Could not claim lock file."
47
  exit 1
48
fi
49
50
# Lock claimed.
51
10382.3.2 by Julian Edwards
remove unused stuff
52
cleanup () {
53
  echo "Cleaning up lockfile."
54
  rm -f $LOCKFILE
55
}
56
57
trap cleanup EXIT
58
10382.3.1 by Julian Edwards
first cut of cron job for copy archives
59
# Process the accepted queue into the publishing records.
60
process-accepted.py --copy-archive -v -v -v $DISTRONAME
61
62
# Publish the packages to disk.
63
publish-distro.py -v -v --copy-archive -d $DISTRONAME
64
65
echo Removing uncompressed Packages and Sources files
66
find ${DISTSROOT} \( -name "Packages" -o -name "Sources" \) -exec rm "{}" \;