lkml.org 
[lkml]   [2008]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [REVIEW for merge] kbuild updates including silence of section mismatch check
From
Date
Sam Ravnborg wrote:
> --- a/scripts/setlocalversion
> +++ b/scripts/setlocalversion
> @@ -45,3 +45,18 @@ if hgid=`hg id 2>/dev/null`; then
> # All done with mercurial
> exit
> fi
> +
> +# Check for svn and a svn repo.
> +if rev=`svn info 2>/dev/null | grep '^Revision' | awk '{print $NF}'` ; then
> + changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l`
> +
> + # Are there uncommitted changes?
> + if [ $changes != 0 ]; then
> + printf -- '-svn%s%s%s' "$rev" -dirty "$changes"
> + else
> + printf -- '-svn%s' "$rev"
> + fi
> +
> + # All done with svn
> + exit
> +fi

This looks broken. Unless I'm very much mistaken the 'if' statement is
always going to be true because the awk statement will always execute
without error. Try: echo "" | awk '{print $NF}' || echo Error

So, the code should probably be changed to:
+if rev=`svn info 2>/dev/null | grep '^Revision' ; then
+ rev=`echo $rev | awk '{print $NF}'`
+ changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l`

or alternatively:
+if rev=`svn info 2>/dev/null | grep '^Revision' | awk '{print $NF}'` && \
+ [ -n "$rev" ] ; then
+ changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l`

Cheers,
FJP

P.S. Looks like the mercurial section is missing some indentation.


\
 
 \ /
  Last update: 2008-02-02 22:29    [W:0.110 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site