# HG changeset patch
# User J. H. Palmieri
# Date 1301008361 25200
# Node ID a9e727f3f9ccacde0639b24aca03b72f44a5d785
# Parent d01fc90261bb27331e6fda3c89500e9f7b6aca37
#9960: require SAGE_CHECK to be "yes"
The patch also fixes two other flaws: 1. Use return instead of exit in
sageenv, exit with 1 if sourcing sageenv failed. 2. Any output of
sagecheck64 is redirected to /dev/null. This should be changed; see
ticket #10303.
diff r d01fc90261bb r a9e727f3f9cc sageenv
 a/sageenv
+++ b/sageenv
@@ 42,7 +42,7 @@ if [ "$SAGE_ROOT" = "" ]; then
echo "Error: You must set the SAGE_ROOT environment"
echo "variable or run this script from the SAGE_ROOT or "
echo "SAGE_ROOT/local/bin/ directory."
 exit 1
+ return 1
else
SAGE_ROOT="$GUESSED_SAGE_ROOT"
export SAGE_ROOT
@@ 58,7 +58,7 @@ else
echo "a bad value. You must correct it or erase it and"
echo "run this script from the SAGE_ROOT or"
echo "SAGE_ROOT/local/bin/ directory."
 exit 1
+ return 1
fi
fi
@@ 82,7 +82,7 @@ if contains_spaces X${SAGE_ROOT}X ; then
echo "It is currently \"$SAGE_ROOT\"."
echo "Please correct this by moving Sage (or renaming one or more directories) first."
echo "Exiting now..."
 exit 1
+ return 1
fi
@@ 222,7 +222,7 @@ if [ `uname` = "Darwin" ]; then
fi
if [ "$1" = "short" ]; then
 exit 0
+ return 0
fi
if [ z "$RHOME" ]; then
@@ 281,13 +281,13 @@ fi
if [ "$SAGE64" != "yes" a "$SAGE64" != "no" ]; then
echo "The environment variable SAGE64 (=$SAGE64) must be either unset, yes or no."
 exit 1
+ return 1
fi
# In case SAGE64 has been set to yes before reinject it into the environment
# This is only done on OSX and Solaris since those are the only real multi lib
# arches we support. Eventually Linux PPC on the PS3 might need to be added here
source $SAGE_LOCAL/bin/sagecheck64 2> /dev/null
+source $SAGE_LOCAL/bin/sagecheck64 1> /dev/null 2> /dev/null
export SAGE64
if [ "$CXXFLAGS" = "" ]; then
diff r d01fc90261bb r a9e727f3f9cc sagesage
 a/sagesage
+++ b/sagesage
@@ 225,6 +225,7 @@ usage_advanced() {
if [ $? ne 0 ]; then
echo >&2 "Error setting environment variables by running \"$SAGE_ROOT/local/bin/sageenv\";"
echo >&2 "possibly contact sagedevel (see http://groups.google.com/group/sagedevel)."
+ exit 1
fi
# Sage startup script passes some funny options, which are
diff r d01fc90261bb r a9e727f3f9cc sagespkg
 a/sagespkg
+++ b/sagespkg
@@ 46,9 +46,13 @@ no_version()
# The following sets environment variables for building
# packages. (Using dot suggested by W. Cheung.)
. "$SAGE_ROOT/local/bin/sageenv"

cd "$SAGE_PACKAGES"
+. "$SAGE_ROOT/local/bin/sageenv" # *returns* nonzero value on errors rather than exiting
+
+if [ $? ne 0 ]; then
+ echo "Error setting environment variables by running \"$SAGE_ROOT/local/bin/sageenv\";"
+ echo "possibly contact sagedevel (see http://groups.google.com/group/sagedevel)."
+ exit 1
+fi
if [ $# eq 0 ]; then
echo "Currently installed packages:"
@@ 368,7 +372,7 @@ if [ $? eq 0 ]; then
echo "Successfully installed $PKG_NAME"
cd $BASEDIR
 if [ "$SAGE_CHECK" != "" a f spkgcheck ]; then
+ if [ "x$SAGE_CHECK" = "xyes" a f spkgcheck ]; then
echo "Running the test suite."
chmod +x spkgcheck
./spkgcheck