gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosim...@apache.org
Subject svn commit: r123357 - /gump/trunk/cron /gump/trunk/gump
Date Sun, 26 Dec 2004 15:41:23 GMT
Author: leosimons
Date: Sun Dec 26 07:41:22 2004
New Revision: 123357

URL: http://svn.apache.org/viewcvs?view=rev&rev=123357
Log:
make gump CLI interface read in the environment file in cron/.
Modified:
   gump/trunk/cron/   (props changed)
   gump/trunk/gump

Modified: gump/trunk/gump
Url: http://svn.apache.org/viewcvs/gump/trunk/gump?view=diff&rev=123357&p1=gump/trunk/gump&r1=123356&p2=gump/trunk/gump&r2=123357
==============================================================================
--- gump/trunk/gump	(original)
+++ gump/trunk/gump	Sun Dec 26 07:41:22 2004
@@ -144,6 +144,16 @@
   exit 1
 }
 
+# Load the environment variables script if it exists
+function load_env
+{
+  local host=`hostname -s`
+  local envfile="`pwd`/cron/local-env-$host.sh"
+  if [[ -f $envfile ]]; then
+    . $envfile
+  fi
+}
+
 # Print a friendly error message if some dependency is missing.
 #
 # Arguments:
@@ -161,6 +171,27 @@
   fi
 }
 
+# Print a friendly error message if an environment variable is not set.
+#
+# Arguments:
+#   - name of the variable
+#   - description of what the variable should be set to
+function check_env_var
+{
+  local host=`hostname -s`
+  local envfile="`pwd`/cron/local-env-$host.sh"
+
+  local dereferenced=${!1}
+  if [[ -z "$dereferenced" ]]; then
+    error "The variable $1 has not been set. It should be set to
+$2.
+You can either set this before invoking gump, or set it in a file
+named
+  `pwd`/cron/local-env-$envfile.sh
+"
+  fi
+}
+
 # Figure out which action to execute.
 function delegate
 {
@@ -233,6 +264,7 @@
 function test
 {
   check_env "python" "http://www.python.org/"
+  check_env_var "GUMP_HOME" "the location of the gump checkout"
 
   local oldpythonpath=$PYTHONPATH
   if [[ -z $oldpythonpath ]]; then
@@ -245,8 +277,6 @@
   cd python
   python ../bin/testrunner.py -d ../python/gump/test $@
   cd ..
-
-  export PYTHONPATH=$oldpythonpath
 }
 
 # Run gumpy integration tests
@@ -350,6 +380,9 @@
 #############################################################################
 # Run the script...
 #############################################################################
+
+# Load any environment variables
+load_env
 
 # Figure out the action to take then run the appropriate function
 delegate $@

Mime
View raw message