From a609f8e909aa0d1d4ec6851c1c1dc1eb68e224b5 Mon Sep 17 00:00:00 2001
From: Graeme A Stewart <graeme.andrew.stewart@cern.ch>
Date: Sat, 1 Apr 2017 17:03:56 +0200
Subject: [PATCH] Add override environment variables for AtlasExternals and
 Gaudi checkouts

Add some environment variables with a standard pattern of
External_URL and External_REF that control the repository
URL and refrence used in the checkout scripts. This makes
it much easier to test changes to these repositories
before they are merged into the main repos. The special
value "current" for the URL signals no clone or checkout
and leaves the current checkout in place, so that even
uncommitted changes can be tested.


Former-commit-id: 061edbfd49e1c4a58724ef6817f6cf0e3ed84652
---
 Build/AtlasBuildScripts/checkout_Gaudi.sh     | 21 +++++++++++++++++++
 .../checkout_atlasexternals.sh                | 21 +++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/Build/AtlasBuildScripts/checkout_Gaudi.sh b/Build/AtlasBuildScripts/checkout_Gaudi.sh
index a536cf4c3b6..15851ec1313 100755
--- a/Build/AtlasBuildScripts/checkout_Gaudi.sh
+++ b/Build/AtlasBuildScripts/checkout_Gaudi.sh
@@ -18,6 +18,13 @@ usage() {
     echo "    -t branch/tag: Mandatory branch/tag/hash to check out"
     echo "    -s directory: Mandatory source directory to use"
     echo "    -e url: Optional source URL to use for the checkout"
+    echo
+    echo "  This script will allow the environment variables"
+    echo "  Gaudi_URL and Gaudi_REF to override"
+    echo "  other values (even those on the command line)"
+    echo "  If Gaudi_URL is set to 'current' then"
+	echo "  no clone or checkout is done and the working copy"
+	echo "  in the source directory is left untouched."
 }
 
 # Parse the command line arguments:
@@ -52,6 +59,20 @@ while getopts ":t:o:s:e:h" opt; do
     esac
 done
 
+if [ "$Gaudi_URL" != "" ]; then
+	GAUDIURL=$Gaudi_URL
+	echo "Gaudi URL overridden to $GAUDIURL from environment"
+	if [ "$Gaudi_URL" = "current" ]; then
+		echo "Leaving current checkout in place for build"
+		exit 0
+	fi 
+fi
+
+if [ "$Gaudi_REF" != "" ]; then
+	TAGBRANCH=$Gaudi_REF
+	echo "Gaudi ref overridden to $TAGBRANCH from environment"
+fi
+
 # The tag/branch and a source directory must have been specified:
 if [ "$TAGBRANCH" = "" ] || [ "$SOURCEDIR" = "" ]; then
     echo "Not all required arguments were provided!"
diff --git a/Build/AtlasBuildScripts/checkout_atlasexternals.sh b/Build/AtlasBuildScripts/checkout_atlasexternals.sh
index ba9ebadd509..a6a6627ed26 100755
--- a/Build/AtlasBuildScripts/checkout_atlasexternals.sh
+++ b/Build/AtlasBuildScripts/checkout_atlasexternals.sh
@@ -18,6 +18,13 @@ usage() {
     echo "    -t branch/tag: Mandatory branch/tag/hash to check out"
     echo "    -s directory: Mandatory source directory to use"
     echo "    -e url: Optional source URL to use for the checkout"
+    echo
+    echo "  This script will allow the environment variables"
+    echo "  AtlasExternals_URL and AtlasExternals_REF to override"
+    echo "  other values (even those on the command line)."
+    echo "  If AtlasExternals_URL is set to 'current' then"
+	echo "  no clone or checkout is done and the working copy"
+	echo "  in the source directory is left untouched."
 }
 
 # Parse the command line arguments:
@@ -52,6 +59,20 @@ while getopts ":t:o:s:e:h" opt; do
     esac
 done
 
+if [ "$AtlasExternals_URL" != "" ]; then
+	EXTERNALSURL=$AtlasExternals_URL
+	echo "Externals URL overridden to $EXTERNALSURL from environment"
+	if [ "$AtlasExternals_URL" = "current" ]; then
+		echo "Leaving current checkout in place for build"
+		exit 0
+	fi 
+fi
+
+if [ "$AtlasExternals_REF" != "" ]; then
+	TAGBRANCH=$AtlasExternals_REF
+	echo "Externals ref overridden to $TAGBRANCH from environment"
+fi
+
 # The tag/branch and a source directory must have been specified:
 if [ "$TAGBRANCH" = "" ] || [ "$SOURCEDIR" = "" ]; then
     echo "Not all required arguments were provided!"
-- 
GitLab