Ticket #13395: 13395_upgrade.patch

File 13395_upgrade.patch, 9.1 KB (added by jdemeyer, 7 years ago)
  • spkg/bin/sage-env

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1345791974 -7200
    # Node ID 96723233c0ff5a0a9cca9b481a988acfb6985341
    # Parent  d166973b6f5e65f8d4096364a2f5da98e7d437df
    Fix upgrading with the GCC package
    
    diff --git a/spkg/bin/sage-env b/spkg/bin/sage-env
    a b  
    33###########################################################################
    44#
    55#  Set environment variables for building and/or running Sage.
    6 #  You must *source* this instead of executing; see below!
    76#
    8 #  IMPORTANT: use "return" instead of "exit" to signal a failure when
    9 #             sourcing this script.  An "exit" here will actually exit
    10 #             spkg/bin/sage, which is probably not intented.
    11 #
    12 #  AUTHORS:   William Stein                            2005-12
    13 #             David Kirkby <david.kirkby@onetel.net>   2005-12-17
    14 #
    15 ###########################################################################
    16 
    17 ##########################################################################
     7#  NOTES:
     8#  - You must *source* this script instead of executing.
     9#  - Use "return" instead of "exit" to signal a failure.  Since this
     10#    file is sourced, an "exit" here will actually exit spkg/bin/sage,
     11#    which is probably not intended.
     12#  - All environment variables set here should be *exported*, otherwise
     13#    they won't be available in child programs.
     14#  - This script has a version number such that a newer version of
     15#    sage-env can be sourced when upgrading.  See below.
    1816#
    1917#  If you want to set all environment variables for your shell like
    2018#  they are during the build of Sage packages, type
    2119#
    22 #             source spkg/bin/sage-env
     20#             . spkg/bin/sage-env
    2321#
    24 #  from the SAGE_ROOT directory.   To do the same from a /bin/bash
    25 #  script use ". spkg/bin/sage-env".
     22#  from the SAGE_ROOT directory.
     23#
     24#  AUTHORS: William Stein, David Kirkby, Jeroen Demeyer,
     25#           J. H. Palmieri, Leif Leonhardy and others.
    2626#
    2727##########################################################################
    2828
     
    146146    echo >&2 "New SAGE_ROOT=$NEW_SAGE_ROOT"
    147147fi
    148148
    149 # Don't execute the commands more than once.  Check this after
    150 # checking the validity of SAGE_ROOT, but before modifying its value.
     149# Don't execute the commands more than once for the same version of
     150# sage-env.  Check this after checking the validity of SAGE_ROOT, but
     151# before modifying its value.
    151152#
    152 # NOTE: This requires all environment variables to be exported, otherwise
    153 #       they won't be available / set in subshells which do not (fully)
    154 #       source sage-env themselves.
    155 if [ "x$SAGE_ENV_SOURCED" = "x" ]; then
    156     SAGE_ENV_SOURCED=1
    157     export SAGE_ENV_SOURCED
    158 else
     153# The idea of versioning is that SAGE_ENV_SOURCED will be set to a
     154# "version number" of sage-env.  If a different version of sage-env was
     155# sourced earlier (when upgrading), we still source the new version.
     156# The sage-env version should be increased whenever a newer sage-env is
     157# required for upgrading.  Note that spkg/standard/deps might also need
     158# to be changed: the packages which need the new sage-env must depend on
     159# SAGE_ROOT_REPO (the root repo contains sage-env).
     160#
     161# sage-env version history:
     162# - sage-4.7.1: version 1 (#10469)
     163# - sage-5.4:   version 2 (#13395)
     164#
     165SAGE_ENV_VERSION=2
     166if [ "$SAGE_ENV_SOURCED" = "$SAGE_ENV_VERSION" ]; then
    159167    # Already sourced, nothing to do.
    160168    return 0
    161169fi
     170export SAGE_ENV_SOURCED=$SAGE_ENV_VERSION
    162171
    163 SAGE_ROOT="$NEW_SAGE_ROOT"
    164 export SAGE_ROOT
     172export SAGE_ROOT="$NEW_SAGE_ROOT"
    165173
    166174
    167175# Call with: contains_spaces X${VAR}X
    168176# i.e., WITHOUT quotes but some character(s) around the environment variable to test.
    169177# (This function does return false for empty/unset variables.)
    170 
    171178contains_spaces()
    172179{
    173180    if [ $# -ne 1 ]; then
  • spkg/install

    diff --git a/spkg/install b/spkg/install
    a b  
    4040# If spkg/bin/sage-env doesn't exist, we are surely upgrading (sage-env
    4141# was moved to spkg/bin in sage-5.0).  Manually set SAGE_UPGRADING=yes,
    4242# as old versions of sage-upgrade didn't do this.
    43 # Also avoid RM being set to "rm":
    44 #   http://trac.sagemath.org/sage_trac/ticket/3537
    4543if [ ! -f "$SAGE_ROOT/spkg/bin/sage-env" ]; then
    4644    SAGE_UPGRADING=yes
     45fi
     46
     47if [ "$SAGE_UPGRADING" = yes ]; then
     48    # We're doing an upgrade. Let spkg/Makefile call sage-spkg with
     49    # "-f" to force rebuilding dependent packages, too:
     50    export SAGE_SPKG_OPTS="-f"
     51
     52    # Avoid RM being set to "rm" (older versions of Sage did this):
     53    #   http://trac.sagemath.org/sage_trac/ticket/3537
    4754    if [ "$RM" = rm ]; then
    4855        export RM="rm -f"
    4956    fi
    5057fi
    5158
    52 if [ "$SAGE_UPGRADING" = yes ]; then
    53     # We're doing an upgrade.
    54     # Let the Makefile (spkg/standard/deps) call sage-spkg with "-f"
    55     # to force rebuilding dependent packages, too:
    56     export SAGE_SPKG_OPTS="-f"
    57 fi
    58 
    5959###############################################################################
    6060# Create basic directories needed for Sage
    6161###############################################################################
     
    125125    fi
    126126fi
    127127
    128 # We obviously don't need to do anything if gcc is already installed
    129128if [ -f "$SAGE_LOCAL/bin/gcc" ]; then
    130     need_to_install_gcc=no
     129    # GCC is already installed. Normally we don't need to re-install
     130    # GCC, unless this is an upgrade. To disable unneeded rebuilding
     131    # of GCC, we touch the installed file for GCC, such that it will
     132    # really only be built if one of its dependencies has been upgraded.
     133    if [ "$SAGE_UPGRADING" = yes ]; then
     134        echo >&2 "We are upgrading Sage and GCC was installed before, it will get"
     135        echo >&2 "re-installed if needed."
     136        need_to_install_gcc=yes
     137        for f in "$SAGE_ROOT/spkg/installed"/gcc-*; do
     138            if [ -f "$f" ]; then
     139                touch "$f"
     140            fi
     141        done
     142    else
     143        need_to_install_gcc=no
     144    fi
    131145elif [ -n "$SAGE_INSTALL_GCC" ]; then
    132146    # Check the value of the environment variable SAGE_INSTALL_GCC
    133147    case "$SAGE_INSTALL_GCC" in
  • spkg/standard/deps

    diff --git a/spkg/standard/deps b/spkg/standard/deps
    a b  
    218218$(INST)/$(POLYTOPES_DB): $(BASE) $(INST)/$(PATCH)
    219219        +$(PIPE) "$(SAGE_SPKG) $(POLYTOPES_DB) 2>&1" "tee -a $(SAGE_LOGS)/$(POLYTOPES_DB).log"
    220220
    221 $(INST)/$(PPL): $(BASE) $(INST)/$(MPIR)
     221# PPL depends on SAGE_ROOT_REPO because it *executes* C++ code at
     222# build time.  Therefore, it needs an up-to-date version of sage-env
     223# which adds $SAGE_LOCAL/lib64 to the LD_LIBRARY_PATH.
     224$(INST)/$(PPL): $(BASE) $(INST)/$(MPIR) $(INST)/$(SAGE_ROOT_REPO)
    222225        +$(PIPE) "$(SAGE_SPKG) $(PPL) 2>&1" "tee -a $(SAGE_LOGS)/$(PPL).log"
    223226
    224227$(INST)/$(MPC): $(BASE) $(INST)/$(MPIR) $(INST)/$(MPFR) $(INST)/$(PATCH)
     
    321324$(INST)/$(JMOL): $(BASE) $(INST)/$(SAGENB) $(INST)/$(PATCH)
    322325        +$(PIPE) "$(SAGE_SPKG) $(JMOL) 2>&1" "tee -a $(SAGE_LOGS)/$(JMOL).log"
    323326
    324 ##  << NON-GUI matplotlib >>
    325327$(INST)/$(FREETYPE): $(BASE) $(INST)/$(PATCH)
    326328        +$(PIPE) "$(SAGE_SPKG) $(FREETYPE) 2>&1" "tee -a $(SAGE_LOGS)/$(FREETYPE).log"
    327329
     
    332334                       $(INST)/$(FREETYPE) $(INST)/$(LIBPNG) \
    333335                       $(INST)/$(GDMODULE) $(INST)/$(PATCH)
    334336        +$(PIPE) "$(SAGE_SPKG) $(MATPLOTLIB) 2>&1" "tee -a $(SAGE_LOGS)/$(MATPLOTLIB).log"
    335 ####
    336337
    337338$(INST)/$(CDDLIB): $(BASE) $(INST)/$(MPIR) $(INST)/$(PATCH)
    338339        +$(PIPE) "$(SAGE_SPKG) $(CDDLIB) 2>&1" "tee -a $(SAGE_LOGS)/$(CDDLIB).log"
    339340
    340 $(INST)/$(GFAN): $(BASE) $(INST)/$(MPIR) $(INST)/$(CDDLIB) $(INST)/$(PATCH)
     341# Gfan depends on SAGE_ROOT_REPO because it *executes* C++ code at
     342# build time.  Therefore, it needs an up-to-date version of sage-env
     343# which adds $SAGE_LOCAL/lib64 to the LD_LIBRARY_PATH.
     344$(INST)/$(GFAN): $(BASE) $(INST)/$(MPIR) $(INST)/$(CDDLIB) $(INST)/$(PATCH) \
     345                $(INST)/$(SAGE_ROOT_REPO)
    341346        +$(PIPE) "$(SAGE_SPKG) $(GFAN) 2>&1" "tee -a $(SAGE_LOGS)/$(GFAN).log"
    342347
    343348$(INST)/$(TACHYON): $(BASE) $(INST)/$(LIBPNG) $(INST)/$(PATCH)
     
    357362        +$(PIPE) "$(SAGE_SPKG) $(MAXIMA) 2>&1" "tee -a $(SAGE_LOGS)/$(MAXIMA).log"
    358363
    359364# Note that even with a separate RPy spkg (#9906), Sage's R will still depend on
    360 # Python (but does no longer on SAGE_SCRIPTS, #10016):
    361 $(INST)/$(R): $(BASE) $(INST)/$(PYTHON) $(INST)/$(ATLAS) $(INST)/$(ICONV) $(INST)/$(PATCH)
     365# Python.  R depends on SAGE_ROOT_REPO because it needs an up-to-date
     366# sage-env script which sets $OBJC on OS X.
     367$(INST)/$(R): $(BASE) $(INST)/$(PYTHON) $(INST)/$(ATLAS) $(INST)/$(ICONV) \
     368                $(INST)/$(PATCH) $(INST)/$(SAGE_ROOT_REPO)
    362369        +$(PIPE) "$(SAGE_SPKG) $(R) 2>&1" "tee -a $(SAGE_LOGS)/$(R).log"
    363370
    364371# Needed when #9906 gets merged (moving RPy out of R's spkg):
     
    507514$(INST)/$(PIL): $(BASE) $(INST)/$(PYTHON) $(INST)/$(PATCH)
    508515        +$(PIPE) "$(SAGE_SPKG) $(PIL) 2>&1" "tee -a $(SAGE_LOGS)/$(PIL).log"
    509516
    510 $(INST)/$(LAPACK): $(BASE) $(INST)/$(PATCH)
     517# Lapack depends on SAGE_ROOT_REPO because it *executes* Fortran code at
     518# build time.  Therefore, it needs an up-to-date version of sage-env
     519# which adds $SAGE_LOCAL/lib64 to the LD_LIBRARY_PATH.
     520$(INST)/$(LAPACK): $(BASE) $(INST)/$(PATCH) $(INST)/$(SAGE_ROOT_REPO)
    511521        +$(PIPE) "$(SAGE_SPKG) $(LAPACK) 2>&1" "tee -a $(SAGE_LOGS)/$(LAPACK).log"
    512522
    513523$(INST)/$(BLAS): $(BASE) $(INST)/$(PATCH)