Commit 0d3abf10 authored by Vincent Lefevre's avatar Vincent Lefevre
Browse files

Move code for git info to its own shell script "version-ext.sh".

* New version-ext.sh file: sh script to output MPFR version information
  for a Git working tree (old code from tests/Makefile.am).
* tests/Makefile.am: replace some output_info code by the use of this
  script.
* Makefile.am: add version-ext.sh to EXTRA_DIST as a consequence
  (a comment explains why).
* README: list this new version-ext.sh file as a consequence.
parent f9a4ae08
......@@ -34,10 +34,15 @@ nobase_dist_doc_DATA = AUTHORS BUGS COPYING COPYING.LESSER NEWS TODO \
examples/rndo-add.c examples/sample.c examples/threads.c \
examples/version.c
# Note: Even though tarballs do not normally contain a .git directory,
# we need to distribute version-ext.sh to avoid a failure in case a
# tarball is tested from a Git directory (this script is executed by
# tests/Makefile.am in case of a Git working tree), which happens with
# "make distcheck", for instance.
EXTRA_DIST = PATCHES VERSION doc/README.dev doc/check-typography doc/mini-gmp \
tools/check_mparam.c tools/ck-clz_tab tools/ck-copyright-notice \
tools/ck-mparam tools/ck-news tools/ck-version-info tools/get_patches.sh \
$(DATAFILES)
version-ext.sh $(DATAFILES)
bench:
cd tools/bench && $(MAKE) $(AM_MAKEFLAGS) bench
......
......@@ -53,6 +53,7 @@ test-driver - auxiliary installation file
tests/ - directory containing the testsuite (for "make check")
tools/ - directory containing various tools
tune/ - directory containing files for tuning MPFR
version-ext.sh - script to get Git-related MPFR version information
According to the special exception to the GNU General Public License,
the autotools files compile, config.sub, config.guess, ltmain.sh,
......
......@@ -39,14 +39,8 @@ output_info = { \
fi; \
fi; \
if [ "x`git rev-parse --is-inside-work-tree 2> /dev/null`" = xtrue ]; then \
git tag --contains | sed -n 's/-root$$//p' > excluded-branches; \
gitb=`git branch --format='%(refname:short)' --contains | \
$(GREP) -v '^(' | $(GREP) -v -F -f excluded-branches -x`; \
rm excluded-branches; \
gitc=`git rev-list --count HEAD`; \
gith=`git rev-parse --short HEAD`; \
gitm=`git diff-index --name-only HEAD`; \
echo "[git] $$gitb-$$gitc-$$gith$${gitm:+ (modified)}"; \
gitv=`GREP=$(GREP) $(top_srcdir)/version-ext.sh`; \
echo "[git] $$gitv"; \
fi; \
$(GREP) -v '^\(PASS\|FAIL\) ' tversion.log 2> /dev/null || true; \
}
......
#!/bin/sh
# This script outputs additional MPFR version information for a
# Git working tree (Git branch, total commit count, commit id,
# and whether the current HEAD is modified). It is called in
# tests/Makefile.am for "make check", but may be used by other
# tools that need such information.
# Note that this does not replace version information found in
# the VERSION file, which may still need to be output in addition
# to the output of this script.
set -e
if [ "x`git rev-parse --is-inside-work-tree 2> /dev/null`" != xtrue ]; then
echo "$0: This script should be executed from a Git working tree." >&2
exit 1
fi
# Normally passed by Makefile.am with "GREP=$(GREP)".
GREP=${GREP:-grep}
git tag --contains | sed -n 's/-root$//p' > excluded-branches
gitb=`git branch --format='%(refname:short)' --contains | \
$GREP -v '^(' | $GREP -v -F -f excluded-branches -x`
rm excluded-branches
gitc=`git rev-list --count HEAD`
gith=`git rev-parse --short HEAD`
gitm=`git diff-index --name-only HEAD`
echo "$gitb-$gitc-$gith${gitm:+ (modified)}"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment