3 # Updates wanna-build databases after the archive maintenance
7 # Sources-* == upstream fetched file
8 # Sources.* == uncompressed, concat'd version
10 #testing must be before unstable so late upld don't build for testing needlessly
11 DISTS="oldstable-security stable-security testing-security stable testing unstable"
12 STATS_DISTS="unstable testing stable"
13 SECTIONS="main contrib non-free"
14 ARCHS_oldstable="m68k arm sparc alpha powerpc i386 mips mipsel ia64 hppa s390"
15 ARCHS_stable="$ARCHS_oldstable"
16 ARCHS_testing="$ARCHS_stable"
17 ARCHS_unstable="$ARCHS_testing hurd-i386"
18 TMPDIR="/org/wanna-build/tmp"
19 WGETOPT="-q -t2 -w0 -T10"
20 CURLOPT="-q -s -S -f -y 5 -K /org/wanna-build/trigger.curlrc"
21 LOCKFILE="/org/wanna-build/tmp/DB_Maintenance_In_Progress"
25 if lockfile -! -l 3600 $LOCKFILE; then
26 echo "Cannot lock $LOCKFILE"
35 echo Updating wanna-build databases...
38 if [ "$DAY" = "0" ]; then
39 savelog -c 26 -p /org/wanna-build/db/merge.log
42 exec >> /org/wanna-build/db/merge.log 2>&1
44 echo -------------------------------------------------------------------------
45 echo "merge triggered `date`"
50 # Make one big Packages and Sources file.
53 dist=`echo $d | sed s/-.*$//`
56 ARCHS="$ARCHS_oldstable"
62 ARCHS="$ARCHS_testing"
65 ARCHS="$ARCHS_unstable"
69 if [ "$d" = "unstable" ]; then
70 gzip -dc /org/incoming.debian.org/buildd/Sources.gz >> Sources.$d
73 rm -f Packages.$d.$a quinn-$d.$a
74 if [ "$d" = "unstable" ]; then
75 gzip -dc /org/incoming.debian.org/buildd/Packages.gz >> Packages.$d.$a
79 for s in $SECTIONS ; do
80 if echo $d | grep -qv -- -security; then
82 gzip -dc /org/ftp.debian.org/ftp/dists/$d/$s/source/Sources.gz >> Sources.$d
83 if [ "$d" = "testing" -o "$d" = "stable" ]; then
84 gzip -dc /org/ftp.debian.org/ftp/dists/$d-proposed-updates/$s/source/Sources.gz >> Sources.$d
89 gzip -dc /org/ftp.debian.org/ftp/dists/$d/$s/binary-$a/Packages.gz >> Packages.$d.$a
90 if [ "$d" = "testing" -o "$d" = "stable" ]; then
91 gzip -dc /org/ftp.debian.org/ftp/dists/$d-proposed-updates/$s/binary-$a/Packages.gz >> Packages.$d.$a
93 if [ "$d" = "unstable" -a "$s" = "main" ]; then
94 gzip -dc /org/ftp.debian.org/ftp/dists/$d/$s/debian-installer/binary-$a/Packages.gz >> Packages.$d.$a
99 if wget $WGETOPT http://security.debian.org/debian-security/dists/$dist/updates/$s/source/Sources.gz; then
100 mv Sources.gz Sources-$d.$s.gz
102 gzip -dc Sources-$d.$s.gz >> Sources.$d
103 if [ "$s" = "main" ]; then
104 if curl $CURLOPT http://security.debian.org/buildd/$dist/Sources.gz -o Sources.gz; then
105 mv Sources.gz Sources-$d.accepted.gz
107 gzip -dc Sources-$d.accepted.gz >> Sources.$d
108 if curl $CURLOPT http://security.debian.org/buildd/$dist/Packages.gz -o Packages.gz; then
109 mv Packages.gz Packages.$d.accepted.gz
114 if wget $WGETOPT http://security.debian.org/debian-security/dists/$dist/updates/$s/binary-$a/Packages.gz; then
115 mv Packages.gz Packages.$d.$s.$a.gz
117 gzip -dc Packages.$d.$s.$a.gz >> Packages.$d.$a
118 if [ "$s" = "main" ]; then
119 gzip -dc Packages.$d.accepted.gz >> Packages.$d.$a
126 if [ "$d" = "unstable" -o ! -e "quinn-unstable.$a-old" ]; then
127 quinn-diff -A $a -a /org/buildd.debian.org/web/quinn-diff/Packages-arch-specific -s Sources.$d -p Packages.$d.$a >> quinn-$d.$a
129 if echo $d | grep -qv -- -security; then
130 quinn-diff -A $a -a /org/buildd.debian.org/web/quinn-diff/Packages-arch-specific -s Sources.$d -p Packages.$d.$a | fgrep -v -f quinn-unstable.$a-old | grep ":out-of-date\]$" >> quinn-$d.$a
131 sed -e 's/\[\w*:\w*]$//' quinn-$d-security.$a > quinn-$d-security.$a.grep
132 grep -vf quinn-$d-security.$a quinn-$d.$a > quinn-$d.$a.grep
133 mv quinn-$d.$a.grep quinn-$d.$a
134 rm quinn-$d-security.$a.grep
136 quinn-diff -A $a -a /org/buildd.debian.org/web/quinn-diff/Packages-arch-specific -s Sources.$d -p Packages.$d.$a >> quinn-$d.$a
143 for a in $ARCHS_unstable ; do
144 wanna-build --create-maintenance-lock --database=$a/build-db
147 dist=`echo $d | sed s/-.*$//`
150 if echo $ARCHS_oldstable | grep -q -v "\b$a\b"; then
155 if echo $ARCHS_stable | grep -q -v "\b$a\b"; then
160 if echo $ARCHS_testing | grep -q -v "\b$a\b"; then
165 if echo $ARCHS_unstable | grep -q -v "\b$a\b"; then
170 perl -pi -e 's#^(non-free)/.*$##msg' quinn-$d.$a
171 wanna-build --merge-all --arch=$a --dist=$d --database=$a/build-db Packages.$d.$a quinn-$d.$a Sources.$d
172 mv Packages.$d.$a Packages.$d.$a-old
173 mv quinn-$d.$a quinn-$d.$a-old
175 if [ "$DAY" = "0" ]; then
176 savelog -p -c 26 /org/wanna-build/db/$a/transactions.log
178 wanna-build --remove-maintenance-lock --database=$a/build-db
182 mv Sources.$d Sources.$d-old
185 echo "merge ended `date`"
186 /org/wanna-build/bin/wb-graph >> /org/wanna-build/etc/graph-data
187 /org/wanna-build/bin/wb-graph -p >> /org/wanna-build/etc/graph2-data
190 /org/buildd.debian.org/bin/makegraph
191 for a in $ARCHS_stable; do
192 echo Last Updated: `date -u` > /org/buildd.debian.org/web/stats/$a.txt
193 for d in $STATS_DISTS; do
194 /org/wanna-build/bin/wanna-build-statistics --database=$a/build-db --dist=$d >> /org/buildd.debian.org/web/stats/$a.txt