Ticket #4949: trac_4949-root.v4.patch

File trac_4949-root.v4.patch, 7.9 KB (added by jhpalmieri, 8 years ago)

root repo

  • Makefile

    # HG changeset patch
    # User J. H. Palmieri <palmieri@math.washington.edu>
    # Date 1327299042 28800
    # Node ID 51a3773be0e46c10ea566e552a76827867e584c2
    # Parent  bfaa597b5cbd814686b3a9292c114a43cf73267e
    implement SAGE_BUILD_DIR and SAGE_KEEP_BUILT_SPKGS.
    
    diff --git a/Makefile b/Makefile
    a b doc-clean: 
    5555clean:
    5656        @echo "Deleting spkg/build..."
    5757        rm -rf spkg/build
    58         mkdir -p spkg/build
    5958        @echo "Deleting spkg/archive..."
    6059        rm -rf spkg/archive
    61         mkdir -p spkg/archive
    6260
    6361distclean: clean
    6462        @echo "Deleting all remaining traces of builds, tests etc. ..."
    distclean: clean 
    7775        rm -rf doc
    7876        rm -rf examples
    7977        rm -rf sage-python
    80         rm -rf spkg/build
    81         rm -rf spkg/archive
    8278        rm -rf matplotlibrc
    8379        rm -rf tmp
    8480        rm -f .BUILDSTART
  • spkg/base/bzip2-1.0.5-install

    diff --git a/spkg/base/bzip2-1.0.5-install b/spkg/base/bzip2-1.0.5-install
    a b  
    44###########################################
    55
    66CUR="`pwd`"
    7 BUILD=build
     7if [ ! -n "$SAGE_BUILD_DIR" ]; then
     8    SAGE_BUILD_DIR="$SAGE_ROOT/spkg/build"
     9fi
     10# This directory should already exist: it should have been created by
     11# prereq.  Just in case...
     12mkdir -p "$SAGE_BUILD_DIR"
     13if [ $? -ne 0 ]; then
     14    echo >&2 "Error creating directory $SAGE_BUILD_DIR."
     15    exit 1
     16fi
     17
    818SAGE_LOCAL="`pwd`/../local"
    919VERSION=1.0.5
    1020TARGET=bzip2-$VERSION
    fi 
    3545
    3646build()
    3747{
    38     cd $BUILD
     48    cd "$SAGE_BUILD_DIR"
    3949    echo "Unpacking bzip2"
    40     gzip -cd ../base/$TARGET.tar.gz | tar xf -
     50    gzip -cd "$SAGE_ROOT/spkg/base/$TARGET.tar.gz" | tar xf -
    4151    cd bzip2-$VERSION
    4252
    4353    echo "Building bzip2"
  • spkg/base/dir-0.1-install

    diff --git a/spkg/base/dir-0.1-install b/spkg/base/dir-0.1-install
    a b  
    11#!/bin/sh
    22
    33TARGET=dir-0.1
    4 BUILD=`pwd`/build
    54
    65mymkdir()
    76{
    build() 
    2019   mymkdir "../local/bin"
    2120   mymkdir "../local/include"
    2221   mymkdir "../tmp/"
    23    mymkdir "$BUILD"
    2422   mymkdir "installed/"
    2523
    2624   # Remove this line in Trac #12311
  • spkg/base/prereq-0.9-install

    diff --git a/spkg/base/prereq-0.9-install b/spkg/base/prereq-0.9-install
    a b  
    44###########################################
    55
    66
    7 BUILD=build
    8 ROOT=`pwd`
    9 LOCAL="$ROOT/../local"
    107TARGET=prereq-0.9
     8if [ ! -n "$SAGE_BUILD_DIR" ]; then
     9    SAGE_BUILD_DIR="$SAGE_ROOT/spkg/build"
     10fi
     11mkdir -p "$SAGE_BUILD_DIR"
     12if [ $? -ne 0 ]; then
     13    echo >&2 "Error creating directory $SAGE_BUILD_DIR."
     14    exit 1
     15fi
    1116
    12 cd $BUILD
     17cd "$SAGE_BUILD_DIR"
    1318
    1419echo "Starting prerequisite check."
    1520echo "Machine: `uname -a`"
    trap '' TTOU 
    151156# does not update the base packages and we cannot retro-actively change
    152157# that in earlier versions.  So the only thing to do is to skip this
    153158# test.
    154 if ! [ -f "../base/$TARGET.tar" ]; then
     159if ! [ -f "$SAGE_ROOT/spkg/base/$TARGET.tar" ]; then
    155160    echo >&2 "The file 'spkg/base/$TARGET.tar' does not exist."
    156161    echo >&2 "Most likely, this is because you upgraded from an old version of Sage."
    157162    echo >&2 "Since this package only does some checks, it should be okay to continue"
    158163    echo >&2 "without it.  Skipping prerequisite checks..."
    159164else
    160     tar xf "../base/$TARGET.tar"
     165    tar xf "$SAGE_ROOT/spkg/base/$TARGET.tar"
    161166   
    162167    # A reasonably sophisticated test is performed in a configure
    163168    # script, which checks compilers exist, their version numbers,
    if [ -z "`make --version 2>&1 | grep GNU 
    413418fi
    414419
    415420
    416 touch $ROOT/installed/$TARGET
    417 
     421touch "$SAGE_ROOT/spkg/installed/$TARGET"
  • spkg/bin/sage-env

    diff --git a/spkg/bin/sage-env b/spkg/bin/sage-env
    a b if [ 1 = 2 ]; then 
    214214fi
    215215
    216216# Setting Sage-related location environment variables.
    217 BUILD=build
    218217SAGE_PACKAGES="$SAGE_ROOT/spkg" && export SAGE_PACKAGES
    219218SAGE_LOCAL="$SAGE_ROOT/local"   && export SAGE_LOCAL
    220219SAGE_DATA="$SAGE_ROOT/data"     && export SAGE_DATA
  • spkg/bin/sage-spkg

    diff --git a/spkg/bin/sage-spkg b/spkg/bin/sage-spkg
    a b  
    3030#
    3131#######################################################
    3232
    33 mymkdir()
    34 {
    35     if [ ! -d $1 ]; then
    36         mkdir $1
    37     fi
    38 }
    39 
    4033no_version()
    4134{
    4235    if [ -z "`echo "$1" | grep -`" ]; then
    if [ $# -eq 0 ]; then 
    9689    exit 0
    9790fi
    9891
    99 
    100 cd "$SAGE_PACKAGES"
    101 mymkdir "$BUILD"
    102 mymkdir installed
    103 cd "$BUILD"
    104 mymkdir old
    105 
    10692# the following two options are mutually exclusive -- i.e., you
    10793# can give only one.
    10894
    if [ $1 = '-s' -o $1 = '-m' ]; then 
    125111    shift
    126112fi
    127113
     114if [ "x$SAGE_KEEP_BUILT_SPKGS" = "xyes" ]; then
     115    DELETE_TMP=0
     116fi
     117
    128118INSTALLED="$SAGE_PACKAGES/installed/"
    129119PKG_NAME=`echo "$1" | sed -e "s/\.spkg$//"`
    130120PKG_NAME=`basename "$PKG_NAME"`
    if [ -f "$INSTALLED/$PKG_NAME" -a $FORCE 
    202192    exit 0
    203193fi
    204194
    205 cd "$SAGE_PACKAGES/build"
     195if [ ! -n "$SAGE_BUILD_DIR" ]; then
     196    SAGE_BUILD_DIR="$SAGE_PACKAGES/build"
     197fi
     198
     199mkdir -p "$SAGE_PACKAGES/installed"
     200if [ $? -ne 0 ]; then
     201    echo >&2 "Error creating directory $SAGE_PACKAGES/installed."
     202    exit 1
     203fi
     204mkdir -p "$SAGE_BUILD_DIR"
     205if [ $? -ne 0 ]; then
     206    echo >&2 "Error creating directory $SAGE_BUILD_DIR."
     207    exit 1
     208fi
     209
     210cd "$SAGE_BUILD_DIR"
    206211
    207212if [ $DELETE_TMP -eq 1 ]; then
    208213    echo "Deleting directories from past builds of previous/current versions of $PKG_NAME"
    209     # Make triply sure that we are in the build directory before doing 
     214    # Make triply sure that we are in the build directory before doing
    210215    # a scary "rm -rf".
    211     cd "$SAGE_PACKAGES/build"
    212     if [ $? -ne 0 ]; then
    213         echo "Unable to find build directory."
     216    cd "$SAGE_BUILD_DIR"
     217    # The previous command should always succeed because we just
     218    # created this directory if it wasn't there already, but just in case...
     219    if [ $? -ne 0 ]; then
     220        echo >&2 "Unable to find build directory."
    214221    else
    215         rm -rf "$PKG_BASE-"* 
    216     fi 
     222        rm -rf "$PKG_BASE-"*
     223    fi
    217224else
    218     echo "Moving directories from past builds of previous/current versions of $PKG_NAME to build/old"
    219     mv -f "$PKG_BASE-"* old/  2>/dev/null
     225    for dir in "$PKG_BASE-"*
     226    do
     227        if [ -e "$dir" ]; then
     228            echo "Moving old directory $dir to $SAGE_BUILD_DIR/old..."
     229            mkdir -p old
     230            if [ $? -ne 0 ]; then
     231                echo >&2 "Error creating directory $SAGE_BUILD_DIR/old."
     232                exit 1
     233            fi
     234            rm -rf old/"$dir"
     235            mv -f "$dir" old/
     236        fi
     237    done
    220238fi
    221239
    222240if [ ! -f "$PKG_SRC" ]; then
    223 
    224241    echo "$0: file $PKG_NAME does not exist"
    225242    echo "Attempting to download it."
    226243    CUR=`pwd`
    227     cd "$SAGE_PACKAGES"
    228     if [ ! -d optional ]; then
    229         mkdir optional
    230     fi
    231     cd optional
     244    mkdir -p "$SAGE_PACKAGES/optional"
     245    cd "$SAGE_PACKAGES/optional"
    232246   
    233247    FOUND_VERSION=''
    234248    if [ -n "`no_version "$PKG_NAME"`" ]; then
    else 
    412426fi
    413427
    414428if [ $? -eq 0 ]; then
    415     cd $INSTALLED
     429    cd "$INSTALLED"
    416430    # TURNED OFF: Remove all old packages with the same name up to the first "-":
    417431    # rm -f $PKG_BASE-*
    418432
    if [ $? -eq 0 ]; then 
    426440    fi
    427441    echo "Successfully installed $PKG_NAME"
    428442
    429     cd $BASEDIR
     443    cd "$BASEDIR"
    430444    if [ "x$SAGE_CHECK" = "xyes" -a -f spkg-check ]; then
    431445        echo "Running the test suite."
    432446        chmod +x spkg-check
    if [ $? -eq 0 ]; then 
    444458    # Delete the temporary build directory if required.
    445459    if [ $DELETE_TMP -eq 1 ]; then
    446460        echo "Now cleaning up tmp files."
    447         if [ -d "$SAGE_PACKAGES/build/$PKG_NAME" ]; then
     461        if [ -d "$SAGE_BUILD_DIR/$PKG_NAME" ]; then
    448462            # the if is there only to avoid the possibility of a weird bug.
    449             cd "$SAGE_PACKAGES/build/"
    450             rm -rf "$SAGE_PACKAGES/build/$PKG_NAME"
     463            cd "$SAGE_BUILD_DIR/"
     464            rm -rf "$SAGE_BUILD_DIR/$PKG_NAME"
    451465        fi
    452466    else
    453467        echo "You can safely delete the temporary build directory"
    454         echo "$SAGE_PACKAGES/build/$PKG_NAME"
     468        echo "$SAGE_BUILD_DIR/$PKG_NAME"
    455469    fi
    456470
    457471else