[Openchrome-devel] [PATCH] add git branch to the version string

James Simmons jsimmons
Mon Feb 27 07:17:17 PST 2012


> Add the git branch to the generated version.h file.
> 
> ---
>  src/Makefile.am |   18 +++++++++++-------
>  1 files changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/src/Makefile.am b/src/Makefile.am
> index a5a6c6c..6d7eb2d 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -95,17 +95,21 @@ endif
>  via_driver.lo: version.h
>  version.h: $(openchrome_drv_la_SOURCES)
>  	@if [ -d ../.git ]; then \
> -	    echo '#define BUILDCOMMENT "(developement build, at revision '\
> -        "`git log -1 --pretty=format:%h | head -1`"')"' > $@.tmp; \
> -    else \
> -        if [ -d .svn ]; then \
> +	        echo '#define BUILDCOMMENT "(developement build, branch' \
> +	              "`git branch -v | sed 's/no branch/no_branch/' | \
> +	               awk '/^\*/ { print $$2 }'`" \
> +	              'at revision' \
> +	              "`git log -1 --pretty=format:%h | head -1`"')"' \
> +	             > $@.tmp; \
> +	    else \
> +	        if [ -d .svn ]; then \
>  	        echo '#define BUILDCOMMENT "(development build, at revision '\
>  	        "`svnversion -nc .. | sed -e s/^[^:]*://`"')"' > $@.tmp; \
> -        else \
> +	        else \
>  	        date +'#define BUILDCOMMENT "(development build, compiled on %c)"' \
> -        	> $@.tmp; \
> +	        	> $@.tmp; \
>  	    fi; \
> -    fi
> +	fi
>   	@chmod 666 $@.tmp
>  	@mv $@.tmp $@
> -- 
> 1.7.6.5

One more feature should be added for the stable release suggested by 
Natanael is updating the PATCHLEVEL to the xorg driver by using the number 
of commits since last release tag: 

(git describe --long | cut -d- -f2) as patchlevel




More information about the Openchrome-devel mailing list