[lttng-dev] [lttng-tools PATCH] Add a git version line in LTTng versions compiled from git sources.

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Wed Mar 13 09:26:33 EDT 2013


* Raphaël Beamonte (raphael.beamonte at gmail.com) wrote:
> Hello,
> 
> This version adds a line "Git version" to "LTTng --help". The value of
> this line is calculated during "make" and then defined in a GIT_VERSION
> macro.
> It also works for versions without Git as it will just not define the
> GIT_VERSION value. The black point is that the "test" is made each time
> we "make" the tool. This can be corrected but I'm not sure it's
> necessary as this one is well working.
> 
> If this patch is ok for you, I can apply an identical patch to UST and
> babeltrace.

Does the entire project needs to be rebuilt at every commit then, or
just one or two files ?

Thanks,

Mathieu

> 
> Raphaël
> 
> On 2013-03-12 22:07, Raphaël Beamonte wrote:
> > Signed-off-by: Raphaël Beamonte <raphael.beamonte at gmail.com>
> > ---
> >  src/bin/lttng/Makefile.am |    6 +++++-
> >  src/bin/lttng/lttng.c     |    6 +++++-
> >  2 files changed, 10 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/bin/lttng/Makefile.am b/src/bin/lttng/Makefile.am
> > index 21eebab..1b1219b 100644
> > --- a/src/bin/lttng/Makefile.am
> > +++ b/src/bin/lttng/Makefile.am
> > @@ -1,5 +1,9 @@
> > +git_version_string=$$(git describe --long --all 2>/dev/null)
> > +git_version=$$(test -n "${git_version_string}" && echo "-DGIT_VERSION=\"${git_version_string}\"")
> > +
> >  AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src \
> > -			  -DINSTALL_BIN_PATH=\""$(bindir)"\"
> > +			  -DINSTALL_BIN_PATH=\""$(bindir)"\" \
> > +			  ${git_version}
> >  
> >  bin_PROGRAMS = lttng
> >  
> > diff --git a/src/bin/lttng/lttng.c b/src/bin/lttng/lttng.c
> > index 8562144..28f8fec 100644
> > --- a/src/bin/lttng/lttng.c
> > +++ b/src/bin/lttng/lttng.c
> > @@ -81,7 +81,11 @@ static struct cmd_struct commands[] =  {
> >  
> >  static void usage(FILE *ofp)
> >  {
> > -	fprintf(ofp, "LTTng Trace Control " VERSION" - " VERSION_NAME"\n\n");
> > +	fprintf(ofp, "LTTng Trace Control " VERSION" - " VERSION_NAME"\n");
> > +#ifdef GIT_VERSION
> > +	fprintf(ofp, "Git version: " GIT_VERSION"\n");
> > +#endif
> > +	fprintf(ofp, "\n");
> >  	fprintf(ofp, "usage: lttng [OPTIONS] <COMMAND> [<ARGS>]\n");
> >  	fprintf(ofp, "\n");
> >  	fprintf(ofp, "Options:\n");
> > 
> 
> 
> -- 
> Raphaël Beamonte.
> Information Systems and Telecommunications Engineer (UTT, France)
> Specialized in Mobile Technologies and Embedded Systems
> M.A.Sc. Student in Computer Engineering (Polytechnique Montréal, Canada)
> (33)-(0)6 10 97 27 25 - (1) 438 938-6879 - raphael.beamonte at gmail.com
> 



> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20130313/c0af95b2/attachment.pgp>


More information about the lttng-dev mailing list