123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- #!/bin/bash
- # No way I try to deal with a crippled sh just for POSIX foo.
- # Copyright (C) 2009 Joerg Jaspert <joerg@debian.org>
- #
- # 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
- set -o pipefail
- # 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
- # import the general variable set.
- export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
- . $SCRIPTVARS
- LOCKDAILY=""
- LOCKFILE="$lockdir/unchecked.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"
- STAMP=$(date "+%Y%m%d%H%M")
- cleanup() {
- rm -f "$LOCKFILE"
- if [ ! -z "$LOCKDAILY" ]; then
- rm -f "$NOTICE"
- fi
- }
- function do_buildd () {
- if lockfile -r3 $NOTICE; then
- LOCKDAILY="YES"
- make_buildd_dir
- wbtrigger
- fi
- }
- ########################################################################
- # 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 -r8 $LOCKFILE 2> /dev/null; then
- # echo "aborting cron.unchecked because $LOCKFILE has already been locked"
- exit 0
- fi
- trap cleanup 0
- pg_timestamp preunchecked >/dev/null
- # Process policy queues
- punew stable-new
- opunew oldstable-new
- backports_policy
- dak clean-suites -a backports-policy,policy
- # Finally deal with unchecked
- do_unchecked
- if [ ! -z "$changes" ]; then
- sync_debbugs
- do_buildd
- fi
- dak contents -l 10000 scan-binary
- dak contents -l 1000 scan-source
- pg_timestamp postunchecked >/dev/null
|