[PATCH util-macros] XORG_GIT_MODULE_VERSION: writes module version in xorg-git-version.h

Gaetan Nadon memsize at videotron.ca
Mon Apr 19 18:38:39 PDT 2010


On Mon, 2010-04-19 at 12:14 -0700, Dan Nicholson wrote:

> On Mon, Apr 19, 2010 at 11:52 AM, Gaetan Nadon <memsize at videotron.ca> wrote:
> > Generates the git module version according to the "git describe HEAD"
> > If the git module has pending changes, it appends "-dirty" to the version tag
> >
> > Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
> > ---
> >  xorg-macros.m4.in |   18 ++++++++++++++++++
> >  1 files changed, 18 insertions(+), 0 deletions(-)
> >
> > diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
> > index 916b472..efb2e53 100644
> > --- a/xorg-macros.m4.in
> > +++ b/xorg-macros.m4.in
> > @@ -1009,3 +1009,21 @@ mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
> >  echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
> >  AC_SUBST([INSTALL_CMD])
> >  ]) # XORG_INSTALL
> > +
> > +# XORG_GIT_MODULE_VERSION()
> > +# -------------------------
> > +# Minimum version: 1.8.0
> > +#
> > +# Generates the git module version according to the "git describe HEAD"
> > +# If the git module has pending changes, it appends "-dirty" to the version tag
> > +#
> > +AC_DEFUN([XORG_GIT_MODULE_VERSION], [
> > +GIT_MODULE_VERSION_CMD="VER=\`GIT_DIR=\$(top_srcdir)/.git git describe HEAD 2>/dev/null\`; \
> > +DVER=\`GIT_DIR=\$(top_srcdir)/.git git diff-index HEAD 2>/dev/null\`; \
> > +OUTSTR=\"\#undef XORG_GIT_VERSION\" ; \
> > +OUTFILE=\"xorg-git-version.h\"; \
> 
> IMO, OUTFILE should just be $@. Then the module has flexibility over
> what the header is called.

Done

> 
> > +test -n \"\$\$VER\" && OUTSTR=\"\#define XORG_GIT_VERSION \$\$VER\" && test -n \"\$\$DVER\" && OUTSTR=\"\#define XORG_GIT_VERSION \$\$VER-dirty\"; \
> 
> I don't I like "dirty" going in the version since it doesn't really
> provide any further information. That could be one string change or it
> could be a revamp of a subsystem.

It does warn the person trying to debug that the tag and commit info may
not be representative due to local changes. It's not enough, but better
than nothing. Otherwise it is misleading. There is a hole, however.
There may be local commits. To make it better until new ideas come
forward, I change the -dirty for -with-uncommitted-changes".

> 
> However, if it is kept, can we split this in two lines?

Done.

> 
> test -n \"\$\$VER\" && OUTSTR=\"\#define XORG_GIT_VERSION \$\$VER\"; \
> test -n \"\$\$DVER\" && OUTSTR=\"\$\$OUTSTR-dirty\"; \
> 
> If VER isn't set, DVER won't be either.
> 
> > +test -e \"\$\$OUTFILE\" || echo \"\$\$OUTSTR\" > \"\$\$OUTFILE\"; \
> > +CONTENT=\`cat \$\$OUTFILE\` && test \"\$\$CONTENT\" = \"\$\$OUTSTR\" || echo \$\$OUTSTR > \$\$OUTFILE;"
> > +AC_SUBST([GIT_MODULE_VERSION_CMD])
> > +]) # XORG_GIT_MODULE_VERSION
> > --
> > 1.6.0.4
> 
> I wish it didn't have to be done this way. This is absolutely nasty.

It does not have to be that way. We have reviewed the spec for the
function and we have two different implementation with pros and cons. I
thought it was worth a try, I think it was. It is indeed nastier than
expected, but no worse than the rest of the generated makefile. It gives
a sense of where the limits are.


> That said, it seems like it would work.
> 
> --
> Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100419/53c7009f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100419/53c7009f/attachment.pgp>


More information about the xorg-devel mailing list