ftmemsim-valgrind/auxprogs/make_or_upd_vgversion_h
Philippe Waroquiers 11671ae1d3 352395 - Please provide SVN revision info in --version -v
Finally committed ... :)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16164
2016-11-29 22:32:27 +00:00

41 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
extract_svn_version()
{
if [ -d "$1"/.svn ]
then
svnversion -n "$1"
elif [ -d "$1"/.git/svn ]
then
cd "$1" || exit 1
git svn info . | grep '^Revision' | cut -d ' ' -f2 | tr -d '\n'
else
echo "unknown"
fi
}
cat > include/vgversion.h.tmp <<EOF
/* Do not edit: file generated by auxprogs/make_or_upd_vgversion_h.
This file defines VGSVN and VEXSVN, used to report SVN revision
when using command line options: -v --version
*/
#define VGSVN "$(extract_svn_version .)"
#define VEXSVN "$(extract_svn_version VEX)"
EOF
if [ -f include/vgversion.h ]
then
# There is already a vgversion.h.
# Update it only if we found a different and real svn version
if grep unknown include/vgversion.h.tmp ||
cmp -s include/vgversion.h include/vgversion.h.tmp
then
rm include/vgversion.h.tmp
else
mv include/vgversion.h.tmp include/vgversion.h
fi
else
# There is no vgversion.h. Use the one just generated, whatever it is.
mv include/vgversion.h.tmp include/vgversion.h
fi