Ticket #9960: trac_9960-additional_fixes_to_sage-spkg--scripts-repo.patch

File trac_9960-additional_fixes_to_sage-spkg--scripts-repo.patch, 4.1 KB (added by leif, 11 years ago)

SCRIPTS REPO. Apply on top of John's patch.

  • sage-spkg

    # HG changeset patch
    # User Leif Leonhardy <not.really@online.de>
    # Date 1285121722 -7200
    # Node ID 1423399abb37f36423eef2f3dd6f710fdf6661af
    # Parent  067c4034cf2498844cf6cddec9d98cb07a6d3eb4
    #9960 Additional fixes to sage-spkg, some comments added.
    
    diff -r 067c4034cf24 -r 1423399abb37 sage-spkg
    a b  
    3030#
    3131#######################################################
    3232
    33 mymkdir()
     33mymkdir()       # XXX: This function is superfluous since we have 'mkdir -p'
    3434{
    3535    if [ ! -d $1 ]; then
    3636            mkdir $1
     
    3939
    4040no_version()
    4141{
    42     if [ -z "`echo "$1" | grep -`" ]; then
     42    if [ -z "`echo "$1" | grep -`" ]; then      # XXX: too complicated
    4343        echo "no version"
    4444    fi
    4545}
     46
    4647# The following sets environment variables for building
    4748# packages.  (Using dot suggested by W. Cheung.)
    4849
    49 . "$SAGE_ROOT/local/bin/sage-env"
     50. "$SAGE_ROOT/local/bin/sage-env" # *returns* non-zero value on errors rather than exiting
    5051
    51 cd "$SAGE_PACKAGES"
     52if [ $? -ne 0 ]; then
     53    echo "Error setting environment variables by running \"$SAGE_ROOT/local/bin/sage-env\";"
     54    echo "possibly contact sage-devel (see http://groups.google.com/group/sage-devel)."
     55    exit 1
     56fi
     57
     58
     59cd "$SAGE_PACKAGES"     # SAGE_PACKAGES is set in sage-env
    5260
    5361if [ $# -eq 0 ]; then
    5462    echo "Currently installed packages:"
     
    5866
    5967
    6068cd "$SAGE_PACKAGES"
    61 mymkdir "$BUILD"
     69mymkdir "$BUILD"        # BUILD is also set in sage-env, but not to an absolute path
    6270mymkdir installed
    6371cd "$BUILD"
    6472mymkdir old
     
    154162    exit 0
    155163fi
    156164
    157 cd "$SAGE_PACKAGES/build"
     165cd "$SAGE_PACKAGES/build"       # FIXME: Above, we use $BUILD instead of "build"
    158166
    159167if [ $DELETE_TMP -eq 1 ]; then
    160168    echo "Deleting directories from past builds of previous/current versions of $PKG_NAME"
    161169    # Make triply sure that we are in the build directory before doing
    162170    # a scary "rm -rf".
    163     cd "$SAGE_PACKAGES/build"
     171    cd "$SAGE_PACKAGES/build"   # FIXME: see above
    164172    if [ $? -ne 0 ]; then
    165173        echo "Unable to find build directory."
    166174    else
     
    323331head -1 spkg-install | grep python > /dev/null
    324332if [ $? -eq 0 ]; then   # if it is found, then the exit code will be 0
    325333    if [ ! -f "$SAGE_LOCAL"/bin/python ]; then   # now check if the python program is in local/bin/
    326          # if so, exit with an error. 
     334         # if not, exit with an error:
    327335         echo "The spkg-install script depends on the Sage Python package,"
    328336         echo "but the Sage Python package is not yet installed.  This may be"
    329337         echo "a bug in the Sage build system dependency file.  Please"
     
    338346    if [ -e ./spkg-debian ]; then
    339347            time ./spkg-debian
    340348    else
    341             time sage-build-debian $BASEDIR
     349            time sage-build-debian "$BASEDIR"
    342350    fi
    343351else
    344352    time ./spkg-install
    345353fi
    346354
    347355if [ $? -eq 0 ]; then
    348     cd $INSTALLED
     356    cd "$INSTALLED"
    349357    # TURNED OFF: Remove all old packages with the same name up to the first "-":
    350358    # rm -f $PKG_BASE-*
    351359
     
    354362    echo "PACKAGE NAME: $PKG_NAME" > "$PKG_NAME"
    355363    echo "INSTALL DATE: `date`" >> "$PKG_NAME"
    356364    echo "UNAME: `uname -a`" >> "$PKG_NAME"
    357     echo "Sage VERSION: `grep Sage $SAGE_LOCAL/bin/sage-banner`" >> "$PKG_NAME"
     365    echo "Sage VERSION: `grep Sage $SAGE_LOCAL/bin/sage-banner`" >> "$PKG_NAME" # FIXME: See #9434
    358366    echo "Successfully installed $PKG_NAME"
    359367
    360     cd $BASEDIR
     368    cd "$BASEDIR"
    361369    if [ "x$SAGE_CHECK" = "xyes" -a -f spkg-check ]; then
    362370        echo "Running the test suite."
    363371        chmod +x spkg-check
     
    380388            echo "subshell."
    381389            exit 1
    382390        else
    383             echo "TEST SUITE: passed" >> "$PKG_NAME"
     391            echo "TEST SUITE: passed" >> "$INSTALLED/$PKG_NAME"
    384392        fi
    385393    fi
    386394
     
    419427cd "$SAGE_LOCAL"/bin
    420428./sage-make_relative
    421429
    422 echo "Finished installing $PKG_NAME.spkg" 
     430echo "Finished installing $PKG_NAME.spkg"
    423431
    424432# It's OK if the above fails -- in fact it will until Python
    425 # itself gets installed. That's fine. 
    426 exit 0   
     433# itself gets installed. That's fine.
     434exit 0