+++ /dev/null
-#!/bin/bash
-#
-# Updates wanna-build databases after the archive maintenance
-# finishes
-#
-# Files:
-# Sources-* == upstream fetched file
-# Sources.* == uncompressed, concat'd version
-PATH="/bin:/usr/bin"
-#testing must be before unstable so late upld don't build for testing needlessly
-DISTS="oldstable-security stable-security testing-security stable testing unstable"
-STATS_DISTS="unstable testing stable"
-SECTIONS="main contrib non-free"
-ARCHS_oldstable="m68k arm sparc alpha powerpc i386 mips mipsel ia64 hppa s390"
-ARCHS_stable="$ARCHS_oldstable"
-ARCHS_testing="$ARCHS_stable"
-ARCHS_unstable="$ARCHS_testing hurd-i386"
-TMPDIR="/org/wanna-build/tmp"
-WGETOPT="-q -t2 -w0 -T10"
-CURLOPT="-q -s -S -f -y 5 -K /org/wanna-build/trigger.curlrc"
-LOCKFILE="/org/wanna-build/tmp/DB_Maintenance_In_Progress"
-
-DAY=`date +%w`
-
-if lockfile -! -l 3600 $LOCKFILE; then
- echo "Cannot lock $LOCKFILE"
- exit 1
-fi
-
-cleanup() {
- rm -f "$LOCKFILE"
-}
-trap cleanup 0
-
-echo Updating wanna-build databases...
-umask 027
-
-if [ "$DAY" = "0" ]; then
- savelog -c 26 -p /org/wanna-build/db/merge.log
-fi
-
-exec >> /org/wanna-build/db/merge.log 2>&1
-
-echo -------------------------------------------------------------------------
-echo "merge triggered `date`"
-
-cd $TMPDIR
-
-#
-# Make one big Packages and Sources file.
-#
-for d in $DISTS ; do
- dist=`echo $d | sed s/-.*$//`
- case "$dist" in
- oldstable)
- ARCHS="$ARCHS_oldstable"
- ;;
- stable)
- ARCHS="$ARCHS_stable"
- ;;
- testing)
- ARCHS="$ARCHS_testing"
- ;;
- *)
- ARCHS="$ARCHS_unstable"
- ;;
- esac
- rm -f Sources.$d
- if [ "$d" = "unstable" ]; then
- gzip -dc /org/incoming.debian.org/buildd/Sources.gz >> Sources.$d
- fi
- for a in $ARCHS ; do
- rm -f Packages.$d.$a quinn-$d.$a
- if [ "$d" = "unstable" ]; then
- gzip -dc /org/incoming.debian.org/buildd/Packages.gz >> Packages.$d.$a
- fi
- done
-
- for s in $SECTIONS ; do
- if echo $d | grep -qv -- -security; then
- rm -f Sources.gz
- gzip -dc /org/ftp.debian.org/ftp/dists/$d/$s/source/Sources.gz >> Sources.$d
- if [ "$d" = "testing" -o "$d" = "stable" ]; then
- gzip -dc /org/ftp.debian.org/ftp/dists/$d-proposed-updates/$s/source/Sources.gz >> Sources.$d
- fi
-
- rm -f Packages.gz
- for a in $ARCHS ; do
- gzip -dc /org/ftp.debian.org/ftp/dists/$d/$s/binary-$a/Packages.gz >> Packages.$d.$a
- if [ "$d" = "testing" -o "$d" = "stable" ]; then
- gzip -dc /org/ftp.debian.org/ftp/dists/$d-proposed-updates/$s/binary-$a/Packages.gz >> Packages.$d.$a
- fi
- if [ "$d" = "unstable" -a "$s" = "main" ]; then
- gzip -dc /org/ftp.debian.org/ftp/dists/$d/$s/debian-installer/binary-$a/Packages.gz >> Packages.$d.$a
- fi
- done
- else
- rm -f Sources.gz
- if wget $WGETOPT http://security.debian.org/debian-security/dists/$dist/updates/$s/source/Sources.gz; then
- mv Sources.gz Sources-$d.$s.gz
- fi
- gzip -dc Sources-$d.$s.gz >> Sources.$d
- if [ "$s" = "main" ]; then
- if curl $CURLOPT http://security.debian.org/buildd/$dist/Sources.gz -o Sources.gz; then
- mv Sources.gz Sources-$d.accepted.gz
- fi
- gzip -dc Sources-$d.accepted.gz >> Sources.$d
- if curl $CURLOPT http://security.debian.org/buildd/$dist/Packages.gz -o Packages.gz; then
- mv Packages.gz Packages.$d.accepted.gz
- fi
- fi
- rm -f Packages.gz
- for a in $ARCHS ; do
- if wget $WGETOPT http://security.debian.org/debian-security/dists/$dist/updates/$s/binary-$a/Packages.gz; then
- mv Packages.gz Packages.$d.$s.$a.gz
- fi
- gzip -dc Packages.$d.$s.$a.gz >> Packages.$d.$a
- if [ "$s" = "main" ]; then
- gzip -dc Packages.$d.accepted.gz >> Packages.$d.$a
- fi
- done
- fi
- done
-
- for a in $ARCHS ; do
- if [ "$d" = "unstable" -o ! -e "quinn-unstable.$a-old" ]; then
- 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
- else
- if echo $d | grep -qv -- -security; then
- 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
- sed -e 's/\[\w*:\w*]$//' quinn-$d-security.$a > quinn-$d-security.$a.grep
- grep -vf quinn-$d-security.$a quinn-$d.$a > quinn-$d.$a.grep
- mv quinn-$d.$a.grep quinn-$d.$a
- rm quinn-$d-security.$a.grep
- else
- 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
- fi
- fi
- done
-done
-
-umask 002
-for a in $ARCHS_unstable ; do
- wanna-build --create-maintenance-lock --database=$a/build-db
-
- for d in $DISTS ; do
- dist=`echo $d | sed s/-.*$//`
- case "$dist" in
- oldstable)
- if echo $ARCHS_oldstable | grep -q -v "\b$a\b"; then
- continue
- fi
- ;;
- stable)
- if echo $ARCHS_stable | grep -q -v "\b$a\b"; then
- continue
- fi
- ;;
- testing)
- if echo $ARCHS_testing | grep -q -v "\b$a\b"; then
- continue
- fi
- ;;
- *)
- if echo $ARCHS_unstable | grep -q -v "\b$a\b"; then
- continue
- fi
- ;;
- esac
- perl -pi -e 's#^(non-free)/.*$##msg' quinn-$d.$a
- wanna-build --merge-all --arch=$a --dist=$d --database=$a/build-db Packages.$d.$a quinn-$d.$a Sources.$d
- mv Packages.$d.$a Packages.$d.$a-old
- mv quinn-$d.$a quinn-$d.$a-old
- done
- if [ "$DAY" = "0" ]; then
- savelog -p -c 26 /org/wanna-build/db/$a/transactions.log
- fi
- wanna-build --remove-maintenance-lock --database=$a/build-db
-done
-umask 022
-for d in $DISTS; do
- mv Sources.$d Sources.$d-old
-done
-
-echo "merge ended `date`"
-/org/wanna-build/bin/wb-graph >> /org/wanna-build/etc/graph-data
-/org/wanna-build/bin/wb-graph -p >> /org/wanna-build/etc/graph2-data
-rm -f "$LOCKFILE"
-trap -
-/org/buildd.debian.org/bin/makegraph
-for a in $ARCHS_stable; do
- echo Last Updated: `date -u` > /org/buildd.debian.org/web/stats/$a.txt
- for d in $STATS_DISTS; do
- /org/wanna-build/bin/wanna-build-statistics --database=$a/build-db --dist=$d >> /org/buildd.debian.org/web/stats/$a.txt
- done
-done