X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=config%2Fbackports%2Fcron.unchecked;h=46f30e07c8655a758c9db6bb97c5b3ed5ad3d1fb;hb=ec257c02a5d62fd27844c70814acd9616b24b4c8;hp=78eccd11f51d3389a3060afbcb37f56fd275ab39;hpb=ed7214355e422907c17de049e0ff31de48fabf8c;p=dak.git diff --git a/config/backports/cron.unchecked b/config/backports/cron.unchecked index 78eccd11..46f30e07 100755 --- a/config/backports/cron.unchecked +++ b/config/backports/cron.unchecked @@ -1,34 +1,107 @@ -#! /bin/sh +#! /bin/bash + +# 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 -export SCRIPTVARS=/srv/backports-master.debian.org/config/backports/vars +# make sure to only use defined variables +set -u +# 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 + +export SCRIPTVARS=/srv/backports-master.debian.org/dak/config/backports/vars . $SCRIPTVARS + +LOCKDAILY="" LOCKFILE="$lockdir/unchecked.lock" +LOCK_NEW="$lockdir/processnew.lock" NOTICE="$lockdir/daily.lock" +LOCK_BUILDD="$lockdir/buildd.lock" +# The state file telling us we have something new to do +DINSTALLPACKAGES="${lockdir}/dinstall.packages" + +# our name +PROGRAM="unchecked" + +if [ -e $NOTICE ]; then + exit 0; +fi + +######################################################################## +# Functions # +######################################################################## +# common functions are "outsourced" +. "${configdir}/common" + +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 } -trap cleanup 0 + +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.lenny-backports.$i >> override.sid.all3 + if [ "$i" != "main.debian-installer" ]; then + cat override.lenny-backports.$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 +} + +######################################################################## +# the actual unchecked functions follow # +######################################################################## + +# And use one locale, no matter what the caller has set +export LANG=C +export LC_ALL=C # only run one cron.unchecked -if lockfile -r3 $LOCKFILE; then - 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 - else - echo "$timestamp": Nothing to do >> $report - fi -fi +lockfile -r3 $LOCKFILE || exit 0 +trap cleanup 0 + +do_newstage +do_unchecked -rm -f "$LOCKFILE" +if [ ! -z "$changes" ]; then + touch ${DINSTALLPACKAGES} + sync_debbugs + do_buildd + +# echo "Starting g-p-s: $(date +%H:%M:%S)" +# do_dists +# echo "Done with g-p-s: $(date +%H:%M:%S)" +fi