#!/bin/bash set -e set -u ulimit -d 3500000 -m 3500000 -v 3500000 umask 002 OPTIONS="$@" qoption () { for a in $OPTIONS; do if [ "$a" = "$1" ]; then return 0; fi; done return 1 } option () { for a in $OPTIONS; do if [ "$a" = "$1" ]; then date -uR; return 0; fi; done return 1 } # DATE NOW=`date +"%Y%m%d%H%M%S" -u` # Dirs: BASE=/srv/release.debian.org/britney DAK_LOCKDIR=/srv/ftp.debian.org/lock D_I=$BASE/d-i ETC=$BASE/etc VAR=$BASE/var SSH=$BASE/ssh HEIDI=$BASE/Heidi INPUT=$BASE/input CODE=$BASE/code/b1 CODE_B2=$BASE/code/b2 DATA=$VAR/data LOCKDIR=$VAR/lock HEIDI_SET=$HEIDI/set SCRIPTS=$CODE/scripts FAUXDIR=$CODE/fauxpkg UPDATE_OUT=$CODE/update_out URGENCIES=$INPUT/urgencies LOCK=$LOCKDIR/britney.lock DAK_LOCK=$DAK_LOCKDIR/daily.lock DAK_STOP=$DAK_LOCKDIR/archive.stop STABLE=$DATA/stable TESTING=$DATA/testing UNSTABLE=$DATA/unstable TPU=$DATA/testing-proposed-updates B2_CONFIG=$ETC/britney2.conf # TODO: VCS it, maybe by making a symlink B2_CONFIG_NOBREAKALL=$ETC/britney2_nobreakall.conf # TODO: ditto POLYBIOS_FILES_PRE=$ETC/polybios_files_pre.list POLYBIOS_FILES_POST=$ETC/polybios_files_post.list FAUXPKG_SCRIPT=$FAUXDIR/fauxpkg.py SSH_KEY=$SSH/ftp-master_trigger_key SSH_B2_RSYNC_KEY=$SSH/polybios_b2-rsync_key SSH_B2_TRIGGER_KEY=$SSH/polybios_b2-trigger_key HTML=/srv/release.debian.org/www/britney CHECKRUN=$BASE/hints/rerun if [ -f $DAK_STOP ]; then echo "$DAK_STOP exists, not running" exit 1 fi # 10800 seconds = 3 hours # 129600 seconds = 36 hours if ! lockfile -r0 -l129600 $LOCK 2>/dev/null >/dev/null; then if ! qoption checkrun; then echo "Could not get britney lockfile!" ls -l "$LOCK" fi exit 1 fi trap exit_function 0 exit_function () { rm -f $LOCK } # Is a run needed? if qoption checkrun; then x="$(find $CHECKRUN -type f)" if [ "$x" = "" ]; then exit 0; fi echo "RUN" find $CHECKRUN -type f -exec rm -f {} \; fi if ! qoption allowdaklock; then while [ -f $DAK_LOCK ]; do echo `date` $DAK_LOCK exists. Sleeping in 10 more minutes. sleep 600 done fi # First, update the .list files if option regen; then echo JENNA UNSTABLE: dak make-suite-file-list --suite=unstable fi # First, update the .list files if option commitjen; then echo JENNA TESTING: dak make-suite-file-list --suite=testing fi if option urgencies; then echo URGENCIES: cd $BASE for u in $URGENCIES/install-urgencies-*; do [ -e "$u" ] || continue cat "$u" >> $DATA/testing/Urgency # XXX I'd rather not have this in $DATA --dato rm "$u" done fi if option aptftp; then cd $CODE echo APT: apt-ftparchive -q -o APT::FTPArchive::Contents=off --readonly \ generate get_testing.conf fi if option merge; then echo MERGE: ssh -f -2 -o BatchMode=yes -i $SSH_B2_TRIGGER_KEY britney2@polybios.ayous.org merge || true cd $DATA for a in stable testing testing-proposed-updates unstable; do for b in $(cd ${a}_main; echo *); do cat ${a}_*/$b > ${a}/$b done done fi if option srcmerge; then echo SRCMERGE: cd $DATA for a in testing unstable; do for arch in i386; do $CODE/create-faux-build-packages.pl $arch < $a/Sources >> ${a}/Packages_${arch} done done fi if option fauxmerge; then echo FAUXMERGE: $FAUXPKG_SCRIPT generate $TESTING $UNSTABLE fi if option killxlibs; then echo KILLXLIBS: for a in $DATA/{testing,unstable}/Packages_*; do perl -i -ne 'chomp; if (m/^Depends:/) { s/\|\s*(libesd-alsa0|xlibs)[^|,]*//g; } print "$_\n";' $a done fi if option killgnome; then echo KILLGNOME: for a in $DATA/{unstable,testing}/Packages_i386; do sed -i -n '/^Package: gnome$/,/^$/b;p' $a #sed -i -n '/^Package: gnome-desktop-environment$/,/^$/b;p' $a sed -i -n '/^Package: gnome-fifth-toe$/,/^$/b;p' $a done fi if option kill336385; then echo FAKEMELANIE: for a in $DATA/unstable/Packages_{hppa,m68k,arm}; do cat $a | sed -n '/^Package: \(lib\(qt\|kde\|dcop\)3-jni\|libdcop3-java-dev\)/,/^$/b;p' > ${a}.x mv ${a}.x $a done fi if option bugs; then echo BUGS: cd $BASE wget --quiet -O $UNSTABLE/Bugs.new http://bugs.debian.org/stats/impbugs.txt wget --quiet -O $UNSTABLE/BugsV.new http://bugs.debian.org/release-critical/britney/unstable-nr wget --quiet -O $TESTING/BugsV.new http://bugs.debian.org/release-critical/britney/testing-nr for x in $UNSTABLE/Bugs $UNSTABLE/BugsV $TESTING/BugsV; do if [ -s ${x}.new ]; then mv ${x}.new $x; else rm $x.new; exit 1; fi done fi polybios_rsync () { rsync -arL -e "ssh -2 -o BatchMode=yes -i $SSH_B2_RSYNC_KEY" --files-from=$1 $BASE britney2@polybios.ayous.org: || true } if option updateout; then polybios_rsync $POLYBIOS_FILES_PRE echo UPDATE_OUT: cd $UPDATE_OUT ./update_out.py $TESTING $UNSTABLE $TPU polybios_rsync $POLYBIOS_FILES_POST ssh -f -2 -o BatchMode=yes -i $SSH_B2_TRIGGER_KEY britney2@polybios.ayous.org run || true fi if option save; then cd $BASE echo RESULTS: HEIDI_FILENAME=$HEIDI_SET/`date -u +"%Y-%m-%d_%H.%M"` HEIDI_CURRENT=$HEIDI_SET/current (grep -Evi ' faux$' $TESTING/HeidiResult | cut -d\ -f1-3 | sort -u; cat $D_I/HeidiDI) >$HEIDI_FILENAME if cmp --quiet $HEIDI_FILENAME $HEIDI_CURRENT; then echo HeidiResult identical to current, not saving else gzip --best `readlink -f $HEIDI_CURRENT` ln -sf `basename $HEIDI_FILENAME` $HEIDI_CURRENT fi ssh -2 -T -o BatchMode=yes -i $SSH_KEY dak@ries.debian.org $SCRIPTS/udeb-report fi if option udeb_report; then # no echo UDEB_REPORT here, because this gets sent by mail, and it # may generate no output $SCRIPTS/udeb-report fi create_uninst_report () { python $CODE_B2/britney.py -c $1 --print-uninst >$HTML/$2.new echo -e "\n# Generated: `date -uR`" >>$HTML/$2.new mv $HTML/$2.new $HTML/$2 } create_ood_report () { $SCRIPTS/ood_report.py $1 >$HTML/$2.new echo -e "\n# Generated: `date -uR`" >>$HTML/$2.new mv $HTML/$2.new $HTML/$2 } if option stats; then echo STATS: cp $UPDATE_OUT/update.EXCUSES_py $HTML/update_excuses.html cp $UPDATE_OUT/update.OUTPUT_py $HTML/update_output.txt gzip -9 < $HTML/update_excuses.html > $HTML/update_excuses.html.gz gzip -9 < $HTML/update_output.txt > $HTML/update_output.txt.gz cp $HTML/update_output.txt.gz $HTML/update_output/$NOW.txt.gz cp $HTML/update_excuses.html.gz $HTML/update_excuses/$NOW.html.gz # TODO: {stable,unstable}_uninst.txt -- needs support in b2, talk to Fabio make -C $CODE_B2 sync create_uninst_report $B2_CONFIG testing_uninst.txt create_uninst_report $B2_CONFIG_NOBREAKALL testing_uninst_full.txt if grep -q -e '-meta-faux' $HTML/testing_uninst.txt; then echo >&2 'Warning! Some -meta-faux package is uninstallable!' fi create_ood_report $STABLE stable_outdate.txt create_ood_report $TESTING testing_outdate.txt fi if option summary; then cd $BASE echo "Out of dates holding up testing:" TERM=vt100 lynx -nolist -dump $HTML/update_excuses.html | sed -n 's/^ *[^ ] *[^ ]*out of date on \([^ ]*\): .*$/\1/p' | sort | uniq -c | sort -n echo "Uninstallables holding up testing:" sed < $HTML/update_excuses.html -n 's/^ *
  • [^ ]* (\([^, ]*\),.*) uninstallable.*$/\1/p' | sort | uniq -c | sort -n #echo "wanna-build stats:" #for a in alpha arm hppa hurd-i386 i386 ia64 m68k mips mipsel powerpc s390 sparc; do # printf " %-12s " "$a:" # /srv/wanna-build/bin/wanna-build-statistics --database=$a/build-db | # grep "if also counting" || echo "-" #done fi if option archivedata; then echo ARCHIVE: cd $VAR tar czf data_bkup/data-$(date +"%Y.%m.%d").tgz data/{stable,testing,unstable,testing-proposed-updates} fi echo -n "Finished at: "; date -uR