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
|
#! /bin/sh
set -e
MIRROR="$HOME/mirror/ubuntu"
GERMINATE="$HOME/mirror/ubuntu-germinate"
OUT="$HOME/public_html"
mtimes="$(mktemp -d)"
cleanup () {
rm -rf "$mtimes"
}
trap cleanup EXIT HUP INT QUIT TERM
collect_mtimes () {
stat -c '%n %Y' \
"$MIRROR"/dists/*/Release \
"$GERMINATE/germinate.output" \
>"$mtimes/$1"
}
mtime () {
(grep "^$2 " "$mtimes/$1" || echo "$2 0") | cut -d' ' -f2
}
mtime_changed () {
[ "$(mtime old "$1")" != "$(mtime new "$1")" ]
}
release_changed () {
mtime_changed "$MIRROR/dists/$1/Release"
}
germinate_changed () {
mtime_changed "$GERMINATE/germinate.output"
}
PIDS=
background () {
"$@" &
PIDS="${PIDS:+$PIDS }$!"
}
background_wait () {
for pid in $PIDS; do
wait "$pid"
done
PIDS=
}
collect_mtimes old
rsync -a \
--exclude dapper\* --exclude edgy\* --exclude feisty\* \
--exclude gutsy\* --exclude intrepid\* --exclude jaunty\* \
--exclude karmic\* --exclude maverick\* \
--include Packages\* --include Sources\* --include Release\* \
--include udeb.list --include \*\*/installer-\*/current \
--include \*\*/raring/Contents-\* \
--include \*/ --exclude \* --delete --prune-empty-dirs \
ftpmaster.internal::ubuntu-dists/ "$MIRROR/dists/"
collect_mtimes new
for dist in "$HOME/.chdist"/*; do
[ -d "$dist" ] || continue
suite="${dist##*/}"
suite="${suite%-mainonly}"
suite="${suite%-*}"
if release_changed "$suite"; then
background chdist apt-get "${dist##*/}" update >/dev/null
fi
done
background_wait
if release_changed raring; then
background run-britney
background cron.NBS
fi
if release_changed raring || release_changed raring-proposed; then
background run-proposed-migration
fi
if release_changed raring-proposed; then
rsync -a --delete --prune-empty-dirs \
"$MIRROR/dists/raring/" \
/srv/chroots/lucid-transitions/srv/transitions/mirror/ubuntu/dists/raring/
rsync -a --delete --prune-empty-dirs \
"$MIRROR/dists/raring-proposed/" \
/srv/chroots/lucid-transitions/srv/transitions/mirror/ubuntu/dists/raring-proposed/
background update-transitions
fi
background_wait
rsync -a \
--include germinate.output \
--exclude _\* --include \*_raring_\* \
--exclude \* --delete \
ftpmaster.internal::ubuntu-germinate/ "$GERMINATE/"
collect_mtimes new
if germinate_changed; then
# Give germinate a two minute window to stop spewing to output
# and assume it's finished, this should be more than enough time,
# given that it outputs nearly constantly when run, and completes
# in under three minutes, on average
NEW_GERMINATE_MTIME="$(mtime new "$GERMINATE/germinate.output")"
if [ $(($(date +%s) - $NEW_GERMINATE_MTIME)) -gt 120 ]; then
component_mismatches () {
component-mismatches -d "$OUT/component-mismatches.dot" -o "$OUT/component-mismatches.txt.new"
process-component-mismatches-diff \
"$OUT/component-mismatches.txt" \
"$OUT/component-mismatches.txt.new"
mv "$OUT/component-mismatches.txt.new" \
"$OUT/component-mismatches.txt"
dot -Tsvg -Gdpi=55 -o "$OUT/component-mismatches.svg" "$OUT/component-mismatches.dot"
}
background component_mismatches
background priority-mismatches -o "$OUT/priority-mismatches.txt"
background architecture-mismatches -o "$OUT/architecture-mismatches.txt"
background_wait
else
# Artifically bump $GERMINATE/germinate.output into the past
touch -d @$(($NEW_GERMINATE_MTIME - 1)) $GERMINATE/germinate.output
fi
fi
|