autodist,autoport: support for sending status to webbuild social log

This commit is contained in:
Silvan Calarco 2012-09-10 17:41:15 +02:00
parent 71fec6c77a
commit 298ad4d73c
2 changed files with 47 additions and 2 deletions

View File

@ -245,6 +245,24 @@ esac
# exit 1 # exit 1
#} #}
# for webbuild message
function cgi_encodevar() {
local string="${1}"
local strlen=${#string}
local encoded=""
for (( pos=0 ; pos<strlen ; pos++ )); do
c=${string:$pos:1}
case "$c" in
[-_.~a-zA-Z0-9] ) o="${c}" ;;
* ) printf -v o '%%%02x' "'$c"
esac
encoded+="${o}"
done
echo "${encoded}" # You can either set a return variable (FASTER)
# REPLY="${encoded}" #+or echo the result (EASIER)... or both... :p
}
function tempfile() { function tempfile() {
local tmpfile local tmpfile
tmpfile=`mktemp -q -t $me.XXXXXXXX` || { tmpfile=`mktemp -q -t $me.XXXXXXXX` || {
@ -771,6 +789,10 @@ function launch_pkgs_loop() {
[ -e $SOURCESDIR/$p ] && rm -f $SOURCESDIR/$p [ -e $SOURCESDIR/$p ] && rm -f $SOURCESDIR/$p
done done
fi fi
if [ "${passed_arguments/--norpm}" != "${passed_arguments}" -a "$WEBBUILD_URL" -a "$WEBBUILD_USER" ]; then
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
fi
;; ;;
esac esac
fi fi

View File

@ -43,6 +43,25 @@ ${me[0]} ${me[1]}
} }
# for webbuild message
function cgi_encodevar() {
local string="${1}"
local strlen=${#string}
local encoded=""
for (( pos=0 ; pos<strlen ; pos++ )); do
c=${string:$pos:1}
case "$c" in
[-_.~a-zA-Z0-9] ) o="${c}" ;;
* ) printf -v o '%%%02x' "'$c"
esac
encoded+="${o}"
done
echo "${encoded}" # You can either set a return variable (FASTER)
# REPLY="${encoded}" #+or echo the result (EASIER)... or both... :p
}
# get_pkg_buildinfo - uses distromatic generated build file for # get_pkg_buildinfo - uses distromatic generated build file for
# getting information on the repository # getting information on the repository
# #
@ -247,9 +266,9 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
logdate=`date +"%F@%T"` logdate=`date +"%F@%T"`
logfile=$DATAARCHDIR/$logdate.log logfile=$DATAARCHDIR/$logdate.log
# [ -e $logfile ] && mv -f $logfile $DATAARCHDIR/$PORT_REPOSITORY-last.log mv $DATAARCHDIR/$PORT_REPOSITORY-current.log $DATAARCHDIR/$PORT_REPOSITORY-last.log
> $logfile > $logfile
ln -sf $logdate.log $DATAARCHDIR/current.log ln -sf $logdate.log $DATAARCHDIR/$PORT_REPOSITORY-current.log
BUILD_PLATFORM=`rpm --target $TARGET_ARCH --eval %{_build}` BUILD_PLATFORM=`rpm --target $TARGET_ARCH --eval %{_build}`
BUILD_CPU=`echo $BUILD_PLATFORM | cut -d- -f1` BUILD_CPU=`echo $BUILD_PLATFORM | cut -d- -f1`
@ -495,6 +514,10 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
JOB_SENT=(${JOB_SENT[*]} $JOB_CURRENT) JOB_SENT=(${JOB_SENT[*]} $JOB_CURRENT)
echo $JOB_CURRENT >> $DATAARCHDIR/sentjobs echo $JOB_CURRENT >> $DATAARCHDIR/sentjobs
echo -n "(OK) " echo -n "(OK) "
if [ "$BATCH_MODE" -a "$WEBBUILD_URL" -a "$WEBBUILD_USER" ]; then
curl -s "$WEBBUILD_URL?REQUEST=message&USER=$WEBBUILD_USER&SECRET=$WEBBUILD_SECRET&USER_EMAIL=$WEBBUILD_EMAIL&\
MESSAGE=`cgi_encodevar \"ported <b>$JOB_CURRENT</b> to <b>$TARGET_ARCH</b> and sent it to <b>$pkg_repository</b>\"`" >/dev/null
fi
} }
echo -n "install" echo -n "install"
LANG=C LC_ALL=C autodist -i ${JOB_CURRENT} --arch $TARGET_ARCH --force --severity 2 -- $STAGEOPTS &>$tmpfile LANG=C LC_ALL=C autodist -i ${JOB_CURRENT} --arch $TARGET_ARCH --force --severity 2 -- $STAGEOPTS &>$tmpfile