[Sheepdog] [PATCH 1/2] Add m4 macros in configure.ac

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Wed Oct 26 06:54:27 CEST 2011


At Tue, 25 Oct 2011 19:36:12 +0800,
chenbaozi at gmail.com wrote:
> 
> From: CHEN Baozi <chenbaozi.pt at taobao.com>
> 
> Support getting version from git repo in redhat.
> 
> Signed-off-by: CHEN Baozi <chenbaozi.pt at taobao.com>
> ---
>  configure.ac |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index dea219b..8883944 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -20,8 +20,15 @@ AC_PREREQ([2.61])
>  
>  m4_define([sheepdog_version], [0.2.4])
>  
> +m4_define([m4_chomp_all],
> +[m4_format([[%.*s]], m4_bregexp(m4_translit([[$1]], [
> +/], [/ ]), [/*$]), [$1])])  
> +
> +m4_define([m4_esyscmd_s], [m4_chomp_all(m4_esyscmd([$1]))])     
> +
>  m4_define([git_version],
> -	m4_esyscmd_s([git describe --tags --dirty 2> /dev/null | sed 's/^v//']))
> +	m4_esyscmd_s([git describe --tags --dirty 2> /dev/null | sed 's/^v//' \
> +| cut -d "-" -f 1]))

Don't cut the commit hash.  It is useful to know which revision is
used from sheep.log.

Anyway, this patch looks a bit complex to me.  How about the
following:

-	m4_esyscmd_s([git describe --tags --dirty 2> /dev/null | sed 's/^v//']))
+	m4_esyscmd([git describe --tags --dirty 2> /dev/null | sed 's/^v//' | tr -d '\n']))


Thanks,

Kazutaka



More information about the sheepdog mailing list