exiv2/src/svn_version.sh
Robin Mills 24cb148e11 #1004. Reviewed all include directives in src/*.cpp and samples/*.cpp
fixed svn_version.sh again!
change to test/build-test.py for MacOS-X/Xcode 6.
2015-01-06 12:40:31 +00:00

44 lines
997 B
Bash
Executable File

#!/bin/bash
##
# update svn_version_h when revision changes
##
svn_version_h=svn_version.h
svn_version=$(svn info .. 2>/dev/null)
s=$?
##
# from Jenkins, svn is almost always a disaster because
# Jenkins SVN Jenkins is 1.7 and the build machine is normally at least 1.8
if [ "$s" == "0" ]; then
svn_version=$(svn info .. | grep ^Revision | cut -f 2 -d' ')
if [ -z "$svn_version" ]; then svn_version=0 ; fi
else
svn_version=0
fi
##
# report svn_version to output
set | grep svn_version
##
# sniff svn_version in svn_version.h and delete the file if incorrect
if [ -e "$svn_version_h" ]; then
old=$(cut -f 3 -d' ' "$svn_version_h")
if [ "$old" != "$svn_version" ]; then
rm -rf "$svn_version_h"
fi
fi
##
# write svn_version to file
if [ ! -e "$svn_version_h" ]; then
echo "#ifndef SVN_VERSION" > "$svn_version_h"
echo "#define SVN_VERSION $svn_version" >> "$svn_version_h"
echo "#endif" >> "$svn_version_h"
fi
# That's all Folks!
##