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

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Wed Oct 26 07:17:59 CEST 2011


At Wed, 26 Oct 2011 13:11:57 +0800,
CHEN Baozi wrote:
> 
> 
> On Oct 26, 2011, at 12:54 PM, MORITA Kazutaka wrote:
> 
> > 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. 
> The problem is if not cutting the commit hash, there would be "-" in the version  string. It will lead to a rpm-build error when "make rpm":
> 
> error: line 3: Illegal char '-' in: Version: 0.2.4-58-g2b0253c
> make: *** [rpm] Error 1

Okay, then how about the following?

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

Thanks,

Kazutaka

> 
> 
> > 
> > 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']))
> > 
> It is fine. Thanks.
> 
> > 
> > Thanks,
> > 
> > Kazutaka
> > -- 
> > sheepdog mailing list
> > sheepdog at lists.wpkg.org
> > http://lists.wpkg.org/mailman/listinfo/sheepdog
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list