]> git.decadent.org.uk Git - dak.git/blob - config/debian/cron.unchecked
Initial pass at dak web server
[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 set -o pipefail
22 # make sure to only use defined variables
23 set -u
24 # ERR traps should be inherited from functions too. (And command
25 # substitutions and subshells and whatnot, but for us the functions is
26 # the important part here)
27 set -E
28
29 # import the general variable set.
30 export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
31 . $SCRIPTVARS
32
33 LOCKDAILY=""
34 LOCKFILE="$lockdir/unchecked.lock"
35 NOTICE="$lockdir/daily.lock"
36 LOCK_BUILDD="$lockdir/buildd.lock"
37
38 # our name
39 PROGRAM="unchecked"
40
41 if [ -e $NOTICE ]; then
42     exit 0;
43 fi
44
45 ########################################################################
46 # Functions                                                            #
47 ########################################################################
48 # common functions are "outsourced"
49 . "${configdir}/common"
50
51 STAMP=$(date "+%Y%m%d%H%M")
52
53 cleanup() {
54     rm -f "$LOCKFILE"
55     if [ ! -z "$LOCKDAILY" ]; then
56         rm -f "$NOTICE"
57     fi
58 }
59
60 function do_buildd () {
61     if lockfile -r3 $NOTICE; then
62         LOCKDAILY="YES"
63         cd $overridedir
64         dak make-overrides &>/dev/null
65         rm -f override.sid.all3 override.sid.all3.src override.squeeze-backports.all3 override.squeeze-backports.all3.src
66         for i in main contrib non-free main.debian-installer; do
67             cat override.sid.$i >> override.sid.all3
68             cat override.squeeze-backports.$i >> override.squeeze-backports.all3
69             if [ "$i" != "main.debian-installer" ]; then
70                 cat override.sid.$i.src >> override.sid.all3.src
71                 cat override.squeeze-backports.$i.src >> override.squeeze-backports.all3.src
72             fi
73         done
74         make_buildd_dir
75         wbtrigger
76     fi
77 }
78
79 function do_dists () {
80     #cd $configdir
81     #dak generate-filelist -s unstable,experimental -i
82     dak generate-packages-sources2 -s unstable experimental >/dev/null
83 }
84
85 ########################################################################
86 # the actual unchecked functions follow                                #
87 ########################################################################
88
89 # And use one locale, no matter what the caller has set
90 export LANG=C
91 export LC_ALL=C
92
93 # only run one cron.unchecked
94 if ! lockfile -r8 $LOCKFILE; then
95     echo "aborting cron.unchecked because $LOCKFILE has already been locked"
96     exit 0
97 fi
98 trap cleanup 0
99
100
101 pg_timestamp preunchecked >/dev/null
102
103 # Process policy queues
104 punew stable-new
105 opunew oldstable-new
106 backports_policy
107 dak clean-suites -a backports-policy,policy
108
109 # Finally deal with unchecked
110 do_unchecked
111
112 if [ ! -z "$changes" ]; then
113     sync_debbugs
114     do_buildd
115     #do_dists
116 fi
117
118 dak contents -l 10000 scan-binary
119 dak contents -l 1000 scan-source
120 pg_timestamp postunchecked >/dev/null