debian-cd-clone/contrib/cronjob.weekly

313 lines
11 KiB
Bash
Executable File

#!/bin/bash
export TOPDIR=$(dirname $0)
. $TOPDIR/settings.sh
export PUBDIRJIG=$PUBDIR/weekly-builds
export PUBDIRISO=$PUBDIR/weekly-builds
export DATE_BUILD="$DATE-$BUILDNUM"
export RSYNC_TARGET=/mnt/nfs-cdimage/weekly-builds
if [ "$PARALLEL"x = ""x ] ; then
PARALLEL=0
fi
# If we're doing a normal set of daily/weekly builds, leave the
# checksum filenames alone. Otherwise, make life easier for people
# combining things later and append a suitable name as we build.
if [ "$DEBVERSION"x != "testing"x ] ; then
export SUMS_EXTENSION=".large"
fi
. images4testing_d-i
# Uncomment the following to use daily d-i builds for weekly images
# rather than what's in the archive
USE_DAILY_DI=N
if [ "$USE_DAILY_DI"x = "Y"x ] ; then
export DI=sid
export DI_WWW_HOME=default
fi
export DI_DIST
export DI_CODENAME
OMIT_RELEASE_NOTES=0
export OMIT_RELEASE_NOTES
BUILDS_RUNNING=""
now () {
date -u +%F:%H:%M:%S
}
calc_time () {
echo $1 $2 | awk '
{
split($1, start, ":")
start_time = (3600*start[2]) + (60*start[3]) + start[4]
split($2, end, ":")
end_time = (3600*end[2]) + (60*end[3]) + end[4]
# Cope with going to a new day; do not worry about more than 1 day!
if (start[1] != end[1]) { end_time += 86400 }
time_taken = end_time - start_time
hours = int(time_taken / 3600)
time_taken -= (hours * 3600)
minutes = int(time_taken / 60)
time_taken -= (minutes * 60)
seconds = time_taken
printf("%dh%2.2dm%2.2ds\n", hours, minutes, seconds)
}'
}
build_finished () {
ARCH="$1"
BUILDNAME="$2"
BUILDNAMESTART="${BUILDNAME}START"
start=${!BUILDNAMESTART}
. $PUBDIRJIG/$ARCH/$BUILDNAME-trace
time_spent=`calc_time $start $end`
echo "$ARCH $BUILDNAME build started at $start, ended at $end (took $time_spent), error $error"
if [ $error -ne 0 ] ; then
arch_error="$arch_error "$BUILDNAME"FAIL/$error/$end"
fi
}
if [ "$ARCHES"x = ""x ] ; then
ARCHES="i386 source amd64 multi powerpc armel hppa ia64 mips mipsel s390 sparc"
fi
if lockfile -r0 $TOPDIR/.debian-cd.lock ; then
# echo "NOT checking for svn updates"
echo "svn update debian-cd"
cd debian-cd && svn cleanup; svn up ; cd ..
# echo "NOT checking for popcon updates"
cd debian-cd && ./tools/update_popcon tasks/squeeze/popularity-contest ; cd ..
cd $TOPDIR
mkdir -p $PUBDIRJIG/trace
mkdir -p $RSYNC_TARGET
for arch in $ARCHES; do
arch_error=""
if [ "$arch" != multi ] ; then
rm -rf $PUBDIRJIG/$arch
mkdir -p $PUBDIRJIG/$arch
arch_start=`now`
#export DI_DIR="$ARCH_DI_DIR"
# Full CD set
if [ "$NOCD"x = ""x ] ; then
export MAX_PKG_SIZE=500000000
case $arch in
i386|amd64|source)
export MAXISOS=ALL; export MAXJIGDOS=ALL ;;
powerpc)
export MAXISOS=8; export MAXJIGDOS=ALL ;;
*)
export MAXISOS=3; export MAXJIGDOS=ALL ;;
esac
CDSTART=`now`
unset DESKTOP
export BUILDNAME="CD"
BUILDS_RUNNING="$BUILDS_RUNNING $BUILDNAME"
if [ $PARALLEL = 1 ] ; then
./testingcds "$arch" &
else
./testingcds "$arch"
build_finished $arch $BUILDNAME
fi
fi
# Full DVD set
if [ "$NODVD"x = ""x ] ; then
export MAX_PKG_SIZE=999999999999
case $arch in
i386|amd64|source)
export MAXISOS=ALL; export MAXJIGDOS=ALL ;;
*)
export MAXISOS=ALL; export MAXJIGDOS=ALL ;;
esac
DVDSTART=`now`
export DESKTOP=all
export BUILDNAME="DVD"
BUILDS_RUNNING="$BUILDS_RUNNING $BUILDNAME"
if [ $PARALLEL = 1 ] ; then
INSTALLER_CD=3 TASK=Debian-all \
KERNEL_PARAMS='desktop=all' \
./testingcds "$arch" &
else
INSTALLER_CD=3 TASK=Debian-all \
KERNEL_PARAMS='desktop=all' \
./testingcds "$arch"
build_finished $arch $BUILDNAME
fi
fi
# Full BD set
if [ "$NOBD"x = ""x ] ; then
export MAX_PKG_SIZE=999999999999
case $arch in
i386|amd64|source)
export MAXISOS=0
export MAXJIGDOS=ALL
BDSTART=`now`
export DESKTOP=all
export BUILDNAME="BD"
BUILDS_RUNNING="$BUILDS_RUNNING $BUILDNAME"
if [ $PARALLEL = 1 ] ; then
INSTALLER_CD=9 TASK=Debian-all \
KERNEL_PARAMS='desktop=all' \
./testingcds "$arch" &
else
INSTALLER_CD=9 TASK=Debian-all \
KERNEL_PARAMS='desktop=all' \
./testingcds "$arch"
build_finished $arch $BUILDNAME
fi
;;
*)
echo "Not running BD build for $arch"
;;
esac
fi
# kde and xfce/lxde cds
if [ "$arch"x != "source"x ] && [ "$NOCD"x = ""x ] ; then
KDECDSTART=`now`
export MAX_PKG_SIZE=300000000
export DESKTOP=kde
export MAXISOS=1; export MAXJIGDOS=1
export BUILDNAME="KDECD"
BUILDS_RUNNING="$BUILDS_RUNNING $BUILDNAME"
if [ $PARALLEL = 1 ] ; then
INSTALLER_CD=4 TASK=Debian-kde \
KERNEL_PARAMS='desktop=kde' \
MAXCDS=1 MAXISOS=ALL MAXJIGDOS=ALL \
./testingcds "$arch" &
else
INSTALLER_CD=4 TASK=Debian-kde \
KERNEL_PARAMS='desktop=kde' \
MAXCDS=1 MAXISOS=ALL MAXJIGDOS=ALL \
./testingcds "$arch"
build_finished $arch $BUILDNAME
fi
LIGHTCDSTART=`now`
export MAX_PKG_SIZE=300000000
export DESKTOP=light
export MAXISOS=1; export MAXJIGDOS=1
export BUILDNAME="LIGHTCD"
BUILDS_RUNNING="$BUILDS_RUNNING $BUILDNAME"
if [ $PARALLEL = 1 ] ; then
INSTALLER_CD=B TASK=Debian-light \
KERNEL_PARAMS='desktop=light' \
MAXCDS=1 MAXISOS=ALL MAXJIGDOS=ALL \
./testingcds "$arch" &
else
INSTALLER_CD=B TASK=Debian-light \
KERNEL_PARAMS='desktop=light' \
MAXCDS=1 MAXISOS=ALL MAXJIGDOS=ALL \
./testingcds "$arch"
build_finished $arch $BUILDNAME
fi
fi
# Catch parallel builds here
while [ "$BUILDS_RUNNING"x != ""x ] ; do
BUILDS_STILL_RUNNING=""
for BUILDNAME in $BUILDS_RUNNING; do
if [ -e $PUBDIRJIG/$arch/$BUILDNAME-trace ] ; then
build_finished $arch $BUILDNAME
else
BUILDS_STILL_RUNNING="$BUILDS_STILL_RUNNING $BUILDNAME"
fi
done
BUILDS_RUNNING=$BUILDS_STILL_RUNNING
if [ "$BUILDS_RUNNING"x != ""x ] ; then
sleep 1
fi
done
arch_end=`now`
if [ "$arch_error"x = ""x ] ; then
arch_error="none"
fi
arch_time=`calc_time $arch_start $arch_end`
echo "$ARCH build started at $arch_start, ended at $arch_end (took $arch_time), error(s) $arch_error"
if [ "$NOSYNC"x = ""x ] ; then
if [ "$arch_error"x = "none"x ] ; then
echo "Running ~/build/iso_run $PUBDIRJIG/ $RSYNC_TARGET/ $arch &"
~/build/iso_run $PUBDIRJIG/ $RSYNC_TARGET/ $arch &
else
~/build/report_build_error $RSYNC_TARGET $arch "$arch_error"
fi
fi
else # multi
rm -rf $PUBDIRJIG/multi-arch
for i in iso-dvd jigdo-dvd; do
mkdir -p $PUBDIRJIG/multi-arch/$i
done
if [ "$NODVD"x = ""x ] ; then
export MAX_PKG_SIZE=999999999999
DVDSTART=`now`
export DESKTOP=all
export BUILDNAME="DVD"
INSTALLER_CD=6 TASK=Debian-all \
KERNEL_PARAMS='desktop=all' \
MAXCDS=1 MAXISOS=ALL MAXJIGDOS=ALL \
./testingcds "i386 amd64 source"
# We don't do multi in parallel, only one build type
# to do!
build_finished $arch $BUILDNAME $DVDSTART
mv $PUBDIRJIG/multi/jigdo-dvd/debian* $PUBDIRJIG/multi-arch/jigdo-dvd
for file in $PUBDIRJIG/multi/jigdo-dvd/*SUMS$SUMS_EXTENSION; do
outfile=$PUBDIRJIG/multi-arch/jigdo-dvd/`basename $file`
cat $file >> $outfile
done
mv $PUBDIRJIG/multi/iso-dvd/debian* $PUBDIRJIG/multi-arch/iso-dvd
for file in $PUBDIRJIG/multi/iso-dvd/*SUMS$SUMS_EXTENSION; do
outfile=$PUBDIRJIG/multi-arch/iso-dvd/`basename $file`
cat $file >> $outfile
done
rm -rf $PUBDIRJIG/multi
fi
if [ "$NOSYNC"x = ""x ] ; then
if [ "$arch_error"x = "none"x ] || [ "$arch_error"x = ""x ] ; then
echo "Running ~/build/iso_run $PUBDIRJIG/ $RSYNC_TARGET/ multi-arch &"
~/build/iso_run $PUBDIRJIG/ $RSYNC_TARGET/ multi-arch &
else
~/build/report_build_error $RSYNC_TARGET multi-arch "$arch_error"
fi
fi
fi # end of multi
# Reset envvars for next iteration
unset DESKTOP
done
~/build/generate_firmware_images squeeze
~/build/generate_firmware_images sid
if [ "$NOSNAP"x = ""x ] ; then
~/bin/weekly-snapshots
fi
date -u > $PUBDIRJIG/trace/cdimage.debian.org
rm -f $TOPDIR/.debian-cd.lock
fi