Ack: [kteam-tools][PATCH v2] git-build-kernel: pretty elapsed build-time/loadavg banner

Brad Figg brad.figg at canonical.com
Thu Aug 8 19:16:29 UTC 2013


On 08/08/2013 10:19 AM, Kamal Mostafa wrote:
> PATCH v2:  Identical code, but description changed to reflect only the
> cosmetic result.  If it happens to cure some timeout, then that's just
> dumb luck ;-)
> 
>  -Kamal
> 
> -------------------- >8 --------------------
> Displays a pretty elapsed build-time and system load average banner,
> updated every 11 seconds.
> 
> Signed-off-by: Kamal Mostafa <kamal at canonical.com>
> ---
>  git-build-kernel/git-build-kernel | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/git-build-kernel/git-build-kernel b/git-build-kernel/git-build-kernel
> index df01673..a62d00c 100755
> --- a/git-build-kernel/git-build-kernel
> +++ b/git-build-kernel/git-build-kernel
> @@ -94,7 +94,8 @@ mkdir "$WORKDIR" || exit
>  
>  BUILDDIR="$WORKDIR/build"
>  LOG="$WORKDIR/build.log"
> -trap "rm -rf $BUILDDIR" 0
> +touch "$WORKDIR/building"
> +trap "rm -rf $WORKDIR/building $BUILDDIR" 0
>  
>  [ $do_source_pkg = 1 ] && {
>      orig_tarball="linux_${VERSION%%-*}.orig.tar.gz"
> @@ -116,6 +117,19 @@ echo "      version: $DISTRO ($VERSION)"
>  echo "      targets: $TARGETS"
>  echo "  starting build in $HOSTNAME:$WORKDIR ..."
>  
> +function show_elapsed
> +{
> +	while [ -f $WORKDIR/building ]
> +	do
> +	    loadavg="`uptime`"
> +	    loadavg="load${loadavg##*load}"
> +	    elapsed=`date --utc --date="@$SECONDS" +%H:%M:%S`
> +	    echo -n -e "\r  elapsed: $elapsed   $loadavg"
> +	    sleep 11
> +	done
> +}
> +show_elapsed &
> +
>  (
>  	set -e
>  	echo "+++gbk++++ git-build-kernel"
> @@ -146,6 +160,8 @@ XXEOFXX
>  ) > $LOG 2>&1
>  STATUS=$?
>  
> +rm -f "$WORKDIR/building"
> +echo
>  
>  ### Output information about the build status and products
>  
> 


-- 
Brad Figg brad.figg at canonical.com http://www.canonical.com




More information about the kernel-team mailing list