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

commit 23e489b38d2afbf337c39ac342f0e572f92da0f6
Author: Michel Hermier <[email protected]>
Date:   Fri Feb 22 12:49:46 2013 +0100

makepkg: Wrap build call in makepkg_timed_build

* With previous pre/post-build hooks change, SBU also took into account
the time in hook. Restore the old behaviour by wrapping build and time
computation in the makepkg_timed_build function.

diff --git a/scripts/makepkg b/scripts/makepkg
index 96cd1c9..e4e9cbf 100755
--- a/scripts/makepkg
+++ b/scripts/makepkg
@@ -1600,10 +1600,53 @@ if [ "$NOCCACHE" = "0" -a -d /usr/lib/ccache/bin -a ! 
"`check_option NOCCACHE`"
fi
fi

+makepkg_timed_build () {
+       local ret
+
+       msg "Starting build()..."
+       stime=`date +%s`
+
+       build
+       ret=$?
+       if [ $ret -ne 0 ]; then
+               return $ret
+       fi
+
+       # count sbu
+       if [ "$SBU" == "1" ]; then
+               # $SBU not yet set
+               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./'`
+                       msg "Elapsed Time: $pkgsbu SBU"
+               else
+                       warning "The bc program is missing.  Cannot count SBU!"
+               fi
+       fi
+}
+
# build
-msg "Starting build()..."
-stime=`date +%s`
-for hook in "${_P_makepkg_prebuild_hooks[@]}" build 
"${_P_makepkg_postbuild_hooks[@]}"; do
+for hook in "${_P_makepkg_prebuild_hooks[@]}" makepkg_timed_build 
"${_P_makepkg_postbuild_hooks[@]}"; do
+       #cd "$startdir"
"$hook"
if [ $? -ne 0 ]; then
error "Build Failed.  Aborting..."
@@ -1616,40 +1659,8 @@ if [ -n "`find . -name "*|*"`" ]; then
exit 2
fi

-# count sbu
-if [ "$SBU" == "1" ]; then
-       # $SBU not yet set
-       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./'`
-               msg "Elapsed Time: $pkgsbu SBU"
-       else
-               warning "The bc program is missing.  Cannot count SBU!"
-       fi
-fi
-
cd $startdir

-
# strip binaries
strip_pkg $pkgname
if [ -n "$subpkgs" ]; then
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to