2003-12-22 19:29:21 +03:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2004-11-22 04:38:40 +03:00
|
|
|
# Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
# All rights reserved.
|
|
|
|
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
# All rights reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
# University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
# Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
# All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
# $COPYRIGHT$
|
|
|
|
#
|
|
|
|
# Additional copyrights may follow
|
|
|
|
#
|
2004-01-07 10:47:13 +03:00
|
|
|
# $HEADER$
|
2003-12-22 19:29:21 +03:00
|
|
|
#
|
2004-07-07 16:45:36 +04:00
|
|
|
|
|
|
|
#
|
|
|
|
# This file is almost identical in functionality to
|
2005-03-27 15:24:27 +04:00
|
|
|
# ompi_get_version.m4. It is unfortunate that we have to duplicate
|
|
|
|
# code, but it is really the only what that I can think to do it. :-(
|
|
|
|
# Hence, if you change the logic here for determining version numbers,
|
|
|
|
# YOU MUST ALSO CHANGE IT IN ompi_get_version.m4!!
|
2003-12-22 19:29:21 +03:00
|
|
|
#
|
|
|
|
|
|
|
|
srcfile="$1"
|
|
|
|
option="$2"
|
|
|
|
|
2005-09-07 23:59:28 +04:00
|
|
|
case "$option" in
|
|
|
|
# svnversion can take a while to run. If we don't need it, don't run it.
|
2005-09-27 06:06:05 +04:00
|
|
|
--major|--minor|--release|--greek|--base|--help)
|
2005-09-07 23:59:28 +04:00
|
|
|
OMPI_NEED_SVN=0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
OMPI_NEED_SVN=1
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
2003-12-22 19:29:21 +03:00
|
|
|
if test "$srcfile" = ""; then
|
|
|
|
option="--help"
|
|
|
|
else
|
2005-03-27 15:23:08 +04:00
|
|
|
OMPI_MAJOR_VERSION="`cat $srcfile | egrep '^major=' | cut -d= -f2`"
|
|
|
|
OMPI_MINOR_VERSION="`cat $srcfile | egrep '^minor=' | cut -d= -f2`"
|
|
|
|
OMPI_RELEASE_VERSION="`cat $srcfile | egrep '^release=' | cut -d= -f2`"
|
2005-09-27 06:06:05 +04:00
|
|
|
OMPI_GREEK_VERSION="`cat $srcfile | egrep '^greek=' | cut -d= -f2`"
|
2005-03-27 15:23:08 +04:00
|
|
|
OMPI_WANT_SVN="`cat $srcfile | egrep '^want_svn=' | cut -d= -f2`"
|
|
|
|
OMPI_SVN_R="`cat $srcfile | egrep '^svn_r=' | cut -d= -f2`"
|
2004-06-07 19:33:53 +04:00
|
|
|
if test "$OMPI_RELEASE_VERSION" != "0" -a "$OMPI_RELEASE_VERSION" != ""; then
|
|
|
|
OMPI_VERSION="$OMPI_MAJOR_VERSION.$OMPI_MINOR_VERSION.$OMPI_RELEASE_VERSION"
|
2003-12-22 19:29:21 +03:00
|
|
|
else
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_VERSION="$OMPI_MAJOR_VERSION.$OMPI_MINOR_VERSION"
|
2003-12-22 19:29:21 +03:00
|
|
|
fi
|
|
|
|
|
2005-09-27 06:06:05 +04:00
|
|
|
OMPI_VERSION="${OMPI_VERSION}${OMPI_GREEK_VERSION}"
|
2003-12-22 19:29:21 +03:00
|
|
|
|
2005-09-07 09:54:53 +04:00
|
|
|
OMPI_BASE_VERSION="$OMPI_VERSION"
|
|
|
|
|
2005-09-07 23:59:28 +04:00
|
|
|
if test "$OMPI_WANT_SVN" = "1" -a "$OMPI_NEED_SVN" = "1" ; then
|
2005-03-27 15:23:08 +04:00
|
|
|
if test "$OMPI_SVN_R" = "-1"; then
|
2005-03-25 06:19:46 +03:00
|
|
|
if test -d .svn; then
|
|
|
|
ver="r`svnversion .`"
|
|
|
|
else
|
|
|
|
ver="svn`date '+%m%d%Y'`"
|
|
|
|
fi
|
|
|
|
OMPI_SVN_R="$ver"
|
2004-03-26 07:25:54 +03:00
|
|
|
fi
|
2005-03-25 06:19:46 +03:00
|
|
|
OMPI_VERSION="${OMPI_VERSION}$OMPI_SVN_R"
|
2003-12-22 19:29:21 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$option" = ""; then
|
|
|
|
option="--full"
|
2004-07-07 16:45:36 +04:00
|
|
|
fi
|
2003-12-22 19:29:21 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
case "$option" in
|
|
|
|
--full|-v|--version)
|
2004-06-07 19:33:53 +04:00
|
|
|
echo $OMPI_VERSION
|
2003-12-22 19:29:21 +03:00
|
|
|
;;
|
|
|
|
--major)
|
2004-06-07 19:33:53 +04:00
|
|
|
echo $OMPI_MAJOR_VERSION
|
2003-12-22 19:29:21 +03:00
|
|
|
;;
|
|
|
|
--minor)
|
2004-06-07 19:33:53 +04:00
|
|
|
echo $OMPI_MINOR_VERSION
|
2003-12-22 19:29:21 +03:00
|
|
|
;;
|
|
|
|
--release)
|
2004-06-07 19:33:53 +04:00
|
|
|
echo $OMPI_RELEASE_VERSION
|
2003-12-22 19:29:21 +03:00
|
|
|
;;
|
2005-09-27 06:06:05 +04:00
|
|
|
--greek)
|
|
|
|
echo $OMPI_GREEK_VERSION
|
2003-12-22 19:29:21 +03:00
|
|
|
;;
|
2004-03-19 09:05:27 +03:00
|
|
|
--svn)
|
2005-03-25 06:19:46 +03:00
|
|
|
echo $OMPI_SVN_R
|
2003-12-22 19:29:21 +03:00
|
|
|
;;
|
2005-09-07 09:54:53 +04:00
|
|
|
--base)
|
|
|
|
echo $OMPI_BASE_VERSION
|
|
|
|
;;
|
2004-02-13 06:58:56 +03:00
|
|
|
--all)
|
2005-09-27 06:06:05 +04:00
|
|
|
echo ${OMPI_VERSION} ${OMPI_MAJOR_VERSION} ${OMPI_MINOR_VERSION} ${OMPI_RELEASE_VERSION} ${OMPI_GREEK_VERSION} ${OMPI_SVN_R}
|
2004-02-13 06:58:56 +03:00
|
|
|
;;
|
2003-12-22 19:29:21 +03:00
|
|
|
-h|--help)
|
|
|
|
cat <<EOF
|
|
|
|
$0 <srcfile> [<option>]
|
|
|
|
|
|
|
|
<srcfile> - Text version file
|
|
|
|
<option> - One of:
|
|
|
|
--full - Full version number
|
|
|
|
--major - Major version number
|
|
|
|
--minor - Minor version number
|
|
|
|
--release - Release version number
|
2005-09-27 06:06:05 +04:00
|
|
|
--greek - Greek (alpha, beta, etc) version number
|
2004-03-19 09:05:27 +03:00
|
|
|
--svn - Subversion repository number
|
2004-02-13 06:58:56 +03:00
|
|
|
--all - Show all version numbers, separated by :
|
2005-09-07 09:54:53 +04:00
|
|
|
--base - Show base version number (no svn number)
|
2003-12-22 19:29:21 +03:00
|
|
|
--help - This message
|
|
|
|
EOF
|
2005-09-07 23:59:28 +04:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unrecognized option $option. Run $0 --help for options"
|
|
|
|
;;
|
2003-12-22 19:29:21 +03:00
|
|
|
esac
|
|
|
|
|
|
|
|
# All done
|
|
|
|
|
|
|
|
exit 0
|