]> git.decadent.org.uk Git - dak.git/blob - config/debian/cron.unchecked
config/debian/*: generate old-style buildd archive for squeeze-backports
[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 override.squeeze-backports.all3 override.squeeze-backports.all3.src
67         for i in main contrib non-free main.debian-installer; do
68             cat override.sid.$i >> override.sid.all3
69             cat override.squeeze-backports.$i >> override.squeeze-backports.all3
70             if [ "$i" != "main.debian-installer" ]; then
71                 cat override.sid.$i.src >> override.sid.all3.src
72                 cat override.squeeze-backports.$i.src >> override.squeeze-backports.all3.src
73             fi
74         done
75         make_buildd_dir
76         wbtrigger
77     fi
78 }
79
80 function do_dists () {
81     #cd $configdir
82     #dak generate-filelist -s unstable,experimental -i
83     dak generate-packages-sources2 -s unstable experimental >/dev/null
84 }
85
86 ########################################################################
87 # the actual unchecked functions follow                                #
88 ########################################################################
89
90 # And use one locale, no matter what the caller has set
91 export LANG=C
92 export LC_ALL=C
93
94 # only run one cron.unchecked
95 if ! lockfile -r8 $LOCKFILE; then
96     echo "aborting cron.unchecked because $LOCKFILE has already been locked"
97     exit 0
98 fi
99 trap cleanup 0
100
101
102 pg_timestamp preunchecked >/dev/null
103
104 # Process policy queues
105 punew stable-new
106 opunew oldstable-new
107
108 # Finally deal with unchecked
109 do_unchecked
110
111 if [ ! -z "$changes" ]; then
112     sync_debbugs
113     do_buildd
114     #do_dists
115 fi
116
117 dak contents -l 10000 scan-binary
118 dak contents -l 1000 scan-source
119 pg_timestamp postunchecked >/dev/null