]> git.decadent.org.uk Git - dak.git/blob - config/debian/cron.unchecked
Set name
[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 LOCK_NEW="$lockdir/processnew.lock"
31 NOTICE="$lockdir/daily.lock"
32
33 # our name
34 PROGRAM="unchecked"
35
36 if [ -e $NOTICE ]; then
37     exit 0;
38 fi
39
40 ########################################################################
41 # Functions                                                            #
42 ########################################################################
43 # common functions are "outsourced"
44 . "${configdir}/common"
45
46 STAMP=$(date "+%Y%m%d%H%M")
47
48 cleanup() {
49     rm -f "$LOCKFILE"
50     if [ ! -z "$LOCKDAILY" ]; then
51         rm -f "$NOTICE"
52     fi
53 }
54
55 function do_buildd () {
56     if lockfile -r3 $NOTICE; then
57         LOCKDAILY="YES"
58         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
59         cd $overridedir
60         dak make-overrides &>/dev/null
61         rm -f override.sid.all3 override.sid.all3.src
62         for i in main contrib non-free main.debian-installer; do
63             cat override.sid.$i >> override.sid.all3
64             if [ "$i" != "main.debian-installer" ]; then
65                 cat override.sid.$i.src >> override.sid.all3.src
66             fi
67         done
68         make_buildd_dir
69
70         . $configdir/cron.buildd
71     fi
72 }
73
74 ########################################################################
75 # the actual unchecked functions follow                                #
76 ########################################################################
77
78 lockfile "$LOCK_NEW"
79 acceptnew
80 rm -f "$LOCK_NEW"
81
82 # only run one cron.unchecked
83 lockfile -r3 $LOCKFILE || exit 0
84 trap cleanup 0
85
86 do_unchecked
87
88 if [ ! -z "$changes" ]; then
89     sync_debbugs
90     do_buildd
91 fi