autodist: reduce progress logging lines in autobuild mode and some other small fixes

This commit is contained in:
Silvan Calarco 2012-11-19 23:58:03 +01:00
parent 9f98345aad
commit aabe20a9ad

View File

@ -337,19 +337,19 @@ function version_find_bigger()
return 0 return 0
} }
#for target in ${TARGET[*]}; do
# echo ${target[*]}
#done
#exit 1
function tail_file() { function tail_file() {
local elapsedtime elapsedstring elapsedcount phase lastprinttime newtime begintime lines c local elapsedtime elapsedstring elapsedcount phase lastprinttime newtime begintime lines c difftimestep
c=0 c=0
lines=0 lines=0
begintime=`LANG=C date +%s` begintime=`LANG=C date +%s`
lastlinetime=$begintime lastlinetime=$begintime
lastprinttime=0 lastprinttime=0
if [ "$do_autobuild" ]; then
difftimestep=1800
else
difftimestep=1
fi
while read line; do while read line; do
echo "$line" >> $1 echo "$line" >> $1
let lines+=1 let lines+=1
@ -359,8 +359,7 @@ function tail_file() {
case $verbose in case $verbose in
1) echo "$line" 1) echo "$line"
;; ;;
*) *) if [ $difftime -gt $difftimestep ]; then
if [ $difftime -gt 1 ]; then
let c+=1 let c+=1
lastprinttime=$newtime lastprinttime=$newtime
let elapsedtime=$newtime-$begintime let elapsedtime=$newtime-$begintime
@ -378,21 +377,20 @@ function tail_file() {
[ $elapsedcount -gt 0 ] && elapsedstring="`expr $elapsedcount % 60`m $elapsedstring" [ $elapsedcount -gt 0 ] && elapsedstring="`expr $elapsedcount % 60`m $elapsedstring"
elapsedcount=`expr $elapsedcount / 60` elapsedcount=`expr $elapsedcount / 60`
[ $elapsedcount -gt 0 ] && elapsedstring="${elapsedcount}h $elapsedstring" [ $elapsedcount -gt 0 ] && elapsedstring="${elapsedcount}h $elapsedstring"
echo -n -e "\r$2 $phase ($lines lines, $elapsedstring, $speed l/s)" [ ! "$do_autobuild" ] && echo -n -e "\r"
echo -n "$2 $phase ($lines lines, $elapsedstring, $speed l/s)"
fi fi
;; ;;
esac esac
#echo -n -e "\rTailing...$phase (sleeped $diffdate seconds, $lines output lines) "
#savedate=newdate
done done
} }
get_job_vector() { get_job_vector() {
# note: if JOB_NAME contains a "-" translate it to "_" # note: if JOB_NAME contains a "-" or "." translate it to "_"
local JTARGET=${1/\/*} local JTARGET=${1/\/*}
local JPKG= local JPKG=
[ "$JTARGET" != "$1" ] && JPKG="${1/*\/}" [ "$JTARGET" != "$1" ] && JPKG="${1/*\/}"
local JNAME=`echo $JTARGET | tr - _` local JNAME=`echo $JTARGET | tr - _ | tr . _`
if [[ ${JNAME:0:1} =~ [0-9] ]]; then if [[ ${JNAME:0:1} =~ [0-9] ]]; then
# prepend a underscore to job names starting with a number (e.g. 54321) # prepend a underscore to job names starting with a number (e.g. 54321)
JNAME="_$JNAME" JNAME="_$JNAME"
@ -824,7 +822,9 @@ 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 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" ] && \
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</b> to <b>$SEND_SERVER</b>\"`" >/dev/null
fi fi