X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=config%2Fdebian-security%2Fcron.buildd;h=cd8a6851d47000fdc3bb42c8f7d3ea9c9f0659dd;hb=f54c87736c85e9c72b1693f9db50848992f88f61;hp=e52cbb4a8c4d084d499761b370052b44cdbd5926;hpb=2380849f2c632e17b8318e344e8af20e97c6bde9;p=dak.git diff --git a/config/debian-security/cron.buildd b/config/debian-security/cron.buildd index e52cbb4a..cd8a6851 100755 --- a/config/debian-security/cron.buildd +++ b/config/debian-security/cron.buildd @@ -3,71 +3,64 @@ # Executed after cron.unchecked set -e +set -o pipefail set -u export SCRIPTVARS=/srv/security-master.debian.org/dak/config/debian-security/vars . $SCRIPTVARS SSH_SOCKET=~/.ssh/buildd.debian.org.socket -DISTS=$(dak admin s list) +DISTS="oldstable stable stable-kfreebsd testing" if [ -e $ftpdir/Archive_Maintenance_In_Progress ]; then - exit 0 + exit 0 fi -for dist in $DISTS; do - eval SOURCES_$dist=`stat -c "%Y" $base/buildd/$dist/Sources.gz` - eval PACKAGES_$dist=`stat -c "%Y" $base/buildd/$dist/Packages.gz` -done - -cd $configdir -apt-ftparchive -qq -o APT::FTPArchive::Contents=off generate apt.conf.buildd - -cd ${base}/buildd -for dist in $DISTS; do - rm -f $dist/Release* - archs=$(dak admin s-a list-arch $dist | tr '\n' ' ') - apt-ftparchive -qq -o APT::FTPArchive::Release::Origin="Debian" -o APT::FTPArchive::Release::Label="Debian" -o APT::FTPArchive::Release::Description="buildd $dist security" -o APT::FTPArchive::Release::Architectures="${archs}" release $dist > Release - gpg --secret-keyring ${base}/s3kr1t/dot-gnupg/secring.gpg --keyring ${base}/s3kr1t/dot-gnupg/pubring.gpg --no-options --batch --no-tty --armour --default-key 55BE302B --detach-sign -o Release.gpg Release - mv Release* $dist/. -done - dists= - +now=$(date +%s) +check=$(( now - 3*60 )) for dist in $DISTS; do - eval NEW_SOURCES_$dist=`stat -c "%Y" $base/buildd/$dist/Sources.gz` - eval NEW_PACKAGES_$dist=`stat -c "%Y" $base/buildd/$dist/Packages.gz` - old=SOURCES_$dist - new=NEW_$old - if [ ${!new} -gt ${!old} ]; then - if [ -z "$dists" ]; then - dists="$dist" - else - dists="$dists $dist" - fi - continue - fi - old=PACKAGES_$dist - new=NEW_$old - if [ ${!new} -gt ${!old} ]; then - if [ -z "$dists" ]; then - dists="$dist" - else - dists="$dists $dist" - fi - continue - fi + smodtime=$(stat -c "%Y" $base/build-queues/dists/buildd-$dist/updates/*/source/Sources.gz | sort -n | tail -1) + pmodtime=$(stat -c "%Y" $base/build-queues/dists/buildd-$dist/updates/*/binary-*/Packages.gz | sort -n | tail -1) + + if [ ${smodtime} -gt ${check} ] || [ ${pmodtime} -gt ${check} ]; then + # Packages/Sources changed in the last minutes + dists="${dists} ${dist}" + else + continue + fi done -if [ ! -z "$dists" ]; then - # setup ssh master process - ssh wbadm@buildd -S $SSH_SOCKET -MN 2> /dev/null & - SSH_PID=$! - while [ ! -S $SSH_SOCKET ]; do - sleep 1 - done - trap 'kill -TERM $SSH_PID' 0 - for d in $dists; do - ssh wbadm@buildd -S $SSH_SOCKET trigger.security $d - done +if [ ! -z "${dists}" ]; then + # setup ssh master process + ssh wbadm@buildd -S $SSH_SOCKET -MN 2> /dev/null & + SSH_PID=$! + while [ ! -S $SSH_SOCKET ]; do + sleep 1 + done + trap 'kill -TERM $SSH_PID' 0 + for d in ${dists}; do + case ${d} in + oldoldstable) + send=squeeze + ;; + oldstable) + send=wheezy + ;; + stable) + send=jessie + ;; + stable-kfreebsd) + send=jessie-kfreebsd + ;; + testing) + send=stretch + ;; + *) + send=unknown + ;; + esac + + ssh wbadm@buildd -S $SSH_SOCKET trigger.security $send + done fi