]> git.decadent.org.uk Git - dak.git/blobdiff - config/backports/cron.unchecked
remove lenny
[dak.git] / config / backports / cron.unchecked
index 78eccd11f51d3389a3060afbcb37f56fd275ab39..423ce77dd7f3d995589310d0068c3f42954667b2 100755 (executable)
-#! /bin/sh
+#! /bin/bash
+
+# Copyright (C) 2009 Joerg Jaspert <joerg@debian.org>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; version 2.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# exit on errors
 set -e
-export SCRIPTVARS=/srv/backports-master.debian.org/config/backports/vars
+# make sure to only use defined variables
+set -u
+# ERR traps should be inherited from functions too. (And command
+# substitutions and subshells and whatnot, but for us the functions is
+# the important part here)
+set -E
+
+export SCRIPTVARS=/srv/backports-master.debian.org/dak/config/backports/vars
 . $SCRIPTVARS
 
+
+LOCKDAILY=""
 LOCKFILE="$lockdir/unchecked.lock"
+LOCK_NEW="$lockdir/processnew.lock"
 NOTICE="$lockdir/daily.lock"
+LOCK_BUILDD="$lockdir/buildd.lock"
+# The state file telling us we have something new to do
+DINSTALLPACKAGES="${lockdir}/dinstall.packages"
+
+# our name
+PROGRAM="unchecked"
+
+if [ -e $NOTICE ]; then
+    exit 0;
+fi
+
+########################################################################
+# Functions                                                            #
+########################################################################
+# common functions are "outsourced"
+. "${configdir}/common"
+
+STAMP=$(date "+%Y%m%d%H%M")
 
 cleanup() {
-  rm -f "$LOCKFILE"
-  if [ ! -z $LOCKDAILY ]; then
-         rm -f "$NOTICE"
-  fi
+    rm -f "$LOCKFILE"
+    if [ ! -z "$LOCKDAILY" ]; then
+        rm -f "$NOTICE"
+    fi
 }
-trap cleanup 0
+
+function do_buildd () {
+    if lockfile -r3 $NOTICE; then
+        LOCKDAILY="YES"
+        cd $overridedir
+        dak make-overrides &>/dev/null
+        rm -f override.sid.all3 override.sid.all3.src
+        for i in main contrib non-free main.debian-installer; do
+            cat override.squeeze-backports.$i >> override.sid.all3
+            if [ "$i" != "main.debian-installer" ]; then
+                cat override.squeeze-backports.$i.src >> override.sid.all3.src
+            fi
+        done
+        make_buildd_dir
+        wbtrigger
+    fi
+}
+
+function do_dists () {
+    cd $configdir
+    dak generate-filelist
+    dak generate-packages-sources
+}
+
+########################################################################
+# the actual unchecked functions follow                                #
+########################################################################
+
+# And use one locale, no matter what the caller has set
+export LANG=C
+export LC_ALL=C
 
 # only run one cron.unchecked
-if lockfile -r3 $LOCKFILE; then
-       cd $unchecked
-
-       changes=$(find . -maxdepth 1 -mindepth 1 -type f -name \*.changes | sed -e "s,./,," | xargs)
-       report=$queuedir/REPORT
-       timestamp=$(date "+%Y-%m-%d %H:%M")
-
-       if [ ! -z "$changes" ]; then
-               echo "$timestamp": "$changes"  >> $report
-               dak process-unchecked -a $changes >> $report
-               echo "--" >> $report
-       else
-               echo "$timestamp": Nothing to do >> $report
-       fi
-fi
+lockfile -r3 $LOCKFILE || exit 0
+trap cleanup 0
+
+do_newstage
+do_unchecked
 
-rm -f "$LOCKFILE"
+if [ ! -z "$changes" ]; then
+    touch ${DINSTALLPACKAGES}
+    sync_debbugs
+    do_buildd
+
+#    echo "Starting g-p-s: $(date +%H:%M:%S)"
+#    do_dists
+#    echo "Done with g-p-s: $(date +%H:%M:%S)"
+fi