Ticket #12479: 12479_clean_sage_spkg.patch
File 12479_clean_sage_spkg.patch, 22.1 KB (added by , 9 years ago) |
---|
-
spkg/bin/sage
# HG changeset patch # User Jeroen Demeyer <jdemeyer@cage.ugent.be> # Date 1330468085 -3600 # Node ID f923f09355e3dd07f00eb5b208e9f716fcf28235 # Parent a0bd50ccc9c02362f88d13656dd0b19523d9002e Clean up sage-spkg diff --git a/spkg/bin/sage b/spkg/bin/sage
a b 766 766 fi 767 767 768 768 install() { 769 cd "$SAGE_ROOT/spkg" 770 if [ $# -lt 2 ]; then 771 sage-spkg 772 exit $? 773 fi 774 OPT="$1" 775 shift 776 if [ "$1" = '-m' -o "$1" = '-s' ]; then 777 OPT=$OPT" "$1 778 shift 779 fi 780 SAGE_LOGS="$SAGE_ROOT/spkg/logs" 781 if [ ! -d "$SAGE_LOGS" ]; then 782 mkdir -p "$SAGE_LOGS" 783 fi 784 for PKG in "$@" 785 do 786 echo "Calling sage-spkg on '$PKG'" 787 PKG_NAME=`echo "$PKG" | sed -e "s/\.spkg$//"` 788 PKG_NAME=`basename "$PKG_NAME"` 789 case "$PKG" in 790 /*) PKG_PATH="$PKG";; 791 *) PKG_PATH="$CUR/$PKG";; 792 esac 793 # Could use ./pipestatus here, but using an absolute path is safer: 794 # (We'll have to change it anyway in case 'pipestatus' one day moves.) 795 "$SAGE_ROOT"/spkg/pipestatus \ 796 "sage-spkg $OPT '$PKG_PATH' 2>&1" \ 797 "(trap '' SIGINT; tee -a '$SAGE_ROOT'/install.log '$SAGE_LOGS/$PKG_NAME'.log)" 798 # Do not try to install further packages (if any) if one failed: 799 if [[ $? -ne 0 ]]; then 800 echo >&2 "Error: Failed to install package '$PKG_NAME'." 801 exit 1 802 fi 803 shift 804 done 805 exit $? 769 cd "$SAGE_ROOT/spkg" 770 SAGE_LOGS="$SAGE_ROOT/spkg/logs" 771 mkdir -p "$SAGE_LOGS" 772 for PKG in "$@" 773 do 774 # Check for options 775 case "$PKG" in 776 -f) OPTF="-f" 777 continue;; 778 -m) OPTS="-s" 779 echo >&2 "Warning: the -m option is deprecated since Sage 5.0. Use -s instead." 780 continue;; 781 -s) OPTS="-s" 782 continue;; 783 esac 784 785 echo "Calling sage-spkg on '$PKG'" 786 PKG_NAME=`echo "$PKG" | sed -e "s/\.spkg$//"` 787 PKG_NAME=`basename "$PKG_NAME"` 788 case "$PKG" in 789 /*) PKG_PATH="$PKG";; 790 *) PKG_PATH="$CUR/$PKG";; 791 esac 792 # Could use ./pipestatus here, but using an absolute path is safer: 793 # (We'll have to change it anyway in case 'pipestatus' one day moves.) 794 "$SAGE_ROOT"/spkg/pipestatus \ 795 "sage-spkg $OPTF $OPTS '$PKG_PATH' 2>&1" \ 796 "(trap '' SIGINT; tee -a '$SAGE_ROOT'/install.log '$SAGE_LOGS/$PKG_NAME'.log)" 797 # Do not try to install further packages (if any) if one failed: 798 if [ $? -ne 0 ]; then 799 echo >&2 "Error: Failed to install package '$PKG_NAME'." 800 exit 1 801 fi 802 shift 803 done 804 exit $? 806 805 } 807 806 808 807 if [ "$1" = '-optional' -o "$1" = "--optional" ]; then … … 821 820 fi 822 821 823 822 if [ "$1" = '-i' ]; then 824 shift 825 echo "Installing $@" 826 install " " "$@" 823 shift 824 # If there are no further arguments, simply list all installed 825 # packages. 826 if [ $# -eq 0 ]; then 827 exec sage-spkg 828 fi 829 install "$@" 827 830 fi 828 831 829 832 if [ "$1" = '-f' ]; then 830 shift 831 echo "Force installing $@" 832 install -f "$@" 833 shift 834 # If there are no further arguments, simply list all installed 835 # packages. 836 if [ $# -eq 0 ]; then 837 exec sage-spkg 838 fi 839 install -f "$@" 833 840 fi 834 841 835 842 if [ "$1" = '-pkg' -o "$1" = '-spkg' -o "$1" = "--pkg" -o "$1" = "--spkg" ]; then -
spkg/bin/sage-spkg
diff --git a/spkg/bin/sage-spkg b/spkg/bin/sage-spkg
a b 1 1 #!/usr/bin/env bash 2 3 # William Stein, 2005-12-20 -- removed "m" option from tar,4 # which was seriously confusing the build process on some5 # (too fast?) machines, especially for mpfr.6 7 #######################################################8 # Install a Sage package. This script is9 # typically invoked by giving the command10 # sage -i <package name>11 2 # 12 # A package may assume that the following environment 3 # sage-spkg: install a Sage package 4 # 5 # This script is typically invoked by giving the command 6 # sage -i <options> <package name>... 7 # 8 # Options can be: 9 # -f: install a package even if the same version is already installed 10 # -s: do not delete temporary build directory 11 # 12 # A package may assume that the following environment 13 13 # variables are defined: 14 14 # 15 # SAGE_ROOT -- root directory of sage install 16 # SAGE_LOCAL -- $SAGE_ROOT/local 17 # SAGE_DATA -- $SAGE_ROOT/data 15 # SAGE_ROOT -- root directory of sage install 16 # SAGE_PACKAGES -- $SAGE_ROOT/spkg 17 # SAGE_LOCAL -- $SAGE_ROOT/local 18 # SAGE_DATA -- $SAGE_ROOT/data 18 19 # LIBRARY_PATH, PYTHONPATH, LD_LIBRARY_PATH, DYLD_LIBRARY_PATH 19 20 # CC, CXX, CFLAGS, CXXFLAGS, LDFLAGS, MAKE 20 21 # … … 28 29 # 3. Run the script in the package called spkg-install 29 30 # 4. Return error 1 if anything goes wrong. 30 31 # 31 ####################################################### 32 # AUTHORS: 33 # 34 # - Jeroen Demeyer (2012-02-27): #12479: big reorganization. 35 # 36 # - Volker Braun, Jeroen Demeyer (2012-01-18): #11073: remove the 37 # spkg/base repository, move this file from local/bin/sage-spkg to 38 # spkg/bin/sage-spkg. 39 # 40 # - William Stein, John Palmieri and others (Sage 4.8 and earlier). 41 # 42 #***************************************************************************** 43 # Distributed under the terms of the GNU General Public License (GPL) 44 # as published by the Free Software Foundation; either version 2 of 45 # the License, or (at your option) any later version. 46 # http://www.gnu.org/licenses/ 47 #***************************************************************************** 32 48 33 no_version()34 {35 if [ -z "`echo "$1" | grep -`" ]; then36 echo "no version"37 fi38 }39 49 40 50 # error_msg(header, command) 41 51 # This is for printing an error message if something went wrong. … … 72 82 fi 73 83 fi 74 84 85 ################################################################## 86 # Set environment variables 87 ################################################################## 88 75 89 # The following sets environment variables for building packages. 76 90 # Since this is sourced, it returns a non-zero value on errors rather 77 91 # than exiting. Using dot suggested by W. Cheung. 78 92 . "$SAGE_ROOT/spkg/bin/sage-env" 79 93 80 94 if [ $? -ne 0 ]; then 81 echo "Error setting environment variables by sourcing '$SAGE_ROOT/spkg/bin/sage-env';"82 echo "possibly contact sage-devel (see http://groups.google.com/group/sage-devel)."95 echo >&2 "Error setting environment variables by sourcing '$SAGE_ROOT/spkg/bin/sage-env';" 96 echo >&2 "possibly contact sage-devel (see http://groups.google.com/group/sage-devel)." 83 97 exit 1 84 98 fi 85 99 100 if [ -z "$SAGE_BUILD_DIR" ]; then 101 export SAGE_BUILD_DIR="$SAGE_PACKAGES/build" 102 fi 103 104 INSTALLED="$SAGE_PACKAGES/installed" 105 mkdir -p "$INSTALLED" 106 if [ $? -ne 0 ]; then 107 echo >&2 "Error creating directory $INSTALLED." 108 exit 1 109 fi 110 111 112 # Remove '.' from PYTHONPATH, which may also come from SAGE_PATH, to avoid 113 # trouble with setuptools / easy_install (cf. #10192, #10176): 114 if [ -n "$PYTHONPATH" ]; then 115 # We also collapse multiple slashs into a single one (first substitution), 116 # remove leading './'s and trailing '/.'s (second and third), and 117 # remove leading, trailing and redundant ':'s (last three substitutions): 118 new_pp=`echo ":$PYTHONPATH:" \ 119 | sed \ 120 -e 's|//*|/|g' \ 121 -e 's|:\(\./\)\{1,\}|:|g' \ 122 -e 's|\(/\.\)\{1,\}:|:|g' \ 123 -e 's|\(:\.\)\{1,\}:|:|g' \ 124 -e 's|::*|:|g' -e 's|^::*||' -e 's|::*$||'` 125 126 if [ "$PYTHONPATH" != "$new_pp" ]; then 127 echo "Cleaning up PYTHONPATH:" 128 echo " Old: \"$PYTHONPATH\"" 129 echo " New: \"$new_pp\"" 130 PYTHONPATH=$new_pp 131 export PYTHONPATH # maybe redundant, but in any case safe 132 fi 133 fi 134 135 ################################################################## 136 # Handle special command-line options 137 ################################################################## 86 138 if [ $# -eq 0 ]; then 87 139 echo "Currently installed packages:" 88 ls -1 "$ SAGE_PACKAGES/installed/"140 ls -1 "$INSTALLED" 89 141 exit 0 90 142 fi 91 143 92 # the following two options are mutually exclusive -- i.e., you 93 # can give only one. 94 144 # Options have to come in a specific order, 145 # this is ensured by spkg/bin/sage. 95 146 INFO=0 96 if [ $1 = '- info' ]; then147 if [ $1 = '--info' ]; then 97 148 INFO=1 98 149 shift 99 150 fi … … 103 154 FORCE=1 104 155 shift 105 156 fi 106 export FORCE107 157 108 158 DELETE_TMP=1 109 if [ $1 = '-s' -o $1 = '-m']; then159 if [ $1 = '-s' ]; then 110 160 DELETE_TMP=0 111 161 shift 112 162 fi … … 115 165 DELETE_TMP=0 116 166 fi 117 167 118 INSTALLED="$SAGE_PACKAGES/installed/" 119 PKG_NAME=`echo "$1" | sed -e "s/\.spkg$//"` 120 PKG_NAME=`basename "$PKG_NAME"` 168 ################################################################## 169 # Figure out the package filename, download it if needed. 170 ################################################################## 171 PKG_NAME=`basename "$1" | sed -e "s/\.spkg$//"` 121 172 PKG_SRC="$1" 122 173 PKG_BASE=`echo "$PKG_NAME" | sed -e "s/-.*//"` 123 174 124 # check if noclobber is set and warn about it125 if [ $PKG_SRC == "noclobber" ]; then126 echo "***********************************************************"127 echo "* WARNING WARNING WARNING WARNING WARNING WARNING WARNING *"128 echo "* *"129 echo "* noclobber is set in .bashrc and/or .bash_profile - you *"130 echo "* should consider disabling it. The Sage install should *"131 echo "* continue to work, so don't worry about it too much. *"132 echo "* *"133 echo "* WARNING WARNING WARNING WARNING WARNING WARNING WARNING *"134 echo "***********************************************************"135 exit 0136 fi137 138 175 if [ ! -f "$PKG_SRC" ]; then 139 176 if [ -f "$SAGE_PACKAGES/standard/$PKG_NAME.spkg" ]; then 140 177 PKG_SRC="$SAGE_PACKAGES/standard/$PKG_NAME.spkg" … … 158 195 fi 159 196 160 197 # Don't verbosely extract files from spkgs by default (#10040): 161 162 198 if [ "$SAGE_SPKG_LIST_FILES" = "yes" ]; then 163 199 UNTAR_VERBOSE=v 164 200 else … … 167 203 168 204 if [ $INFO -ne 0 ]; then 169 205 if [ ! -f "$PKG_SRC" ]; then 170 echo "Package $PKG_NAME not found"206 echo >&2 "Package $PKG_NAME not found" 171 207 fi 172 bunzip2 -c "$PKG_SRC" 2>/dev/null | tar Ofx${UNTAR_VERBOSE} - $PKG_NAME/S AGE.txt 2>/dev/null208 bunzip2 -c "$PKG_SRC" 2>/dev/null | tar Ofx${UNTAR_VERBOSE} - $PKG_NAME/SPKG.txt 2>/dev/null 173 209 if [ $? -ne 0 ]; then 174 tar Ofx${UNTAR_VERBOSE} "$PKG_SRC" "$PKG_NAME/S AGE.txt" 2>/dev/null210 tar Ofx${UNTAR_VERBOSE} "$PKG_SRC" "$PKG_NAME/SPKG.txt" 2>/dev/null 175 211 fi 176 212 echo "" 177 213 if [ $? -ne 0 ]; then 178 echo "No file SAGE.txt in $PKG_NAME"214 echo >&2 "No file SPKG.txt in $PKG_NAME" 179 215 exit 1 180 216 fi 181 217 exit 0 182 218 fi 183 219 184 220 echo "$PKG_NAME" 185 186 echo "Machine:" 187 uname -a 221 echo "====================================================" 188 222 189 223 if [ -f "$INSTALLED/$PKG_NAME" -a $FORCE -eq 0 ]; then 190 echo "sage: $1 is already installed" 224 echo "Package $PKG_NAME is already installed." 225 echo "Use 'sage -f $PKG_SRC' to force a reinstallation." 226 # Touch installed file such that "make" considers it up-to-date. 191 227 touch "$INSTALLED/$PKG_NAME" 192 228 exit 0 193 229 fi 194 230 195 if [ ! -n "$SAGE_BUILD_DIR" ]; then 196 SAGE_BUILD_DIR="$SAGE_PACKAGES/build" 197 fi 198 199 mkdir -p "$SAGE_PACKAGES/installed" 200 if [ $? -ne 0 ]; then 201 echo >&2 "Error creating directory $SAGE_PACKAGES/installed." 202 exit 1 203 fi 231 # Make absolutely sure that we are in the build directory before doing 232 # a scary "rm -rf" below. 204 233 mkdir -p "$SAGE_BUILD_DIR" 205 234 if [ $? -ne 0 ]; then 206 235 echo >&2 "Error creating directory $SAGE_BUILD_DIR." 207 236 exit 1 208 237 fi 209 210 # Make absolutely sure that we are in the build directory before doing211 # a scary "rm -rf" below.212 238 cd "$SAGE_BUILD_DIR" 213 239 if [ $? -ne 0 ]; then 214 240 echo >&2 "Unable to find build directory." … … 216 242 fi 217 243 218 244 if [ $DELETE_TMP -eq 1 ]; then 219 echo "Deleting directories from past builds of previous/current versions of $PKG_NAME"220 245 rm -rf "$PKG_BASE-"* 221 246 else 222 247 for dir in "$PKG_BASE-"* … … 235 260 fi 236 261 237 262 if [ ! -f "$PKG_SRC" ]; then 238 echo "$0: file $PKG_NAME does not exist" 263 echo "$0: file $PKG_NAME does not exist" 239 264 echo "Attempting to download it." 240 265 CUR=`pwd` 241 266 mkdir -p "$SAGE_PACKAGES/optional" 242 267 cd "$SAGE_PACKAGES/optional" 243 268 244 269 FOUND_VERSION='' 245 if [ -n "`no_version "$PKG_NAME"`" ]; then 270 if ! echo "$PKG_NAME" | grep - >/dev/null; then 271 # No version number found 246 272 echo "Searching for latest version of $PKG_NAME" 247 273 PKG_NAME=`sage-latest-online-package "$PKG_NAME"` 248 274 if [ $? -eq 0 ]; then … … 278 304 else 279 305 sage-download_package "$PKG_NAME" 280 306 fi 281 if [ ! -f "$PKG_NAME.spkg" ]; then 307 if [ ! -f "$PKG_NAME.spkg" ]; then 282 308 echo "sage: Failed to download package $PKG_NAME from $SAGE_SERVER" 283 309 exit 1 284 310 fi … … 286 312 cd "$CUR" 287 313 fi 288 314 289 # * The -i option below to ignore checksum errors, since290 # I've had problems with this on Solaris.291 # * The m option avoids clock skew problems.292 293 315 echo "Extracting package $PKG_SRC ..." 294 316 ls -l "$PKG_SRC" 295 317 … … 305 327 echo "Finished extraction" 306 328 307 329 if [ ! -d "$PKG_NAME" ]; then 308 echo "sage: After decompressing the directory $PKG_NAME does not exist" 309 echo "This means that the corresponding .spkg needs to be downloaded" 310 echo "again." 311 if [ -n "`no_version "$PKG_NAME"`" ]; then 330 echo >&2 "sage: After decompressing the directory $PKG_NAME does not exist" 331 echo >&2 "This means that the corresponding .spkg needs to be downloaded" 332 echo >&2 "again." 333 if ! echo "$PKG_NAME" | grep - >/dev/null; then 334 # No version number found 312 335 echo "Searching for latest version of $PKG_NAME" 313 336 PKG_NAME=`sage-latest-online-package "$PKG_NAME"` 314 337 if [ $? -eq 0 ]; then … … 320 343 fi 321 344 sage-download_package "$PKG_NAME" 322 345 echo `pwd` 323 bunzip2 -c "$PKG_NAME.spkg" | tar fx${UNTAR_VERBOSE} - 346 bunzip2 -c "$PKG_NAME.spkg" | tar fx${UNTAR_VERBOSE} - 324 347 if [ ! -d "$PKG_NAME.spkg" ]; then 325 348 tar fx${UNTAR_VERBOSE} "$PKG_NAME.spkg" 326 349 fi … … 330 353 fi 331 354 fi 332 355 356 ################################################################## 357 # The package has been extracted, prepare for installation 358 ################################################################## 359 333 360 cd "$PKG_NAME" 361 362 # When there is no spkg-install, assume the "spkg" is a tarball not 363 # specifically made for Sage. Since we want it to be as easy as 364 # possible to install such a package, we "guess" spkg-install. 334 365 if [ ! -f spkg-install ]; then 335 echo "#!/usr/bin/env bash" > spkg-install 336 echo "" >> spkg-install 337 if [ -f setup.py ]; then 338 echo "python setup.py install" >> spkg-install 366 echo '#!/usr/bin/env bash' > spkg-install 367 if [ -x configure ]; then 368 echo './configure --prefix="$SAGE_LOCAL" && make && make install' >> spkg-install 369 elif [ -f setup.py ]; then 370 echo 'python setup.py install' >> spkg-install 339 371 else 340 if [ -f configure ]; then 341 echo "./configure --prefix=\$SAGE_ROOT/local/" >> spkg-install 342 echo "make" >> spkg-install 343 echo "make install" >> spkg-install 344 else 345 echo "There is no spkg-install script, no setup.py, and no configure script," 346 echo "so I do not know how to install $PKG_SRC." 347 exit 1 348 fi 372 echo >&2 "Error: There is no spkg-install script, no setup.py, and no configure" 373 echo >&2 "script, so I do not know how to install $PKG_SRC." 374 exit 1 349 375 fi 376 chmod +x spkg-install 350 377 fi 351 378 352 chmod +x spkg-install 353 354 # Remove '.' from PYTHONPATH, which may also come from SAGE_PATH, to avoid 355 # trouble with setuptools / easy_install (cf. #10192, #10176): 356 if [ -n "$PYTHONPATH" ]; then 357 # We also collapse multiple slashs into a single one (first substitution), 358 # remove leading './'s and trailing '/.'s (second and third), and 359 # remove leading, trailing and redundant ':'s (last three substitutions): 360 new_pp=`echo ":$PYTHONPATH:" \ 361 | sed \ 362 -e 's|//*|/|g' \ 363 -e 's|:\(\./\)\{1,\}|:|g' \ 364 -e 's|\(/\.\)\{1,\}:|:|g' \ 365 -e 's|\(:\.\)\{1,\}:|:|g' \ 366 -e 's|::*|:|g' -e 's|^::*||' -e 's|::*$||'` 367 368 if [ "$PYTHONPATH" != "$new_pp" ]; then 369 echo "Cleaning up PYTHONPATH:" 370 echo " Old: \"$PYTHONPATH\"" 371 echo " New: \"$new_pp\"" 372 PYTHONPATH=$new_pp 373 export PYTHONPATH # maybe redundant, but in any case safe 379 # If spkg-install is a Python script (i.e. the first line of the file 380 # contains "python"), verify that Python has already been installed. 381 if head -1 spkg-install | grep python >/dev/null; then 382 # If there is no Python installed in local/bin, exit with an error. 383 if [ ! -x "$SAGE_LOCAL"/bin/python ]; then 384 echo >&2 "Error: The spkg-install script is written in Python, but the Python" 385 echo >&2 "package is not yet installed in Sage. This is a bug in the file" 386 echo >&2 "$SAGE_ROOT/spkg/standard/deps" 387 exit 1 374 388 fi 375 389 fi 376 390 377 391 echo "****************************************************" 378 echo "Host system" 379 echo "uname -a:" 392 echo "Host system:" 380 393 uname -a 381 if [ $? -ne 0 ]; then 382 echo "Unable to determine host system information." 383 fi 394 echo "****************************************************" 395 echo "C compiler: $CC" 396 echo "C compiler version:" 397 $CC -v 384 398 echo "****************************************************" 385 399 386 echo "****************************************************" 387 echo "CC Version" 388 echo "$CC -v" 389 $CC -v 400 ################################################################## 401 # Actually install 402 ################################################################## 403 if [ ! -x spkg-install ]; then 404 echo >&2 "WARNING: spkg-install is not executable, making it executable" 405 chmod +x spkg-install 406 fi 407 time ./spkg-install 408 390 409 if [ $? -ne 0 ]; then 391 echo "Unable to determine C compiler version." 410 error_msg "Error installing package $PKG_NAME" "make" 411 exit 1 392 412 fi 393 echo "****************************************************" 413 414 echo "Successfully installed $PKG_NAME" 415 416 if [ "$SAGE_CHECK" = "yes" ]; then 417 if [ -f spkg-check ]; then 418 echo "Running the test suite for $PKG_NAME..." 419 if [ ! -x spkg-check ]; then 420 echo >&2 "WARNING: spkg-check is not executable, making it executable" 421 chmod +x spkg-check 422 fi 423 time ./spkg-check 424 if [ $? -ne 0 ]; then 425 error_msg "Error testing package $PKG_NAME" "make check" 426 exit 1 427 fi 428 TEST_SUITE_RESULT="passed" 429 else 430 echo "Package $PKG_NAME has no test suite." 431 TEST_SUITE_RESULT="not available" 432 fi 433 fi 434 435 # Mark that the new package has been installed (and tested, if 436 # applicable). 437 PKG_NAME_INSTALLED="$INSTALLED/$PKG_NAME" 438 echo "PACKAGE NAME: $PKG_NAME" > "$PKG_NAME_INSTALLED" 439 echo "INSTALL DATE: `date`" >> "$PKG_NAME_INSTALLED" 440 echo "UNAME: `uname -a`" >> "$PKG_NAME_INSTALLED" 441 if [ -n "$TEST_SUITE_RESULT" ]; then 442 echo "TEST SUITE: $TEST_SUITE_RESULT" >> "$PKG_NAME_INSTALLED" 443 fi 444 cat "$SAGE_ROOT/VERSION.txt" >> "$PKG_NAME_INSTALLED" 394 445 395 446 396 447 ################################################################## 397 # If spkg-install is a Python script, verify that the Sage Python 398 # has already been installed. 448 # Delete the temporary build directory if required 399 449 ################################################################## 400 # Check the first line of the file for the string "python". 401 head -1 spkg-install | grep python > /dev/null 402 if [ $? -eq 0 ]; then # if it is found, then the exit code will be 0 403 if [ ! -f "$SAGE_LOCAL"/bin/python ]; then # now check if the python program is in local/bin/ 404 # if so, exit with an error. 405 echo "The spkg-install script depends on the Sage Python package," 406 echo "but the Sage Python package is not yet installed. This may be" 407 echo "a bug in the Sage build system dependency file. Please" 408 echo "update the $SAGE_ROOT/spkg/standard/deps makefile." 409 exit 1 410 fi 411 fi 412 413 BASEDIR=`pwd` 414 if [ -n "$DEBIAN_RELEASE" ]; then 415 SAGE_CHECK='' 416 if [ -e ./spkg-debian ]; then 417 time ./spkg-debian 418 else 419 time sage-build-debian $BASEDIR 420 fi 450 if [ $DELETE_TMP -eq 1 ]; then 451 echo "Deleting temporary build directory" 452 echo "$SAGE_BUILD_DIR/$PKG_NAME" 453 rm -rf "$SAGE_BUILD_DIR/$PKG_NAME" 421 454 else 422 time ./spkg-install 423 fi 424 425 if [ $? -eq 0 ]; then 426 cd "$INSTALLED" 427 # TURNED OFF: Remove all old packages with the same name up to the first "-": 428 # rm -f $PKG_BASE-* 429 430 # Mark that the new package has been installed. 431 # This file will eventually be a certificate like in OS X. 432 echo "PACKAGE NAME: $PKG_NAME" > "$PKG_NAME" 433 echo "INSTALL DATE: `date`" >> "$PKG_NAME" 434 echo "UNAME: `uname -a`" >> "$PKG_NAME" 435 if [ -f "$SAGE_ROOT"/VERSION.txt ]; then 436 cat "$SAGE_ROOT"/VERSION.txt >> "$PKG_NAME" 437 fi 438 echo "Successfully installed $PKG_NAME" 439 440 cd "$BASEDIR" 441 if [ "x$SAGE_CHECK" = "xyes" -a -f spkg-check ]; then 442 echo "Running the test suite." 443 chmod +x spkg-check 444 ./spkg-check 445 if [ $? -ne 0 ]; then 446 rm -f $SAGE_ROOT/spkg/installed/$PKG_NAME 447 error_msg "Error testing package $PKG_NAME" "make check" 448 exit 1 449 else 450 echo "TEST SUITE: passed" >> "$INSTALLED/$PKG_NAME" 451 fi 452 fi 453 454 455 # Delete the temporary build directory if required. 456 if [ $DELETE_TMP -eq 1 ]; then 457 echo "Now cleaning up tmp files." 458 if [ -d "$SAGE_BUILD_DIR/$PKG_NAME" ]; then 459 # the if is there only to avoid the possibility of a weird bug. 460 cd "$SAGE_BUILD_DIR/" 461 rm -rf "$SAGE_BUILD_DIR/$PKG_NAME" 462 fi 463 else 464 echo "You can safely delete the temporary build directory" 465 echo "$SAGE_BUILD_DIR/$PKG_NAME" 466 fi 467 468 else 469 error_msg "Error installing package $PKG_NAME" "make" 470 exit 1 455 echo "You can safely delete the temporary build directory" 456 echo "$SAGE_BUILD_DIR/$PKG_NAME" 471 457 fi 472 458 473 459 … … 482 468 fi 483 469 484 470 echo "Finished installing $PKG_NAME.spkg" 485 486 exit 0