cookutils rev 96

web: handle pct progress if no packages
author Christophe Lincoln <pankso@slitaz.org>
date Sun May 08 18:50:20 2011 +0200 (2011-05-08)
parents f25dec3d70a8
children df9ad242ebbc
files web/cooker.cgi
line diff
     1.1 --- a/web/cooker.cgi	Sun May 08 15:28:58 2011 +0200
     1.2 +++ b/web/cooker.cgi	Sun May 08 18:50:20 2011 +0200
     1.3 @@ -171,8 +171,9 @@
     1.4  		# Main page with summary.
     1.5  		cooked=$(ls $PKGS/*.tazpkg | wc -l)
     1.6  		inwok=$(ls $WOK | wc -l)
     1.7 -		div=$(($inwok / 100))
     1.8 -		pct=$(($cooked / $div))
     1.9 +		[ "$cooked" -gt 0 ] && div=$(($inwok / 100))
    1.10 +		[ "$cooked" -gt 0 ] && pct=$(($cooked / $div))
    1.11 +		[ "$cooked" == 0 ] && pct=0
    1.12  		cat << EOT
    1.13  <div style="float: right;">
    1.14  	<form method="get" action="$SCRIPT_NAME">
    1.15 @@ -185,7 +186,8 @@
    1.16  
    1.17  <pre>
    1.18  Running command  : $([ -s "$command" ] && cat $command || echo "Not running")
    1.19 -Wok revision     : <a href="http://hg.slitaz.org/wok">$(cd $WOK && hg head --template '{rev}\n')</a>
    1.20 +Wok revision     : <a href="http://hg.slitaz.org/wok">$(cd $WOK && \
    1.21 +	hg head --template '{rev}\n' || echo "No Hg wok")</a>
    1.22  Commits to cook  : $(cat $commits | wc -l)
    1.23  Current cooklist : $(cat $cooklist | wc -l)
    1.24  Broken packages  : $(cat $broken | wc -l)