stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r608282 - /incubator/stdcxx/trunk/bin/xbuildgen
Date Wed, 02 Jan 2008 23:37:00 GMT
Author: sebor
Date: Wed Jan  2 15:36:55 2008
New Revision: 608282

URL: http://svn.apache.org/viewvc?rev=608282&view=rev
Log:
2008-01-02  Martin Sebor  <sebor@roguewave.com>

	* xbuildgen: Avoided division by zero errors in cases when the library
	failed to build in all logs (or its size couldn't be determined as is
	still the case on Windows). Ditto for build sizes.
	(format_size): Handled empty sizes.

Modified:
    incubator/stdcxx/trunk/bin/xbuildgen

Modified: incubator/stdcxx/trunk/bin/xbuildgen
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/bin/xbuildgen?rev=608282&r1=608281&r2=608282&view=diff
==============================================================================
--- incubator/stdcxx/trunk/bin/xbuildgen (original)
+++ incubator/stdcxx/trunk/bin/xbuildgen Wed Jan  2 15:36:55 2008
@@ -258,7 +258,9 @@
 {
     size=$1
 
-    if [ $size -ge 1000000000 ]; then
+    if [ "$size" = "" ]; then
+        :
+    elif [ $size -ge 1000000000 ]; then
         # over billion bytes, get size in gigabytes up to 2 decimal places
         gbsize="$((size / 1073741824)).$(((size % 1073741) / 100000))"
         size="<div title=\"$size bytes\">$gbsize GB</div>"
@@ -1013,6 +1015,8 @@
 # the number of build sizes counted
 buildsize_count=0
 
+# the number of successfully built (non-zero size) libraries
+libcount=0
 
 for l in $gzlogs; do
     logcount=$((logcount + 1))
@@ -1262,10 +1266,19 @@
     gzlogsize_avg=$((gzlogsize_sum / logcount))
     txtlogsize_avg=$((txtlogsize_sum / logcount))
 
-    libsize_avg=$((libsize_sum / libcount))
+    if [ 0 -ne $libcount ]; then
+        libsize_avg=$((libsize_sum / libcount))
+    else
+        libsize_avg=""
+    fi
 
-    fullbuildsize_avg=$((fullbuildsize_sum / buildsize_count))
-    cleanbuildsize_avg=$((cleanbuildsize_sum / buildsize_count))
+    if [ 0 -ne $buildsize_count ]; then
+        fullbuildsize_avg=$((fullbuildsize_sum / buildsize_count))
+        cleanbuildsize_avg=$((cleanbuildsize_sum / buildsize_count))
+    else
+        fullbuildsize_avg=""
+        cleanbuildsize_avg=""
+    fi
 
     output "      </tbody>"
     output "      <tfooter>"



Mime
View raw message