]> git.decadent.org.uk Git - dak.git/blob - config/debian/cron.unchecked
Merge remote-tracking branch 'ansgar/pu/multiarchive-2'
[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 LOCK_NEW="$lockdir/processnew.lock"
36 NOTICE="$lockdir/daily.lock"
37 LOCK_BUILDD="$lockdir/buildd.lock"
38
39 # our name
40 PROGRAM="unchecked"
41
42 if [ -e $NOTICE ]; then
43     exit 0;
44 fi
45
46 ########################################################################
47 # Functions                                                            #
48 ########################################################################
49 # common functions are "outsourced"
50 . "${configdir}/common"
51
52 STAMP=$(date "+%Y%m%d%H%M")
53
54 cleanup() {
55     rm -f "$LOCKFILE"
56     if [ ! -z "$LOCKDAILY" ]; then
57         rm -f "$NOTICE"
58     fi
59 }
60
61 function do_buildd () {
62     if lockfile -r3 $NOTICE; then
63         LOCKDAILY="YES"
64         cd $overridedir
65         dak make-overrides &>/dev/null
66         rm -f override.sid.all3 override.sid.all3.src
67         for i in main contrib non-free main.debian-installer; do
68             cat override.sid.$i >> override.sid.all3
69             if [ "$i" != "main.debian-installer" ]; then
70                 cat override.sid.$i.src >> override.sid.all3.src
71             fi
72         done
73         make_buildd_dir
74         wbtrigger
75     fi
76 }
77
78 function do_dists () {
79     #cd $configdir
80     #dak generate-filelist -s unstable,experimental -i
81     dak generate-packages-sources2 -s unstable experimental >/dev/null
82 }
83
84 ########################################################################
85 # the actual unchecked functions follow                                #
86 ########################################################################
87
88 # And use one locale, no matter what the caller has set
89 export LANG=C
90 export LC_ALL=C
91
92 # only run one cron.unchecked
93 if ! lockfile -r8 $LOCKFILE; then
94     echo "aborting cron.unchecked because $LOCKFILE has already been locked"
95     exit 0
96 fi
97 trap cleanup 0
98
99
100 pg_timestamp preunchecked >/dev/null
101
102 # Process policy queues
103 punew stable-new
104 opunew oldstable-new
105
106 # Finally deal with unchecked
107 do_unchecked
108
109 if [ ! -z "$changes" ]; then
110     sync_debbugs
111     do_buildd
112     #do_dists
113 fi
114
115 dak contents -l 10000 scan-binary
116 dak contents -l 1000 scan-source
117 pg_timestamp postunchecked >/dev/null