diff --git a/scripts/met_build.sh b/scripts/met_build.sh index d00f35fbf1..3695feefed 100755 --- a/scripts/met_build.sh +++ b/scripts/met_build.sh @@ -9,8 +9,9 @@ # This script is called by the # MET_checkout_and_build.sh script. # -# The desired version of the code must have alredy -# been checked out prior to calling this script. +# The desired version of the code must have +# already been checked out prior to calling this +# script. # # Usage: MET_build # @@ -38,9 +39,9 @@ fi # Check for 0 or 1 arguments if [ ${NARGS} -eq 0 ]; then - VERSION="met-${CUR_REV}" + VERSION="${CUR_REV}" elif [ ${NARGS} -eq 1 ]; then - VERSION="met-${1}" + VERSION="${1}" else echo echo "USAGE: MET_build " @@ -48,17 +49,17 @@ else exit 1 fi +# Set the MET build version by stripping off leading "v" from "vX.Y" +export MET_BUILD_VERSION=`echo $VERSION | sed 's/v//g'` +echo "Building MET version '${MET_BUILD_VERSION}'" + # Copy the current met directory -cp -r met ${VERSION} -cd ${VERSION} +cp -r met met-${MET_BUILD_VERSION} +cd met-${MET_BUILD_VERSION} # Cleanup rm -f `find ./ -name ".gitignore"` -# Set the MET build version for bootstrap by stripping off leading "met-" -export MET_BUILD_VERSION=`echo $VERSION | sed 's/met-//g'` -echo "Building MET version '${MET_BUILD_VERSION}'" - # Run the bootstrap program to prepare for running configure echo "Running 'bootstrap' to prepare for running configure" ./bootstrap > /dev/null @@ -100,8 +101,8 @@ make dist > /dev/null # Construct the desired name for the tar file. autoconf # creates the tar file using it's standard naming convention. -TAR_FILE="${VERSION}.${DATE}.tar.gz" +TAR_FILE="met-${MET_BUILD_VERSION}.${DATE}.tar.gz" -echo "Copying tar file to new name: '${TAR_FILE}'" +echo "Moving tar file to new name: '${TAR_FILE}'" mv met-* ../${TAR_FILE} diff --git a/scripts/met_checkout_and_build.sh b/scripts/met_checkout_and_build.sh index e1f3986d61..bad4214e89 100755 --- a/scripts/met_checkout_and_build.sh +++ b/scripts/met_checkout_and_build.sh @@ -80,7 +80,7 @@ run_command() { return ${STATUS} } -# Run svn info to update contents of version.txt +# Use the Git info to update the contents of version.txt get_git_info() { echo "CALLING: git config, git rev-parse, and git log" git config --get remote.origin.url | sed -r 's/^/Repository:\t\t/g' > met/data/version.txt @@ -88,6 +88,12 @@ get_git_info() { git log -1 --format=%cd met | sed -r 's/^/Last Changed Date:\t/g' >> met/data/version.txt } +# Store the path the current script being run +SCRIPT_DIR=`dirname $0` +if [[ ${SCRIPT_DIR:0:1} != "/" ]]; then + SCRIPT_DIR=`pwd`/${SCRIPT_DIR} +fi + # Clone repo into a working directory mkdir build; cd build git clone ${GIT_REPO} @@ -142,18 +148,19 @@ else exit 1 fi -# Check that the met_build.sh script exists -if [[ ! -e "scripts/met_build.sh" ]]; then +# Check that the met_build.sh script exists in the same +# directory as the met_checkout_and_build script +if [[ ! -e "${SCRIPT_DIR}/met_build.sh" ]]; then echo - echo "ERROR: scripts/met_build.sh does not exist!" + echo "ERROR: ${SCRIPT_DIR}/met_build.sh script does not exist!" echo exit 1 fi # Call the build script to build the release -run_command "scripts/met_build.sh ${BUILD_ARGS}" +run_command "${SCRIPT_DIR}/met_build.sh ${BUILD_ARGS}" run_command "mv *.tar.gz ../../." run_command "cd ../.." run_command "rm -rf build"