autodist: added jobs support for %continue_on_error and some other fixes

This commit is contained in:
Silvan Calarco 2013-04-22 12:26:12 +02:00
parent abe0683b5f
commit 88ab767d1b

View File

@ -81,7 +81,6 @@ PIDFILE="/var/run/autodist/autodist.pid"
# Configuration defaults normally overriden in configuration file
AUTOBUILD_MAXNUM=50
AUTOBUILD_DATEFROM=20070101
GNOME_VER=2.24.0
AUTODIST_REPOSITORY=
SEND_SERVER=
@ -471,17 +470,19 @@ function launch_pkgs_loop() {
cross_target_cpu=""
autodist_crossonly=""
patch_operation=$operation
continue_on_error=
for i in `seq 1 ${#JOB_VALUES[*]}`; do
[ "${JOB_VALUES[$i-1]}" = "-" ] || \
case ${JOB_VARNAMES[$i-1]} in
%build_and_install)
[ "$operation" = "build" ] && operation=buildinstall
break
;;
%continue_on_error)
continue_on_error=1
;;
%*)
echo "!! Warning: skipping unknown internal variable: ${JOB_VARNAMES[$i-1]}"
break
;;
autodist_crossonly)
autodist_crossonly=1
@ -637,8 +638,8 @@ function launch_pkgs_loop() {
version_find_bigger "${passed_arguments/ *}" "$pkglinever"
[ $? -eq 1 ] || {
echo "!! Warning: skipping ${pkg} package already up to date ($pkglinever >= ${passed_arguments/ *})."
echo "%% Adding ${pkg} job to skipped list."
echo "${pkg} $DATE_NOW 255" >> $SKIPPEDLISTDIR/auto.skip
# echo "%% Adding ${pkg} job to skipped list."
# echo "${pkg} $DATE_NOW 255" >> $SKIPPEDLISTDIR/auto.skip
[ "$do_autobuild" ] && autobuild_log $pkg $operation skipped $JOB_NAME
continue
}
@ -769,7 +770,7 @@ function launch_pkgs_loop() {
}
;;
esac
[ $SEVERITY -gt 0 ] && {
[ $SEVERITY -gt 0 -a ! "$continue_on_error" ] && {
rm -f $tmpfile
return $ret
}
@ -832,9 +833,11 @@ function launch_pkgs_loop() {
fi
if [ "$operation" = "buildinstall" -o "${passed_arguments/--norpm}" != "${passed_arguments}" ]; then
# send operation: check for --norpm (source send) to avoid sending notification twice
[ "$WEBBUILD_URL" -a "$WEBBUILD_USER" ] && \
[ "$WEBBUILD_URL" -a "$WEBBUILD_USER" ] && {
SPEC_VERSION=`grep -m1 "^Version:" $spec_dir/$pkg.spec | sed "s|Version:[[:space:]]*||"`
curl -s "$WEBBUILD_URL?REQUEST=message&USER=$WEBBUILD_USER&SECRET=$WEBBUILD_SECRET&USER_EMAIL=$WEBBUILD_EMAIL&\
MESSAGE=`cgi_encodevar \"sent <b>$pkg</b> to <b>$SEND_SERVER</b>\"`" >/dev/null
MESSAGE=`cgi_encodevar \"sent <b>$pkg $SPEC_VERSION</b> for ${TARGETARCH} to <b>$SEND_SERVER</b>\"`" >/dev/null
}
fi
;;
esac
@ -849,11 +852,15 @@ function launch_job_loop() {
# Iterates launch_pkgs_loop for each of the lines of current job
# (defined from JOB_FIRST to JOB_LAST)
# This is needed for build, send and install operations
numerr=0
for j in `seq $JOB_FIRST $JOB_LAST`; do
launch_pkgs_loop "$1" "$2" "${JOBS[$j]}" $j
[ $? -gt 0 ] && return 1;
if [ $? -gt 0 ]; then
numerr=$(($numerr + 1))
[ "$continue_on_error" ] || return $numerr;
fi
done
return 0
return $numerr
}
function log_date() {
@ -963,18 +970,20 @@ if [ "$do_autobuild" = "1" ]; then
continue
}
# check skippedlist
SKIPPEDLINE=`awk '{ print $1" "$2 }' $SKIPPEDLISTDIR/*.skip | grep -m1 "^$PKGNAME "`
if [ "$SKIPPEDLINE" ]; then
set -- $SKIPPEDLINE
SKIPPEDTIME=$2
SKIPPEDDAYS=`expr \( $DATE_NOW - $SKIPPEDTIME \) / 86400`
if [ "$SKIPPEDDAYS" -le "$AUTOBUILD_SKIP_DAYS" ]; then
SKIPPEDCOUNT=`expr $SKIPPEDCOUNT + 1`
# echo "?= Package $PKGNAME has been in the skippedlist for $SKIPPEDDAYS days; skipping"
continue
else
sed -i "/^$PKGNAME /d" $SKIPPEDLISTDIR/*.skip
# check skippedlist (but ignore for scheduled updates)
if [ "${VERSION:0:1}" != "+" ]; then
SKIPPEDLINE=`awk '{ print $1" "$2 }' $SKIPPEDLISTDIR/*.skip | grep -m1 "^$PKGNAME "`
if [ "$SKIPPEDLINE" ]; then
set -- $SKIPPEDLINE
SKIPPEDTIME=$2
SKIPPEDDAYS=`expr \( $DATE_NOW - $SKIPPEDTIME \) / 86400`
if [ "$SKIPPEDDAYS" -le "$AUTOBUILD_SKIP_DAYS" ]; then
SKIPPEDCOUNT=`expr $SKIPPEDCOUNT + 1`
#echo "?= Package $PKGNAME has been in the skippedlist for $SKIPPEDDAYS days; skipping"
continue
else
sed -i "/^$PKGNAME /d" $SKIPPEDLISTDIR/*.skip
fi
fi
fi
@ -1131,8 +1140,7 @@ for JOB_NUM in `seq 1 ${#JOBNAME[*]}`; do
} || {
[ "${AUTOSPEC_ARGS/--changelog}" = "${AUTOSPEC_ARGS}" ] &&
AUTOSPEC_ARGS="$AUTOSPEC_ARGS --changelog \"automatic update by autodist\""
launch_pkgs_loop autoupdate "$AUTOSPEC_ARGS $SEND_FORCE \
--define gnomever=$GNOME_VER"
launch_pkgs_loop autoupdate "$AUTOSPEC_ARGS $SEND_FORCE"
ret=$?
}
if [ $ret != 0 ]; then
@ -1176,8 +1184,7 @@ for JOB_NUM in `seq 1 ${#JOBNAME[*]}`; do
# WARNING: JOB_VER must be passed to launch_pkgs_loop as the first string in the second parameter
[ "${AUTOSPEC_ARGS/--changelog}" = "${AUTOSPEC_ARGS}" ] &&
AUTOSPEC_ARGS="$AUTOSPEC_ARGS --changelog \"automatic version update by autodist\""
launch_pkgs_loop update "${JOB_VER:1} $AUTOSPEC_ARGS $SEND_FORCE \
--define gnomever=$GNOME_VER" || {
launch_pkgs_loop update "${JOB_VER:1} $AUTOSPEC_ARGS $SEND_FORCE" || {
if [ ! "$rebuild_packages" ]; then
case $SEVERITY in
0) ;;