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