diff --git a/VERSION b/VERSION index b8459fa785..fcc97af28d 100644 --- a/VERSION +++ b/VERSION @@ -1,5 +1,5 @@ # Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. -# Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved. # This is the VERSION file for Open MPI, describing the precise # version of Open MPI in this distribution. The various components of @@ -22,22 +22,30 @@ release=0 greek=a1 -# If want_svn=1, then the SVN r number will be included in the overall -# Open MPI version number in some form. +# If want_repo_rev=1, then the repo revision number will be included +# in the overall Open MPI version number in some form. -want_svn=1 +want_repo_rev=1 -# If svn_r=-1, then the SVN r numbere will be obtained dynamically at -# run time, either 1) via the "svnversion" command (if this is a -# Subversion checkout) in the form "r", or b) with the date (if -# this is not a Subversion checkout, and the svnversion command cannot -# be used) in the form of "svn". Alternatively, if svn_r is not -# -1, the value of svn_r will be directly appended to the version -# string. This happens during "make dist", for example: if the -# distribution tarball is being made from an SVN checkout, the value -# of svn_r in this file is replaced with the output of "svnversion". +# If repo_rev=-1, then the repository version number will be obtained +# dynamically at run time, either: +# +# 1) via the "svnversion" command (if this is a Subversion checkout) +# in the form "r", or +# 2) via the "hg -v -R tip" command (if this is a Mercurial clone) +# in the form of "hg", using the hash tag at the tip +# 3) via the "git log -1" command (if this is a Git clone) in the form +# of "git", using the hash tag at the HEAD +# 4) with the date (if none of the above work) in the form of +# "date". +# +# Alternatively, if repo_rev is not -1, the value of repo_rev_r will +# be directly appended to the version string. This happens during +# "make dist", for example: if the distribution tarball is being made +# from an SVN checkout, if repo_rev=-1, then its value is replaced +# with the output of "svnversion". -svn_r=-1 +repo_rev=-1 # The date when this release was created diff --git a/config/ompi_save_version.m4 b/config/ompi_save_version.m4 index 567abb2b90..defbbd4d01 100644 --- a/config/ompi_save_version.m4 +++ b/config/ompi_save_version.m4 @@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, dnl University of Stuttgart. All rights reserved. dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. -dnl Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -31,8 +31,8 @@ AC_DEFUN([OPAL_SAVE_VERSION], [ AC_SUBST($1[_MINOR_VERSION]) AC_SUBST($1[_RELEASE_VERSION]) AC_SUBST($1[_GREEK_VERSION]) - AC_SUBST($1[_WANT_SVN]) - AC_SUBST($1[_SVN_R]) + AC_SUBST($1[_WANT_REPO_REV]) + AC_SUBST($1[_REPO_REV]) AC_SUBST($1[_VERSION]) AC_SUBST($1[_RELEASE_DATE]) @@ -41,7 +41,7 @@ AC_DEFUN([OPAL_SAVE_VERSION], [ AC_MSG_CHECKING([$2 release date]) AC_MSG_RESULT([$]$1[_RELEASE_DATE]) AC_MSG_CHECKING([$2 Subversion repository version]) - AC_MSG_RESULT([$]$1[_SVN_R]) + AC_MSG_RESULT([$]$1[_REPO_REV]) AC_DEFINE_UNQUOTED($1[_MAJOR_VERSION], [$]$1[_MAJOR_VERSION], [Major release number of ]$2) diff --git a/config/opal_get_version.m4 b/config/opal_get_version.m4 index 31a34e095c..234e2be38a 100644 --- a/config/opal_get_version.m4 +++ b/config/opal_get_version.m4 @@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, dnl University of Stuttgart. All rights reserved. dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. -dnl Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -33,11 +33,11 @@ dnl # prefix_MINOR_VERSION # prefix_RELEASE_VERSION # prefix_GREEK_VERSION -# prefix_WANT_SVN -# prefix_SVN_R +# prefix_WANT_REPO_REV +# prefix_REPO_REV # prefix_RELEASE_DATE m4_define([OPAL_GET_VERSION],[ - : ${ompi_ver_need_svn=1} + : ${ompi_ver_need_repo_rev=1} : ${svnversion_result=-1} dnl quote eval to suppress macro expansion with non-GNU m4 @@ -50,8 +50,8 @@ m4_define([OPAL_GET_VERSION],[ s/^minor/$2_MINOR_VERSION/ s/^release/$2_RELEASE_VERSION/ s/^greek/$2_GREEK_VERSION/ - s/^want_svn/$2_WANT_SVN/ - s/^svn_r/$2_SVN_R/ + s/^want_repo_rev/$2_WANT_REPO_REV/ + s/^repo_rev/$2_REPO_REV/ s/^date/$2_RELEASE_DATE/ t print b @@ -68,20 +68,20 @@ m4_define([OPAL_GET_VERSION],[ $2_VERSION="${$2_VERSION}${$2_GREEK_VERSION}" $2_BASE_VERSION=$$2_VERSION - if test $$2_WANT_SVN -eq 1 && test $ompi_ver_need_svn -eq 1 ; then + if test $$2_WANT_REPO_REV -eq 1 && test $ompi_ver_need_repo_rev -eq 1 ; then if test "$svnversion_result" != "-1" ; then - $2_SVN_R=$svnversion_result + $2_REPO_REV=$svnversion_result fi - if test "$$2_SVN_R" = "-1" ; then + if test "$$2_REPO_REV" = "-1" ; then m4_ifdef([AC_MSG_CHECKING], - [AC_MSG_CHECKING([for SVN version])]) + [AC_MSG_CHECKING([for repo version])]) d=`date '+%m-%d-%Y'` if test -d "$srcdir/.svn" ; then - $2_SVN_R=r`svnversion "$srcdir"` + $2_REPO_REV=r`svnversion "$srcdir"` if test $? != 0; then # The following is too long for Fortran - # $2_SVN_R="unknown svn version (svnversion not found); $d" - $2_SVN_R="? (no svnversion); $d" + # $2_REPO_REV="unknown svn version (svnversion not found); $d" + $2_REPO_REV="? (no svnversion); $d" fi elif test -d "$srcdir/.hg" ; then # Check to see if we can find the hg command @@ -92,20 +92,31 @@ m4_define([OPAL_GET_VERSION],[ # found. So test for hg specifically first. hg --version > /dev/null 2>&1 if test $? = 0; then - $2_SVN_R=hg`hg -v -R "$srcdir" tip | grep ^changeset: | head -n 1 | cut -d: -f3` + $2_REPO_REV=hg`hg -v -R "$srcdir" tip | grep ^changeset: | head -n 1 | cut -d: -f3` else # The following is too long for Fortran - # $2_SVN_R="unknown hg version (hg not found); $d" - $2_SVN_R="? (no hg); $d" + # $2_REPO_REV="unknown hg version (hg not found); $d" + $2_REPO_REV="? (no hg); $d" + fi + elif test -d "$srcdir/.git" ; then + # By the same logic as above, check to see if we + # can find the "git" command. + git --version > /dev/null 2>&1 + if test $? = 0; then + $2_REPO_REV=git`git log -1 "$srcdir" | grep ^commit | awk '{ print $2 }'` + else + # The following is too long for Fortran + # $2_REPO_REV="unknown hg version (hg not found); $d" + $2_REPO_REV="? (no git); $d" fi fi - if test "$2_SVN_R" = ""; then - $2_SVN_R="svn$d" + if test "$2_REPO_REV" = ""; then + $2_REPO_REV="date$d" fi m4_ifdef([AC_MSG_RESULT], [AC_MSG_RESULT([done])]) fi - $2_VERSION="${$2_VERSION}${$2_SVN_R}" + $2_VERSION="${$2_VERSION}${$2_REPO_REV}" fi fi ]) diff --git a/config/opal_get_version.m4sh b/config/opal_get_version.m4sh index 75ecd1676a..c2f65b844d 100644 --- a/config/opal_get_version.m4sh +++ b/config/opal_get_version.m4sh @@ -14,7 +14,7 @@ m4_divert_push([SCRIPT])dnl # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -30,10 +30,10 @@ option="$2" case "$option" in # svnversion can take a while to run. If we don't need it, don't run it. --major|--minor|--release|--greek|--base|--help) - ompi_ver_need_svn=0 + ompi_ver_need_repo_rev=0 ;; *) - ompi_ver_need_svn=1 + ompi_ver_need_repo_rev=1 esac @@ -63,8 +63,8 @@ case "$option" in --greek) echo $OPAL_GREEK_VERSION ;; - --svn) - echo $OPAL_SVN_R + --repo-rev) + echo $OPAL_REPO_REV ;; --base) echo $OPAL_BASE_VERSION @@ -73,7 +73,7 @@ case "$option" in echo $OPAL_RELEASE_DATE ;; --all) - echo ${OPAL_VERSION} ${OPAL_MAJOR_VERSION} ${OPAL_MINOR_VERSION} ${OPAL_RELEASE_VERSION} ${OPAL_GREEK_VERSION} ${OPAL_SVN_R} + echo ${OPAL_VERSION} ${OPAL_MAJOR_VERSION} ${OPAL_MINOR_VERSION} ${OPAL_RELEASE_VERSION} ${OPAL_GREEK_VERSION} ${OPAL_REPO_REV} ;; -h|--help) cat < [