X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=config%2Fdebian-security%2Fcron.buildd;h=33f847c35db0fbe4bff26c7c90e6d6fcbc1a6e8e;hb=19ffc1de995fd165d9438a8b7769cd7c45bbce60;hp=05f2d1385a06e03d618885e1e2aae718c9507329;hpb=59fd5aa2a8be3b76dbc968429c457f096adfa472;p=dak.git diff --git a/config/debian-security/cron.buildd b/config/debian-security/cron.buildd index 05f2d138..33f847c3 100755 --- a/config/debian-security/cron.buildd +++ b/config/debian-security/cron.buildd @@ -1,67 +1,63 @@ #! /bin/bash # -# Executed after jennifer (merge there??) - -ARCHS_oldstable="alpha arm hppa i386 ia64 m68k mips mipsel powerpc sparc s390" -ARCHS_stable="$ARCHS_oldstable" -ARCHS_testing="$ARCHS_stable" -DISTS="oldstable stable testing" -SSH_SOCKET=~/.ssh/buildd.debian.org.socket +# Executed after cron.unchecked set -e -export SCRIPTVARS=/org/security.debian.org/katie/vars-security +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="stable testing" -if [ ! -e $ftpdir/Archive_Maintenance_In_Progress ]; then - cd $masterdir - for d in $DISTS; do - eval SOURCES_$d=`stat -c "%Y" $base/buildd/$d/Sources.gz` - eval PACKAGES_$d=`stat -c "%Y" $base/buildd/$d/Packages.gz` - done - apt-ftparchive -qq generate apt.conf.buildd-security - dists= - for d in $DISTS; do - eval NEW_SOURCES_$d=`stat -c "%Y" $base/buildd/$d/Sources.gz` - eval NEW_PACKAGES_$d=`stat -c "%Y" $base/buildd/$d/Packages.gz` - old=SOURCES_$d - new=NEW_$old - if [ ${!new} -gt ${!old} ]; then - if [ -z "$dists" ]; then - dists="$d" - else - dists="$dists $d" - fi - continue - fi - old=PACKAGES_$d - new=NEW_$old - if [ ${!new} -gt ${!old} ]; then - if [ -z "$dists" ]; then - dists="$d" - else - dists="$dists $d" - fi - continue - fi - done - if [ ! -z "$dists" ]; then - # setup ssh master process - ssh buildd@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 - archs=ARCHS_$d - ARCHS=${!archs} - cd /org/security.debian.org/buildd/$d - for a in $ARCHS; do - quinn-diff -a /org/security.debian.org/buildd/Packages-arch-specific -A $a 2>/dev/null | ssh buildd@buildd -S $SSH_SOCKET wanna-build -d $d-security -b $a/build-db --merge-partial-quinn - ssh buildd@buildd -S $SSH_SOCKET wanna-build -d $d-security -A $a -b $a/build-db --merge-packages < Packages - done - done - fi +if [ -e $ftpdir/Archive_Maintenance_In_Progress ]; then + exit 0 fi -ssh buildd@bester.farm.ftbfs.de -i ~/.ssh/id_bester sleep 1 +dists= +now=$(date +%s) +check=$(( now - 3*60 )) + +for dist in $DISTS; do + 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 + case ${d} in + oldoldstable) + send=squeeze + ;; + oldstable) + send=wheezy + ;; + stable) + send=jessie + ;; + testing) + send=stretch + ;; + *) + send=unknown + ;; + esac + + ssh wbadm@buildd -S $SSH_SOCKET trigger.security $send + done +fi