]> git.decadent.org.uk Git - dak.git/blob - config/debian/cron.unchecked
Add the new sections
[dak.git] / config / debian / cron.unchecked
1 #! /bin/sh
2
3 set -e
4 set -u
5 export SCRIPTVARS=/srv/ftp.debian.org/dak/config/debian/vars
6 . $SCRIPTVARS
7
8 LOCKDAILY=""
9 LOCKFILE="$lockdir/unchecked.lock"
10 NOTICE="$lockdir/daily.lock"
11
12 if [ -e $NOTICE ]; then exit 0; fi
13
14 STAMP=$(date "+%Y%m%d%H%M")
15
16 cleanup() {
17     rm -f "$LOCKFILE"
18     if [ ! -z "$LOCKDAILY" ]; then
19         rm -f "$NOTICE"
20     fi
21 }
22
23 # only run one cron.unchecked
24 if lockfile -r3 $LOCKFILE; then
25     trap cleanup 0
26     cd $unchecked
27
28     changes=$(find . -maxdepth 1 -mindepth 1 -type f -name \*.changes | sed -e "s,./,," | xargs)
29     report=$queuedir/REPORT
30     timestamp=$(date "+%Y-%m-%d %H:%M")
31
32     if [ ! -z "$changes" ]; then
33         echo "$timestamp": "$changes"  >> $report
34         dak process-unchecked -a -d "$unchecked" >> $report
35         echo "--" >> $report
36
37         # sync with debbugs
38     rsync -aq -e "ssh -o Batchmode=yes -o ConnectTimeout=30 -o SetupTimeout=30" --remove-source-files  $queuedir/bts_version_track/ bugs-sync:/org/bugs.debian.org/versions/queue/ftp-master/ 2>/dev/null && touch $lockdir/synced_bts_version || true
39
40         NOW=$(date +%s)
41         TSTAMP=$(stat -c %Y $lockdir/synced_bts_version)
42         DIFF=$(( NOW - TSTAMP ))
43         if [ $DIFF -ge 259200 ]; then
44                 echo "Kids, you tried your best and you failed miserably. The lesson is, never try. (Homer Simpson)"
45         fi
46
47         if lockfile -r3 $NOTICE; then
48             LOCKDAILY="YES"
49             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
50             cd $overridedir
51             dak make-overrides &>/dev/null
52             rm -f override.sid.all3 override.sid.all3.src
53             for i in main contrib non-free main.debian-installer; do
54                 cat override.sid.$i >> override.sid.all3
55                 if [ "$i" != "main.debian-installer" ]; then
56                     cat override.sid.$i.src >> override.sid.all3.src
57                 fi
58             done
59             cd $configdir
60             apt-ftparchive -qq -o APT::FTPArchive::Contents=off generate apt.conf.buildd
61
62             cd  ${incoming}
63             rm -f buildd/Release*
64             apt-ftparchive -qq -o APT::FTPArchive::Release::Origin="Debian" -o APT::FTPArchive::Release::Label="Debian" -o APT::FTPArchive::Release::Description="buildd incoming" -o APT::FTPArchive::Release::Architectures="${archs}" release buildd > Release
65             gpg --secret-keyring /srv/ftp.debian.org/s3kr1t/dot-gnupg/secring.gpg --keyring /srv/ftp.debian.org/s3kr1t/dot-gnupg/pubring.gpg --no-options --batch --no-tty --armour --default-key 6070D3A1 --detach-sign -o Release.gpg Release 
66                 mv Release* buildd/.
67
68             cd ${incoming}
69             mkdir -p tree/${STAMP}
70             cp -al ${incoming}/buildd/. tree/${STAMP}/
71             ln -sfT tree/${STAMP} ${incoming}/builddweb
72             find ./tree -mindepth 1 -maxdepth 1 -not -name "${STAMP}" -type d -print0 | xargs --no-run-if-empty -0 rm -rf
73
74             . $configdir/cron.buildd
75         fi
76     else
77                 echo "$timestamp": Nothing to do >> $report
78     fi
79 fi