X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=config%2Fdebian%2Fcron.unchecked;h=c7d7dfdd2a402150bee9ffc1e470092987bf21c1;hb=ec257c02a5d62fd27844c70814acd9616b24b4c8;hp=1cdf36327ad4bdce1404074eaa38d2d5fd9cbfe4;hpb=cc2af6961cb73292e03feb0b298e5eac89ca3669;p=dak.git diff --git a/config/debian/cron.unchecked b/config/debian/cron.unchecked index 1cdf3632..c7d7dfdd 100755 --- a/config/debian/cron.unchecked +++ b/config/debian/cron.unchecked @@ -1,57 +1,109 @@ -#! /bin/sh +#!/bin/bash +# No way I try to deal with a crippled sh just for POSIX foo. +# Copyright (C) 2009 Joerg Jaspert +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; version 2. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +# exit on errors set -e +# make sure to only use defined variables set -u -export SCRIPTVARS=/srv/ftp.debian.org/dak/config/debian/vars +# ERR traps should be inherited from functions too. (And command +# substitutions and subshells and whatnot, but for us the functions is +# the important part here) +set -E + +# import the general variable set. +export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars . $SCRIPTVARS LOCKDAILY="" LOCKFILE="$lockdir/unchecked.lock" +LOCK_NEW="$lockdir/processnew.lock" NOTICE="$lockdir/daily.lock" +LOCK_BUILDD="$lockdir/buildd.lock" + +# our name +PROGRAM="unchecked" + +if [ -e $NOTICE ]; then + exit 0; +fi + +######################################################################## +# Functions # +######################################################################## +# common functions are "outsourced" +. "${configdir}/common" -if [ -e $NOTICE ]; then exit 0; fi +STAMP=$(date "+%Y%m%d%H%M") cleanup() { - rm -f "$LOCKFILE" - if [ ! -z "$LOCKDAILY" ]; then - rm -f "$NOTICE" - fi + rm -f "$LOCKFILE" + if [ ! -z "$LOCKDAILY" ]; then + rm -f "$NOTICE" + fi +} + +function do_buildd () { + if lockfile -r3 $NOTICE; then + LOCKDAILY="YES" + cd $overridedir + dak make-overrides &>/dev/null + rm -f override.sid.all3 override.sid.all3.src + for i in main contrib non-free main.debian-installer; do + cat override.sid.$i >> override.sid.all3 + if [ "$i" != "main.debian-installer" ]; then + cat override.sid.$i.src >> override.sid.all3.src + fi + done + make_buildd_dir + wbtrigger + fi } +function do_dists () { + cd $configdir + dak generate-filelist + dak generate-packages-sources >/dev/null +} + +######################################################################## +# the actual unchecked functions follow # +######################################################################## + +# And use one locale, no matter what the caller has set +export LANG=C +export LC_ALL=C + +#lockfile -r3 "$LOCK_NEW" +# acceptnew +#rm -f "$LOCK_NEW" + # only run one cron.unchecked -if lockfile -r3 $LOCKFILE; then - trap cleanup 0 - cd $unchecked - - changes=$(find . -maxdepth 1 -mindepth 1 -type f -name \*.changes | sed -e "s,./,," | xargs) - report=$queuedir/REPORT - timestamp=$(date "+%Y-%m-%d %H:%M") - - if [ ! -z "$changes" ]; then - echo "$timestamp": "$changes" >> $report - dak process-unchecked -a $changes >> $report - echo "--" >> $report - - # sync with debbugs -# $scriptsdir/ssh-move --server --ssh-identity /srv/ftp.debian.org/s3kr1t/id_debbugs-vt --ssh-move-path /home/debbugs/ssh-move --from-directory $queuedir/bts_version_track --to-directory /org/bugs.debian.org/versions/queue/ftp-master debbugs@bugs.debian.org \*.debinfo \*.versions - - if lockfile -r3 $NOTICE; then - LOCKDAILY="YES" - psql projectb -A -t -q -c "SELECT filename FROM queue_build WHERE queue = 0 AND suite = 5 AND in_queue = true AND filename ~ 'd(sc|eb)$'" > $dbdir/dists/unstable_accepted.list - cd $overridedir - dak make-overrides &>/dev/null - rm -f override.sid.all3 override.sid.all3.src - for i in main contrib non-free main.debian-installer; do - cat override.sid.$i >> override.sid.all3 - if [ "$i" != "main.debian-installer" ]; then - cat override.sid.$i.src >> override.sid.all3.src - fi - done - cd $configdir - apt-ftparchive -qq -o APT::FTPArchive::Contents=off generate apt.conf.buildd - . $configdir/cron.buildd - fi - else - echo "$timestamp": Nothing to do >> $report - fi +if ! lockfile -r8 $LOCKFILE; then + echo "aborting cron.unchecked because $LOCKFILE has already been locked" + exit 0 +fi +trap cleanup 0 + +do_newstage +do_unchecked + +if [ ! -z "$changes" ]; then + sync_debbugs + do_buildd + do_dists fi