Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=b50fcf59768b4553dd949b4e794ef8531dd58732

commit b50fcf59768b4553dd949b4e794ef8531dd58732
Author: James Buren <[email protected]>
Date:   Sat Jun 2 12:54:46 2012 -0500

makepkg: add code for printing build time at the end in hours/minutes/seconds

diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in
index 3ffbdfd..109ede7 100644
--- a/etc/makepkg.conf.in
+++ b/etc/makepkg.conf.in
@@ -92,3 +92,6 @@ export PACKAGER="Frugalware Linux (http://frugalware.org)"
# Build the "binutils" package, and then write here the result you got,
# so that makepkg will could the right SBU value for you.
SBU="1"
+
+# Uncomment the following line if you want build time to be more "human 
readable."
+#HRBT="1"
diff --git a/scripts/makepkg b/scripts/makepkg
index 106227e..a5ee4ad 100755
--- a/scripts/makepkg
+++ b/scripts/makepkg
@@ -1614,7 +1614,25 @@ fi
# count sbu
if [ "$SBU" == "1" ]; then
# $SBU not yet set
-       msg "Elapsed Time: $(($(date +%s)-$stime)) seconds"
+       totaltime="$(( $(date +%s) - $stime ))"
+       if [ -z "$HRBT" ]; then
+               msg "Elapsed Time: $totaltime seconds"
+       else
+               hours="$(( $totaltime / 3600 ))"
+               minutes="$(( $totaltime % 3600 / 60 ))"
+               seconds="$(( $totaltime % 3600 % 60 ))"
+               totaltime=""
+               if [ "$hours" -gt 0 ]; then
+                       totaltime="$totaltime ${hours}h"
+               fi
+               if [ "$minutes" -gt 0 ]; then
+                       totaltime="$totaltime ${minutes}m"
+               fi
+               if [ "$seconds" -gt 0 ]; then
+                       totaltime="$totaltime ${seconds}s"
+               fi
+               msg "Elapsed Time:$totaltime"
+       fi
elif [ ! -z "$SBU" ]; then
if [ `type -p bc` ]; then
pkgsbu=`$ECHO -e "scale=2\n$(($(date +%s)-$stime))/$SBU"|bc /dev/stdin|sed 
's/^\./0./'`
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to