From 24f394ce8405790ea0c3e024255cc768ed9f8c46 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Wed, 5 Jun 2013 14:03:56 +0200 Subject: [PATCH] autodist,webbuild: support for different update return codes in automatic updates logging --- autodist | 6 +++--- autodist-cgi | 24 +++++++++++++++++------- webbuild/webbuild-cgi | 12 +++++++++--- webbuild/webbuild-functions | 2 +- webbuild/webbuild-sudo | 2 +- 5 files changed, 31 insertions(+), 15 deletions(-) diff --git a/autodist b/autodist index 2cc7615..1f7f1e9 100755 --- a/autodist +++ b/autodist @@ -548,7 +548,7 @@ function launch_pkgs_loop() { case $SEVERITY in 0) ;; 1) echo "!! Error: spec filename must be the same as package name or invalid job name; skipping $pkg package." - [ "$do_autobuild" ] && autobuild_log $pkg $operation failed $JOB_NAME $LOGDIR/failed/${LOGFILE_PKG_NAME} + [ "$do_autobuild" ] && autobuild_log $pkg $operation 240 $JOB_NAME $LOGDIR/failed/${LOGFILE_PKG_NAME} continue ;; *) echo "!! Error: spec filename must be the same as package name or invalid job name; aborting." exit 1 ;; @@ -565,7 +565,7 @@ function launch_pkgs_loop() { case $SEVERITY in 0) ;; 1) echo "%! Error: could not apply patch to specfile; skipping $pkg package." - [ "$do_autobuild" ] && autobuild_log $pkg $operation failed $JOB_NAME $LOGDIR/failed/${LOGFILE_PKG_NAME} + [ "$do_autobuild" ] && autobuild_log $pkg $operation 241 $JOB_NAME $LOGDIR/failed/${LOGFILE_PKG_NAME} ret=1 continue ;; *) echo "!! Error: could not apply patch to specfile; aborting." @@ -756,7 +756,7 @@ function launch_pkgs_loop() { } mv $LOGFILE_PKG $LOGDIR/failed/ echo "?= See $LOGDIR/failed/${LOGFILE_PKG_NAME}" - [ "$do_autobuild" ] && autobuild_log $pkg $operation failed $JOB_NAME $LOGDIR/failed/${LOGFILE_PKG_NAME} + [ "$do_autobuild" ] && autobuild_log $pkg $operation $ret $JOB_NAME $LOGDIR/failed/${LOGFILE_PKG_NAME} case $operation in autoupdate|update) ;; diff --git a/autodist-cgi b/autodist-cgi index 75ccf94..98da897 100755 --- a/autodist-cgi +++ b/autodist-cgi @@ -235,7 +235,7 @@ _EOF BUILDNOW[$BUILDNOWIDX]="$1" [ "$4" ] && BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} `echo $4 | sed "s|.*autodist/log/||"`" # BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} $2/$3/$1.i586" - BUILDNOWSTATUS[$BUILDNOWIDX]= + BUILDNOWSTATUS[$BUILDNOWIDX]=$3 BUILDNOWIDX=`expr $BUILDNOWIDX + 1` done < $STATEFILE else @@ -266,7 +266,7 @@ _EOF BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} $CURRLOGFILE" fi # BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} $2/$3/$1.i586" - BUILDNOWSTATUS[$BUILDNOWIDX]= + BUILDNOWSTATUS[$BUILDNOWIDX]=$3 BUILDNOWIDX=`expr $BUILDNOWIDX + 1` done < $AUTODISTSTATEFILE for p in `dirname $LOGFILE`/current.*; do @@ -306,14 +306,25 @@ _EOF # echo # rowcnt=0 # fi - case $OPERATIONNAME-$OPERATIONSTATUS in + case $OPERATIONNAME-$OPERATIONSTATUS in build-ok|send-ok|install-ok|retryinstall-ok) echo -n "$OPERATIONNAME:$OPERATIONSTATUS" ;; - *-failed) - echo -n "$OPERATIONNAME:$OPERATIONSTATUS" + update-failed|autoupdate-failed) + if [ "${BUILDNOWSTATUS[$b]}" = "4" ]; then + echo -n "$OPERATIONNAME:up-to-date" + elif [ "${BUILDNOWSTATUS[$b]}" = "3" ]; then + echo -n "$OPERATIONNAME:unknown" + elif [ "${BUILDNOWSTATUS[$b]}" = "2" ]; then + echo -n "$OPERATIONNAME:newer" + else + echo -n "$OPERATIONNAME:$OPERATIONSTATUS" + fi ;; - *) echo -n "$OPERATIONNAME:$OPERATIONSTATUS" + *-ok) echo -n "$OPERATIONNAME:$OPERATIONSTATUS" + ;; + *) + echo -n "$OPERATIONNAME:$OPERATIONSTATUS" ;; esac # [ "$SUBJOBNAME" != "$JOBNAME" ] && echo -en "($SUBJOBNAME)" @@ -324,7 +335,6 @@ _EOF if [[ $b -eq $BUILDNOWIDX-1 && ! "$ENDTIME" ]]; then echo -n "${BUILDOPERATION[$b]}(in progress...)" fi - [ "${BUILDNOWSTATUS[$b]}" ] && echo -n "(${BUILDNOWSTATUS[$b]})" LASTJOBNAME=$JOBNAME done [ "$LASTJOBNAME" ] && echo diff --git a/webbuild/webbuild-cgi b/webbuild/webbuild-cgi index ed217d3..0fbb718 100755 --- a/webbuild/webbuild-cgi +++ b/webbuild/webbuild-cgi @@ -672,7 +672,7 @@ else [ "$STATE_AUTODISTCURRENT" = "1" ] && AUTOUPDATEFILE=$BUILDLOGDIR/autoupdate-current || AUTOUPDATEFILE=$BUILDLOGDIR/autoupdate-last while read line; do set -- $line - if [ "$3" = "failed" -a "$2" != "autoupdate" ]; then + if [ "$3" != "ok" ]; then if [ "$REQUEST" != "skip" ]; then [ "$PACKAGE" = "$1" ] && SELECTED="selected=selected" || SELECTED= else @@ -681,7 +681,13 @@ else NEXTLOGTYPE=$2 } fi - echo -n "" + # skip 'higher version' (2), 'cant' find update' (3) + # 'no updates available' (4) autospec return codes + if [ "$2-$3" != "update-2" -a "$2-$3" != "autoupdate-2" -a \ + "$2-$3" != "update-3" -a "$2-$3" != "autoupdate-3" -a \ + "$2-$3" != "update-4" -a "$2-$3" != "autoupdate-4" ]; then + echo -n "" + fi if [ "$PACKAGE" = "$1" -a "$REQUEST" = "skip" ]; then SELECTED="selected=selected" else @@ -1296,7 +1302,7 @@ if [ "$MAINTAINERMODE" != "true" ]; then echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&" echo -n "SENDREPOSITORY=\"+getSelectedValueById('sendrepository')" echo -n ",\"`cgi_encodevar "Send $PACKAGE built packages to "`\"+getSelectedValueById('sendrepository')+" - echo -n "\"`cgi_encodevar "?

HINT: does summary look short and good?
${SPECVAR_Name[0]} - ${SPECVAR_Summary[0]}."`\"" + echo -n "\"`cgi_encodevar "?

HINT: does summary look short and good?
${SPECVAR_Name[0]} - ${SPECVAR_Summary[0]}."`\"" echo -n "); class=redbutton $HREFADD>" # recreate and send SRPM if [ "$SPECVAR_CHECK_NOAUTOBUILDREQ" ]; then diff --git a/webbuild/webbuild-functions b/webbuild/webbuild-functions index fd941f4..debf367 100644 --- a/webbuild/webbuild-functions +++ b/webbuild/webbuild-functions @@ -88,7 +88,7 @@ function cgi_get_POST_vars() cgi_get_POST_upload "${CONTENT_TYPE/*boundary=}" return fi - [ "${CONTENT_TYPE}" != "application/x-www-form-urlencoded" ] && \ + [ "${CONTENT_TYPE:0:33}" != "application/x-www-form-urlencoded" ] && \ echo "Warning: you should probably use MIME type "\ "application/x-www-form-urlencoded instead of ${CONTENT_TYPE}!" 1>&2 # save POST variables (only first time this is called) diff --git a/webbuild/webbuild-sudo b/webbuild/webbuild-sudo index d2f1666..1c1b258 100755 --- a/webbuild/webbuild-sudo +++ b/webbuild/webbuild-sudo @@ -54,7 +54,7 @@ elif [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then SUCMDPREFIX="chroot $ENVPREFIX su -l ${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} -c" [ "$TMPFILE" ] && { cp $TMPFILE /var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/$TMPFILE - chmod 755 /var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/$TMPFILE + chmod +r /var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/$TMPFILE } elif [ "${AUTOPORT_NATIVE[$ENVIRONMENT]}" ]; then ENVPREFIX=