Skip to content

Commit

Permalink
avoid using VERSION.cmake
Browse files Browse the repository at this point in the history
Former-commit-id: 47f0163f021f7c4ea4e26d2c6c9e58cf97a333f4
  • Loading branch information
avibahra committed Nov 7, 2018
1 parent 4439e60 commit 0a0fed4
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 84 deletions.
9 changes: 4 additions & 5 deletions ACore/doc/extracting_version_number.ddoc
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# ==============================================================================================
# We extract version number for $WK/VERSION.cmake file.
# cmake will also generate a header file, for inclusion.
# We extract version number for $WK/ACore/src/ecflow_version.h this is a generated file.
#
cd $WK
release=$(cat VERSION.cmake | grep 'set( ECFLOW_RELEASE' | awk '{print $3}'| sed 's/["]//g')
major=$(cat VERSION.cmake | grep 'set( ECFLOW_MAJOR' | awk '{print $3}'| sed 's/["]//g')
minor=$(cat VERSION.cmake | grep 'set( ECFLOW_MINOR' | awk '{print $3}'| sed 's/["]//g')
release=$(cat ACore/src/ecflow_version.h | grep 'ECFLOW_RELEASE' | awk '{print $3}'| sed 's/["]//g')
major=$(cat ACore/src/ecflow_version.h | grep 'ECFLOW_MAJOR' | awk '{print $3}'| sed 's/["]//g')
minor=$(cat ACore/src/ecflow_version.h | grep 'ECFLOW_MINOR' | awk '{print $3}'| sed 's/["]//g')
ECFLOW_VERSION=$release.$major.$minor


Expand Down
8 changes: 4 additions & 4 deletions ACore/src/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ std::string File::root_source_dir()
// bjam
fs::path current_path = fs::current_path();
std::string the_current_path = current_path.string();
std::string version_cmake = the_current_path + "/VERSION.cmake";
std::string version_cmake = the_current_path + "/Jamroot.jam";
if (fs::exists(version_cmake)) {
return the_current_path;
}
Expand All @@ -997,7 +997,7 @@ std::string File::root_source_dir()
current_path = current_path.parent_path();

// bjam
std::string version_cmake = std::string(current_path.string()) + "/VERSION.cmake";
std::string version_cmake = std::string(current_path.string()) + "/Jamroot.jam";
if (fs::exists(version_cmake)) {
std::string the_root_source_dir = current_path.string(); // cos current_path.string() is returned by reference
return the_root_source_dir;
Expand All @@ -1021,7 +1021,7 @@ std::string File::root_build_dir()
std::string the_current_path = current_path.string();

// bjam
std::string version_cmake = the_current_path + "/VERSION.cmake";
std::string version_cmake = the_current_path + "/Jamroot.jam";
if (fs::exists(version_cmake)) return the_current_path;

// cmake
Expand All @@ -1037,7 +1037,7 @@ std::string File::root_build_dir()
the_current_path = current_path.string(); // cos current_path.string() is returned by reference

// bjam
std::string version_cmake = the_current_path + "/VERSION.cmake";
std::string version_cmake = the_current_path + "/Jamroot.jam";
if (fs::exists(version_cmake)) return the_current_path;

// cmake
Expand Down
5 changes: 1 addition & 4 deletions ACore/src/Version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,9 @@ namespace ecf {
// see ACore/doc/extracting_version_number.ddoc
//
// See ACore/src/ecflow_version.h"
// This file is generated from $WK/VERSION.cmake when cmake is run, i.e
// This file is generated when cmake is run, i.e
// sh -x $WK/cmake.sh debug
//
// It is also extracted by python, from VERSION.CMAKE check build_scripts/nightly/build.py
// This minimises the places where we have hard code the version number.
//
// When changing the version change remember to:
// - re-login into remote system to update ECFLOW_INSTALL_DIR & ECFLOW_PYTHON_INSTALL_DIR
// required for interactive install
Expand Down
5 changes: 1 addition & 4 deletions Jamroot.jam
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ constant ECFLOW_SHARED_DIR : $(ECFLOW_DESTDIR)$(ECFLOW_INSTALL_DIR)/share/ecflow
#echo "ECFLOW_PYTHON_INSTALL_DIR = '$(ECFLOW_PYTHON_INSTALL_DIR)'" ;
#echo "ECFLOW_SHARED_DIR = '$(ECFLOW_SHARED_DIR)'" ;

#
# ** NO LONGER used **
# Allow the installation directory be be defined externally, by the environment variable ECFLOW_INSTALL_DIR
#
# However we want this to be explicit, as we dont need it on a day to day basis.
Expand All @@ -105,9 +105,6 @@ constant ECFLOW_SHARED_DIR : $(ECFLOW_DESTDIR)$(ECFLOW_INSTALL_DIR)/share/ecflow
# Note: Not all system have XLib, hence install ecFlowview manually by using:
# bjam -d2 install-viewer
#
# Make sure for ECMWF that ECFLOW_INSTALL_DIR leaf directory encompasses version number
# that ties up with $WK/VERSION.cmake
#

# Do no call this on the command line, prefer bjam install-all || install-viewer
# If this is called in isolation ldd will show the referenced shared lib as missing
Expand Down
4 changes: 2 additions & 2 deletions Pyext/migrate/py_u_TestMigrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def get_root_source_dir():
if tail.find("ecflow") != -1 :

# bjam, already at the source directory
if os.path.exists(cwd + "/VERSION.cmake"):
print(" Found VERSION.cmake in " + cwd)
if os.path.exists(cwd + "/Jamroot.jam"):
print(" Found Jamroot.jam in " + cwd)
return cwd

if tail != "Pyext" and tail != "migrate":
Expand Down
4 changes: 2 additions & 2 deletions Pyext/samples/TestBench.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def get_root_source_dir():
if tail.find("ecflow") != -1 :

# bjam, already at the source directory
if os.path.exists(cwd + "/VERSION.cmake"):
print(" Found VERSION.cmake in " + cwd)
if os.path.exists(cwd + "/Jamroot.jam"):
print(" Found Jamroot.jam in " + cwd)
return cwd

if tail != "Pyext" and tail != "migrate":
Expand Down
47 changes: 0 additions & 47 deletions SCRATCH/src/tmp.py

This file was deleted.

8 changes: 4 additions & 4 deletions build_scripts/cray_fix/swap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ fi
# =================================================================================================
# Determine the release,major,minor numbers for this version
cd $WK
release=$(cat VERSION.cmake | grep 'set( ECFLOW_RELEASE' | awk '{print $3}'| sed 's/["]//g')
major=$(cat VERSION.cmake | grep 'set( ECFLOW_MAJOR' | awk '{print $3}'| sed 's/["]//g')
minor=$(cat VERSION.cmake | grep 'set( ECFLOW_MINOR' | awk '{print $3}'| sed 's/["]//g')
release=$(cat ACore/src/ecflow_version.h | grep 'ECFLOW_RELEASE' | awk '{print $3}'| sed 's/["]//g')
major=$(cat ACore/src/ecflow_version.h | grep 'ECFLOW_MAJOR' | awk '{print $3}'| sed 's/["]//g')
minor=$(cat ACore/src/ecflow_version.h | grep 'ECFLOW_MINOR' | awk '{print $3}'| sed 's/["]//g')
ECFLOW_VERSION=$release.$major.$minor

export ECFLOW_INSTALL_DIR=/usr/local/apps/ecflow/$release.$major.$minor
export ECFLOW_PYTHON_INSTALL_DIR=$ECFLOW_INSTALL_DIR/lib/python/2.7/site-packages/ecflow

Expand Down
7 changes: 3 additions & 4 deletions build_scripts/tar_ecflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ find . -name massif.out.\* -exec rm -rf massif.out.* {} \; -print
# Determine ecflow build directory name: see ACore/doc/extracting_version_number.ddoc
# ========================================================================
cd $WK

release=$(cat VERSION.cmake | grep 'set( ECFLOW_RELEASE' | awk '{print $3}'| sed 's/["]//g')
major=$(cat VERSION.cmake | grep 'set( ECFLOW_MAJOR' | awk '{print $3}'| sed 's/["]//g')
minor=$(cat VERSION.cmake | grep 'set( ECFLOW_MINOR' | awk '{print $3}'| sed 's/["]//g')
release=$(cat ACore/src/ecflow_version.h | grep 'ECFLOW_RELEASE' | awk '{print $3}'| sed 's/["]//g')
major=$(cat ACore/src/ecflow_version.h | grep 'ECFLOW_MAJOR' | awk '{print $3}'| sed 's/["]//g')
minor=$(cat ACore/src/ecflow_version.h | grep 'ECFLOW_MINOR' | awk '{print $3}'| sed 's/["]//g')

ECFLOW_WS_DIR=ecflow_${release}_${major}_${minor}

Expand Down
10 changes: 5 additions & 5 deletions cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,6 @@ else
cmake_build_type=Release
fi

# ====================================================================================
# Use for local install
release=$(cat VERSION.cmake | grep 'set( ECFLOW_RELEASE' | awk '{print $3}'| sed 's/["]//g')
major=$(cat VERSION.cmake | grep 'set( ECFLOW_MAJOR' | awk '{print $3}'| sed 's/["]//g')
minor=$(cat VERSION.cmake | grep 'set( ECFLOW_MINOR' | awk '{print $3}'| sed 's/["]//g')

# ====================================================================================
# clean up source before packaging, do this after deleting ecbuild
Expand Down Expand Up @@ -323,6 +318,11 @@ if [[ $package_source_arg = package_source ]] ; then
gui_options=
fi

# ====================================================================================
# Use for local install
release=$(cat VERSION.cmake | grep 'set( ECFLOW_RELEASE' | awk '{print $3}'| sed 's/["]//g')
major=$(cat VERSION.cmake | grep 'set( ECFLOW_MAJOR' | awk '{print $3}'| sed 's/["]//g')
minor=$(cat VERSION.cmake | grep 'set( ECFLOW_MINOR' | awk '{print $3}'| sed 's/["]//g')
install_prefix=/var/tmp/$USER/install/cmake/ecflow/$release.$major.$minor

ecbuild=ecbuild
Expand Down
6 changes: 3 additions & 3 deletions version.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
release=$(cat VERSION.cmake | grep 'set( ECFLOW_RELEASE' | awk '{print $3}'| sed 's/["]//g')
major=$(cat VERSION.cmake | grep 'set( ECFLOW_MAJOR' | awk '{print $3}'| sed 's/["]//g')
minor=$(cat VERSION.cmake | grep 'set( ECFLOW_MINOR' | awk '{print $3}'| sed 's/["]//g')
release=$(cat ACore/src/ecflow_version.h | grep 'ECFLOW_RELEASE' | awk '{print $3}'| sed 's/["]//g')
major=$(cat ACore/src/ecflow_version.h | grep 'ECFLOW_MAJOR' | awk '{print $3}'| sed 's/["]//g')
minor=$(cat ACore/src/ecflow_version.h | grep 'ECFLOW_MINOR' | awk '{print $3}'| sed 's/["]//g')
ecflow_version=$release.$major.$minor

# use tr -d '\12' to remove trailing newline
Expand Down

0 comments on commit 0a0fed4

Please sign in to comment.