1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
#!/bin/sh
# download current package indexes to data/<series>{,-proposed}/ for running
# britney against a PPA. The PPA will play the role of "-proposed" (i. e.
# "unstable" in britney terms, containing the updated packages to test), the
# Ubuntu archive has the "-release" part (i. e. "testing" in britney terms, in
# which the -proposed packages are being landed).
#
# Author: Martin Pitt <martin.pitt@ubuntu.com>
# Author: Robert Bruce Park <robert.park@canonical.com>
set -u
export OVERLAY="stable-phone-overlay"
export AMQP_URI=$(cat ~/amqp.uri)
export TEAM=$(cat ~/ppa.team)
export ARCHES="i386 amd64"
export PORTS_ARCHES="armhf arm64 powerpc ppc64el"
BRITNEY=/var/lib/britney/britney.py
CODEDIR=$(dirname "$(readlink -f "$0")")
DATADIR=/tmp/britney_data
OUTDIR=/tmp/britney_output
CACHE=$DATADIR/CACHE
ARCHIVE=http://archive.ubuntu.com/ubuntu/dists
PORTS=http://ports.ubuntu.com/dists
usage() {
cat <<EOF
Usage: $0 SERIES [SILONAME]
$1
SERIES:
Ubuntu release codename, eg trusty, xenial, etc.
SILONAME (optional):
Name of PPA to fetch; defaults to stable-phone-overlay.
EOF
exit 1
}
log() {
echo "$(date -Iseconds)" "$@"
}
# Echo something before running it.
# Needed because 'set -x' goes to stderr which I don't want.
loudly() {
log "$@"
"$@"
}
# Download files in parallel in background, only if there is an update
refresh() {
DIR=$CACHE/$pocket/$(echo $1 | rev | cut --delimiter=/ --fields=2,3 | rev)
mkdir --parents $DIR
wget --directory-prefix $DIR --timestamping $1 --append-output $DIR/$$-wget-log --no-verbose &
}
[ $# -gt 0 ] && export SERIES="$1" && shift || usage "Missing series."
if [ $# -gt 0 ]; then
export PPA="$1"
else
export PPA="$OVERLAY"
fi
PPA_URL=http://ppa.launchpad.net/$TEAM/$PPA/ubuntu/dists/$SERIES/main
# Enable s390x only for xenial or newer.
case "$SERIES" in
precise|trusty|vivid|wily)
export NEW_ARCHES=" "
;;
*)
export NEW_ARCHES="s390x"
export PORTS_ARCHES="$PORTS_ARCHES s390x"
;;
esac
log 'Refreshing package indexes...'
# Get archive bits
if [ "$PPA" = "$OVERLAY" ]; then
for pocket in $SERIES $SERIES-updates $SERIES-proposed; do
for component in main restricted universe multiverse; do
for arch in $ARCHES; do
refresh $ARCHIVE/$pocket/$component/binary-$arch/Packages.gz
done
for arch in $PORTS_ARCHES; do
refresh $PORTS/$pocket/$component/binary-$arch/Packages.gz
done
refresh $ARCHIVE/$pocket/$component/source/Sources.bz2
done
done
fi
# Get ppa bits
pocket=$PPA-$SERIES
for arch in $ARCHES $PORTS_ARCHES; do
refresh $PPA_URL/binary-$arch/Packages.gz
done
refresh $PPA_URL/source/Sources.bz2
# Get autopkgtest history so that we can correctly identify regressions
DIR=$DATADIR/$SERIES
wget --directory-prefix $DIR --timestamping http://people.canonical.com/~ubuntu-archive/proposed-migration/$SERIES/results.cache --append-output $DIR/$$-wget-log --no-verbose &
wait # for wgets to finish
find $DATADIR -name "$$-wget-log*" -exec cat '{}' \; -delete
log 'Building britney indexes...'
if [ "$PPA" = "$OVERLAY" ]; then
# "Testing" is archive + stable overlay ppa
DEST=$DATADIR/$SERIES
mkdir --parents $DEST
bzcat $CACHE/$SERIES*/*/source/Sources.bz2 \
$CACHE/$OVERLAY-$SERIES/*/source/Sources.bz2 \
> $DEST/Sources
for arch in $ARCHES $PORTS_ARCHES; do
zcat $CACHE/$SERIES*/*/binary-$arch/Packages.gz \
$CACHE/$OVERLAY-$SERIES/*/binary-$arch/Packages.gz \
> $DEST/Packages_${arch}
done
else
# "Unstable" is just silo PPA
DEST=$DATADIR/$PPA-$SERIES
mkdir --parents $DEST/autopkgtest
RESULTS="$DEST/autopkgtest/results.cache"
# Unconditional copy is necessary so that autopkgtests that pass by mistake
# and are then "fixed" to fail don't count as regressions. So a regression
# is only something that regresses compared to distro.
cp -v $DATADIR/$SERIES/results.cache $RESULTS
bzcat $CACHE/$PPA-$SERIES/*/source/Sources.bz2 > $DEST/Sources
for arch in $ARCHES $PORTS_ARCHES; do
zcat $CACHE/$PPA-$SERIES/*/binary-$arch/Packages.gz > $DEST/Packages_${arch}
done
touch $DEST/Blocks
# Create config file atomically.
CONFIG="$DEST.conf"
make --file "$CODEDIR/Makefile" "$CONFIG"
mkdir --parents "$OUTDIR/$SERIES/$PPA/"
loudly $BRITNEY --config "$CONFIG" --series $SERIES | sed "s#$AMQP_URI#AMQP_URI#"
fi
log "$0 done."
|