diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index 370f42b2fa..1d23a86c9c 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -507,13 +507,23 @@ Foam::argList::argList jobInfo.add("startTime", timeString); jobInfo.add("userName", userName()); jobInfo.add("foamVersion", word(FOAMversion)); - jobInfo.add("foamBuild", Foam::FOAMbuild); jobInfo.add("code", executable_); jobInfo.add("argList", argListString); jobInfo.add("currentDir", cwd()); jobInfo.add("PPID", ppid()); jobInfo.add("PGID", pgid()); + // add build information - only use the first word + { + std::string build(Foam::FOAMbuild); + std::string::size_type found = build.find(' '); + if (found != std::string::npos) + { + build.resize(found); + } + jobInfo.add("foamBuild", build); + } + // Case is a single processor run unless it is running parallel int nProcs = 1; @@ -883,9 +893,10 @@ void Foam::argList::printUsage() const printNotes(); Info<< nl - <<"Using OpenFOAM-" << Foam::FOAMversion - <<" (build: " << Foam::FOAMbuild << ") - see www.OpenFOAM.com" - << nl << endl; + <<"Using: OpenFOAM-" << Foam::FOAMversion + << " (see www.OpenFOAM.com)" << nl + <<"Build: " << Foam::FOAMbuild << nl + << endl; } diff --git a/wmake/rules/General/version b/wmake/rules/General/version index 11f83c7b74..19633ffc9d 100644 --- a/wmake/rules/General/version +++ b/wmake/rules/General/version @@ -4,8 +4,8 @@ # update version strings in C++ file and in $WM_PROJECT_DIR/.build file # Cvertoo = \ - sed -e 's/VERSION_STRING/$(shell wmakePrintBuild -major)/' \ - -e 's/BUILD_STRING/$(shell wmakePrintBuild -update)/' \ + sed -e 's!VERSION_STRING!$(shell wmakePrintBuild -major)!' \ + -e 's!BUILD_STRING!$(shell wmakePrintBuild -update)!' \ $$SOURCE > $*.C; \ $(CC) $(c++FLAGS) -c $*.C -o $@ diff --git a/wmake/wmakePrintBuild b/wmake/wmakePrintBuild index 4b70503687..3812bece3e 100755 --- a/wmake/wmakePrintBuild +++ b/wmake/wmakePrintBuild @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -30,6 +30,8 @@ # #------------------------------------------------------------------------------ usage() { + exec 1>&2 + while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat</dev/null) + +# retrieve old values from the $WM_PROJECT_DIR/.build cache, stored as +# version [packager] +set -- $(tail -1 $build 2>/dev/null) + +oldVersion="$1"; shift +oldPackage="$@" +[ "${oldPackage:-none}" = none ] && unset oldPackage + + +# +# printTag - output the build tag +# reuses the old -package tag if needed +# +printTag() +{ + if [ "${package:-${oldPackage:-none}}" = none ] + then + echo "$version" + else + echo "$version ${package:-$oldPackage}" + fi +} + + if [ -n "$version" ] then @@ -115,12 +148,17 @@ else fi +# # update persistent build tag if possible -if [ $rc -eq 0 -a -n "$update" -a "$version" != "$previous" ] +# +if [ $rc -eq 0 -a -n "$update" ] then - if [ -w "$build" -o \( -w "$WM_PROJECT_DIR" -a ! -e "$build" \) ] + if [ "$version:$package" != "$oldVersion:$oldPackage" ] then - echo $version >| "$build" 2>/dev/null + if [ -w "$build" -o \( -w "$WM_PROJECT_DIR" -a ! -e "$build" \) ] + then + printTag >| "$build" 2>/dev/null + fi fi fi @@ -130,32 +168,38 @@ if [ -n "$checkOnly" ] then if [ $rc -eq 0 ] then - test "$version" = "$previous" + test "$version:${package:-$oldPackage}" = "$oldVersion:$oldPackage" rc=$? if [ $rc -eq 0 ] then - echo "same version as previous build" + echo "same version as previous build" 1>&2 else - echo "version changed from previous build" + echo "version changed from previous build" 1>&2 fi else - echo "no git description found" + echo "no git description found" 1>&2 fi exit $rc fi -if [ $rc -eq 0 ] +# +# cannot get git information or -version version +# +if [ $rc -ne 0 ] then - # output the git information or the -version version - echo $version -elif [ -n "$previous" ] -then - # use previous build tag - echo $previous -else - # fallback to WM_PROJECT_VERSION alone - echo ${WM_PROJECT_VERSION:-unknown} + if [ -n "$oldVersion" ] + then + # use previous version info + version="$oldVersion" + else + # fallback to WM_PROJECT_VERSION alone + version="${WM_PROJECT_VERSION:-unknown}" + fi fi + +# output the tag +printTag + #------------------------------------------------------------------------------