]> git.decadent.org.uk Git - dak.git/blob - config/debian/cron.unchecked
better handling of that report file
[dak.git] / config / debian / cron.unchecked
1 #!/bin/bash
2 # No way I try to deal with a crippled sh just for POSIX foo.
3
4 # Copyright (C) 2009 Joerg Jaspert <joerg@debian.org>
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License as
8 # published by the Free Software Foundation; version 2.
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 # exit on errors
20 set -e
21 # make sure to only use defined variables
22 set -u
23
24 # import the general variable set.
25 export SCRIPTVARS=/srv/ftp.debian.org/dak/config/debian/vars
26 . $SCRIPTVARS
27
28 LOCKDAILY=""
29 LOCKFILE="$lockdir/unchecked.lock"
30 NOTICE="$lockdir/daily.lock"
31
32 if [ -e $NOTICE ]; then
33     exit 0;
34 fi
35
36 ########################################################################
37 # Functions                                                            #
38 ########################################################################
39 # common functions are "outsourced"
40 . "${configdir}/common"
41
42 STAMP=$(date "+%Y%m%d%H%M")
43
44 cleanup() {
45     rm -f "$LOCKFILE"
46     if [ ! -z "$LOCKDAILY" ]; then
47         rm -f "$NOTICE"
48     fi
49 }
50
51 function do_buildd () {
52     if lockfile -r3 $NOTICE; then
53         LOCKDAILY="YES"
54         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
55         cd $overridedir
56         dak make-overrides &>/dev/null
57         rm -f override.sid.all3 override.sid.all3.src
58         for i in main contrib non-free main.debian-installer; do
59             cat override.sid.$i >> override.sid.all3
60             if [ "$i" != "main.debian-installer" ]; then
61                 cat override.sid.$i.src >> override.sid.all3.src
62             fi
63         done
64         make_buildd_dir
65
66         . $configdir/cron.buildd
67     fi
68 }
69
70 ########################################################################
71 # the actual unchecked functions follow                                #
72 ########################################################################
73
74 acceptnew
75
76 # only run one cron.unchecked
77 lockfile -r3 $LOCKFILE || exit 0
78 trap cleanup 0
79
80 do_unchecked
81
82 if [ ! -z "$changes" ]; then
83     sync_debbugs
84     do_buildd
85 fi