[m-rev.] for review: record the git revision the Mercury compiler was compiled with

Julien Fischer jfischer at opturion.com
Fri Apr 17 11:44:44 AEST 2015


Hi Sebastian,

On Sat, 4 Apr 2015, Sebastian Godelet wrote:

> Hi,
>
> I think this functionality would be nice to have as I've seen it
> already in some other tools which are configured and build from git 
> repositories.

Is it all that useful?  For my current workspace (on the master branch),
'git describe --tags' gives:

     version-14_01_1-493-g9acc9db

I don't find that information all that useful.  In fact, it's a bit
confusing because the tag mentioned is version-14_01_1, even though
this is the master branch.

> --
>
> Record the git revision the Mercury compiler was compiled with
>
> It can be useful to check the git revision from which the Mercury
> compiler was compiled from.
>
> compiler/handle_options.m:
>    In display_compiler_version/2 write out the git revision the
>    compiler was compiled from.

If we are displaying this information, then it should be displayed
everywhere that prints out the version information.  In addition
to the above that also means in:

     profiler/mercury_profile.m
     slice/mcov.m
     trace/mercury_trace_internal.c

> configure.ac:
>    define GIT_REVISION macro and collect git describe output,

s/define/Define/

>    also define MR_GIT_REVISION in lieu of MR_VERSION.

"in lieu" means "in place of", I think you mean "in addition to"
there.

> library/library.m:
>    Move version/2 to version/3 and also output the git revision of the
>    compiler. Make version/2 a wrapper for version/3 by ignoring the
>    git revision output.
>
> java/runtime/Constants.java.in:
> library/erlang_conf.hrl.in:
> runtime/mercury_conf.h.in:
> runtime/mercury_dotnet.cs.in:
>    Add the grade specific MR_GIT_REVISION constant.

How is it grade specific?

...

> diff --git a/configure.ac b/configure.ac
> index b11f4b1..d21c243 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -189,6 +189,16 @@ AC_CANONICAL_HOST
> FULLARCH="$host"
> AC_SUBST(FULLARCH)
> AC_DEFINE_UNQUOTED(MR_FULLARCH, "$FULLARCH")
> +AC_MSG_CHECKING([git revision])
> +GIT_REVISION=$(git describe --tags 2>/dev/null)
> +if test -z "$GIT_REVISION"; then
> +  AC_MSG_RESULT([no])
> +  GIT_REVISION="unknown"
> +else
> +  AC_MSG_RESULT([$GIT_REVISION])
> +fi
> +AC_SUBST(GIT_VESION)

s/GIT_VESION/GIT_REVISION/.

> +AC_DEFINE_UNQUOTED(MR_GIT_REVISION, "$GIT_REVISION")
> . ./VERSION
> AC_DEFINE_UNQUOTED(MR_VERSION, "$VERSION")
> if test "$prefix" = "NONE"; then
> @@ -268,6 +278,7 @@ AC_SUBST(CYGPATHU)
> PREFIX="`$CYGPATH $PREFIX`"
> LIBDIR="`$CYGPATH $PREFIX/lib/mercury`"
> NONSHARED_LIB_DIR=${MERCURY_NONSHARED_LIB_DIR=$PREFIX/lib/nonshared}
> +AC_SUBST(GIT_REVISION)
> AC_SUBST(VERSION)
> AC_SUBST(PREFIX)
> AC_SUBST(NONSHARED_LIB_DIR)

...

> diff --git a/runtime/mercury_conf.h.in b/runtime/mercury_conf.h.in
> index d70d1e5..9796b1d 100644
> --- a/runtime/mercury_conf.h.in
> +++ b/runtime/mercury_conf.h.in
> @@ -497,6 +497,11 @@
> #define MR_FULLARCH "unknown"
>
> /*
> +** Which git revision is used to build Mercury?

s/is/was/

Cheers,
Julien.



More information about the reviews mailing list