2019-02-19 17:05:47 -01:00
|
|
|
#!/bin/bash
|
2010-11-14 14:17:33 -01:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
TOPDIR=`pwd`
|
|
|
|
. $TOPDIR/settings.sh
|
|
|
|
. $TOPDIR/.ftp.buildnum
|
|
|
|
|
|
|
|
MYCOPY=$TOPDIR/.ftp.cron
|
2013-01-20 00:03:24 -01:00
|
|
|
BUILDLOCK=$HOME/.debian-cd.lock
|
2010-11-14 14:17:33 -01:00
|
|
|
MAILLIST=$TOPDIR/.debian-cd.mail
|
|
|
|
|
|
|
|
# Change these to abort daily/weekly builds as appropriate
|
|
|
|
ABORT_DAILY=n
|
|
|
|
ABORT_WEEKLY=n
|
|
|
|
|
|
|
|
if [ "$1"x = "-f"x ] ; then
|
|
|
|
FORCE=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
mail_list() {
|
|
|
|
if [ -e "$MAILLIST" ] ; then
|
|
|
|
MYEMAIL=`grep -v "^#" "$MAILLIST"`
|
|
|
|
else
|
|
|
|
MYEMAIL=`whoami`
|
|
|
|
fi
|
|
|
|
for i in $MYEMAIL
|
|
|
|
do
|
|
|
|
cat "$MYCOPY"|mail -s "$1" "$i"
|
|
|
|
done
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ -f "$TRACE" ] ; then
|
|
|
|
if [ "$FORCE"x = "1"x ] || ! /usr/bin/cmp -s "$MYCOPY".lastbuild "$TRACE" ; then
|
|
|
|
if [ -e "$BUILDLOCK" ]; then
|
|
|
|
if ! /usr/bin/cmp -s "$MYCOPY" "$TRACE" ; then
|
|
|
|
if ! /usr/bin/cmp -s "$MYCOPY" "$MYCOPY".building ; then
|
|
|
|
mail_list "testingcds missed the daily build for the pulse because of a lock"
|
|
|
|
fi
|
|
|
|
cp "$TRACE" "$MYCOPY"
|
|
|
|
cat "$MYCOPY" >> "$MYCOPY".stats
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
if ! /usr/bin/cmp -s "$MYCOPY" "$TRACE" ; then
|
|
|
|
cp "$TRACE" "$MYCOPY"
|
|
|
|
cat "$MYCOPY" >> "$MYCOPY".stats
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Work out the next build date/number combo
|
|
|
|
if [ "$LASTDATE"x != "$DATE"x ] ; then
|
|
|
|
BUILDNUM=1
|
|
|
|
else
|
|
|
|
BUILDNUM=$(($LASTBUILDNUM + 1))
|
|
|
|
fi
|
|
|
|
echo "LASTDATE=$DATE" > $TOPDIR/.ftp.buildnum
|
|
|
|
echo "LASTBUILDNUM=$BUILDNUM" >> $TOPDIR/.ftp.buildnum
|
|
|
|
export DATE BUILDNUM
|
|
|
|
|
|
|
|
echo "Last build was $LASTDATE-$LASTBUILDNUM"
|
|
|
|
echo "New build will be $DATE-$BUILDNUM"
|
|
|
|
|
|
|
|
cp "$MYCOPY" "$MYCOPY".building
|
|
|
|
|
2019-02-19 17:05:47 -01:00
|
|
|
BUILD_DONE=0
|
|
|
|
|
2010-11-14 14:17:33 -01:00
|
|
|
# "Daily" builds
|
|
|
|
# Only run certain builds, otherwise we're just wasting
|
|
|
|
# time reproducing identical results:
|
|
|
|
# - archive changes are likely to be minimal
|
|
|
|
# - packages only get uploaded at best once daily for most buildds
|
|
|
|
# - it's fairly unlikely they'll actually affect/improve installs,
|
|
|
|
# especially for the small images
|
|
|
|
# - D-I images only get built once or at most twice daily
|
|
|
|
DAILIES_DESIRED="1 5"
|
|
|
|
ODD_BUILD=`echo "$BUILDNUM % 2" | bc`
|
|
|
|
if [ "$ABORT_DAILY"x = "y"x ] && [ "$FORCE"x != "1"x ] ; then
|
|
|
|
echo "BAILING OUT OF DAILY BUILD"
|
|
|
|
mail_list "$HOSTNAME BAILING OUT OF DAILY BUILD"
|
|
|
|
elif [ "$ODD_BUILD" = "0" ] && [ "$FORCE"x != "1"x ] ; then
|
|
|
|
echo "Not running even-numbered daily build #$BUILDNUM"
|
|
|
|
else
|
|
|
|
echo "Running daily build #$BUILDNUM."
|
2019-02-19 17:05:47 -01:00
|
|
|
BUILD_DONE=1
|
2010-11-14 14:17:33 -01:00
|
|
|
if [ "$FORCE"x = "1"x ] ; then
|
|
|
|
echo "Build forced by hand"
|
|
|
|
else
|
|
|
|
echo "Triggered by mirror pulse:"
|
|
|
|
cat "$TRACE"
|
|
|
|
fi
|
2019-06-22 17:17:15 +00:00
|
|
|
$TOPDIR/cronjob.daily 2>&1 | tee ~/build/log/cronjob.daily-$DATE-$BUILDNUM.log
|
2010-11-14 14:17:33 -01:00
|
|
|
cp "$MYCOPY" "$MYCOPY".lastbuild
|
|
|
|
if ! /usr/bin/cmp -s "$MYCOPY".lastbuild "$TRACE" ; then
|
|
|
|
mail_list "testingcds has detected a pulse while we were building dailies"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Weekly build
|
|
|
|
if [ `date +%a` = "Mon" -a "$BUILDNUM"x = "1"x ] ; then
|
|
|
|
if [ "$ABORT_WEEKLY"x = "y"x ] && [ "$FORCE"x != "1"x ] ; then
|
|
|
|
echo "BAILING OUT OF WEEKLY BUILD"
|
|
|
|
mail_list "$HOSTNAME BAILING OUT OF WEEKLY BUILD"
|
|
|
|
else
|
2019-06-22 17:17:15 +00:00
|
|
|
$TOPDIR/cronjob.weekly 2>&1 | tee ~/build/log/cronjob.weekly-$DATE.log
|
2019-02-19 17:05:47 -01:00
|
|
|
BUILD_DONE=1
|
2010-11-14 14:17:33 -01:00
|
|
|
fi
|
|
|
|
fi
|
2012-07-06 00:30:17 +00:00
|
|
|
cd $HOME && ./bin/cdbuilder_log_analyser > build/log/analysis.html
|
2019-02-19 17:05:47 -01:00
|
|
|
if [ "$BUILD_DONE"x = "1"x ]; then
|
|
|
|
/usr/local/bin/static-update-component cdbuilder-logs.debian.org
|
|
|
|
fi
|
2010-11-14 14:17:33 -01:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
|