cookutils rev 787

cooker.cgi: estimate end date for long build
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Dec 16 18:39:00 2015 +0100 (2015-12-16)
parents 0fae1e8808bc
children edf295b6098f
files web/cooker.cgi
line diff
     1.1 --- a/web/cooker.cgi	Wed Dec 16 17:37:24 2015 +0200
     1.2 +++ b/web/cooker.cgi	Wed Dec 16 18:39:00 2015 +0100
     1.3 @@ -29,14 +29,14 @@
     1.4  	grep -qs "^${QUERY_STRING#recook=}$" $CACHE/recook-packages ||
     1.5  	echo ${QUERY_STRING#recook=} >> $CACHE/recook-packages
     1.6  	cat <<EOT
     1.7 -Location: $HTTP_REFERER
     1.8 +Location: ${HTTP_REFERER:-${REQUEST_URI%\?*}}
     1.9  
    1.10  EOT
    1.11  	exit ;;
    1.12  poke)
    1.13  	touch $CACHE/cooker-request
    1.14  	cat <<EOT
    1.15 -Location: $HTTP_REFERER
    1.16 +Location: ${HTTP_REFERER:-${REQUEST_URI%\?*}}
    1.17  
    1.18  EOT
    1.19  	exit ;;
    1.20 @@ -161,6 +161,7 @@
    1.21  		if grep -q "^$state" $cooktime ; then
    1.22  			set -- $(cat $cooktime)
    1.23  			state="$state $((($(date +%s)-$3)*100/$2))%"
    1.24 +			[ $2 -gt 300 ] && state="$state (should end $(date -u -d @$(($2+$3))))"
    1.25  		fi
    1.26  	fi
    1.27  	echo $state