[sagemath] 01/02: Install a custom sage-env (like sage-on-gentoo) instead of a patched one.

Tobias Hansen thansen at moszumanska.debian.org
Thu Dec 8 20:37:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository sagemath.

commit 2f9d61288e101c91e41c5dccc78ce8fbf9bd5d40
Author: Tobias Hansen <thansen at broeselmaschine.fc.up.pt>
Date:   Thu Dec 8 20:28:26 2016 +0000

    Install a custom sage-env (like sage-on-gentoo) instead of a patched one.
---
 debian/adhoc/sage-env                   | 82 +++++++++++++++++++++++++++++++++
 debian/patches/debian-sage-env.patch    | 57 ++---------------------
 debian/patches/debian-scripts-dir.patch | 10 ++--
 debian/rules                            |  3 +-
 4 files changed, 92 insertions(+), 60 deletions(-)

diff --git a/debian/adhoc/sage-env b/debian/adhoc/sage-env
new file mode 100644
index 0000000..502c954
--- /dev/null
+++ b/debian/adhoc/sage-env
@@ -0,0 +1,82 @@
+#!/bin/bash
+
+if [[ -z ${SAGE_ROOT} ]]; then
+	export SAGE_ROOT="/usr/share/sage"
+fi
+
+if [[ -z ${SAGE_LOCAL} ]]; then
+	export SAGE_LOCAL="/usr/"
+fi
+
+if [[ -z ${SAGE_DATA} ]]; then
+	export SAGE_DATA="/usr/share/sage"
+fi
+
+if [[ -z ${SAGE_SHARE} ]]; then
+	export SAGE_SHARE="/usr/share/sage"
+fi
+
+if [[ -z ${SAGE_DOC} ]]; then
+	export SAGE_DOC="/usr/share/doc/sage"
+fi
+
+if [[ -z ${SAGE_DOC_SRC} ]]; then
+ if [[ -n ${SAGE_SRC} ]]; then
+	 export SAGE_DOC_SRC="$SAGE_SRC/doc"
+ fi
+fi
+
+if [[ -z ${SAGE_EXTCODE} ]]; then
+	export SAGE_EXTCODE="/usr/share/sage/ext"
+fi
+
+if [[ -z ${SAGE_SPKG_INST} ]]; then
+ export SAGE_SPKG_INST="/usr/share/sage/installed"
+fi
+
+if [[ -z ${SAGE_SCRIPTS_DIR} ]]; then
+ export SAGE_SCRIPTS_DIR="/usr/share/sage/bin"
+fi
+
+if [[ -z ${DOT_SAGE} ]]; then
+	export DOT_SAGE="${HOME}/.sage"
+fi
+
+if [ "$SAGE_STARTUP_FILE" = "" ]; then
+	export SAGE_STARTUP_FILE="${DOT_SAGE}/init.sage"
+fi
+
+if [[ -z ${SAGE_TESTDIR} ]]; then
+	export SAGE_TESTDIR="${DOT_SAGE}/tmp"
+fi
+if [[ -z ${SAGE_SERVER} ]]; then
+	export SAGE_SERVER="http://www.sagemath.org/"
+fi
+
+if [ -z "$SAGE_RC_FILE" ]; then
+	SAGE_RC_FILE="$DOT_SAGE/sagerc"
+fi
+
+if [ -r "$SAGE_RC_FILE" ]; then
+	source "$SAGE_RC_FILE"
+	if [ $? -ne 0 ]; then
+		echo >&2 "Error sourcing $SAGE_RC_FILE"
+		exit 1
+	fi
+fi
+
+export EPYTHON=python2.7
+export MPMATH_NOGMPY=1
+export PATH="$PATH:$SAGE_SCRIPTS_DIR"
+GP_DATA_DIR="/usr/share/pari" && export GP_DATA_DIR
+GPHELP="/usr/bin/gphelp" && export GPHELP
+GPDOCDIR="/usr/share/pari/doc" && export GPDOCDIR
+SINGULARPATH="/usr/share/singular" && export SINGULARPATH
+SINGULAR_EXECUTABLE="/usr/bin/Singular" && export SINGULAR_EXECUTABLE
+
+# Display the Sage startup banner, used in src/bin/sage
+sage_banner() {
+    if [ "$SAGE_BANNER" != "no" ]; then
+        cat "$SAGE_SCRIPTS_DIR/sage-banner" 2>/dev/null
+    fi
+}
diff --git a/debian/patches/debian-sage-env.patch b/debian/patches/debian-sage-env.patch
index 34721c4..41eca5d 100644
--- a/debian/patches/debian-sage-env.patch
+++ b/debian/patches/debian-sage-env.patch
@@ -1,55 +1,6 @@
 --- a/sage/src/bin/sage-env
 +++ b/sage/src/bin/sage-env
-@@ -114,10 +114,10 @@
- # or a guessed value based on pwd.
- if [ -n "$SAGE_ROOT" ]; then
-     NEW_SAGE_ROOT="$SAGE_ROOT"
--elif [ -f sage -a -d build ]; then
--    NEW_SAGE_ROOT="."
--elif [ -f ../../sage -a -d ../../build ]; then
--    NEW_SAGE_ROOT="../.."
-+elif [ "$(which "$(basename "$0")")" = "$0" ]; then
-+    export SAGE_LOCAL="${SAGE_LOCAL:-$(dirname $(dirname "$0"))}"
-+    SAGE_ROOT="$SAGE_LOCAL"
-+    NEW_SAGE_ROOT="$SAGE_ROOT"
- else
-     # No idea what SAGE_ROOT should be...
-     echo >&2 "Error: You must set the SAGE_ROOT environment variable or run this"
-@@ -128,17 +128,6 @@
- # Make NEW_SAGE_ROOT absolute
- NEW_SAGE_ROOT=`cd "$NEW_SAGE_ROOT" && pwd -P`
- 
--# Sanity check NEW_SAGE_ROOT
--if [ -f "$NEW_SAGE_ROOT/sage" -a -d "$NEW_SAGE_ROOT/build" ]; then
--    :
--else
--    echo >&2 "Error: SAGE_ROOT is set to a bad value:"
--    echo >&2 "SAGE_ROOT=$SAGE_ROOT"
--    echo >&2 "You must correct it or erase it and run this script from the SAGE_ROOT"
--    echo >&2 "or SAGE_ROOT/local/bin/ directory."
--    return 1
--fi
--
- # Warn if NEW_SAGE_ROOT does not equal the old SAGE_ROOT
- if [ "$SAGE_ROOT" != "$NEW_SAGE_ROOT" -a -n "$SAGE_ROOT" ]; then
-     echo >&2 "Warning: overwriting SAGE_ROOT environment variable:"
-@@ -265,9 +254,13 @@
- export SAGE_ETC="$SAGE_LOCAL/etc"
- export SAGE_SHARE="$SAGE_LOCAL/share"
- export SAGE_EXTCODE="$SAGE_SHARE/sage/ext"
--export SAGE_SPKG_INST="$SAGE_ROOT/local/var/lib/sage/installed"
-+if [ -z "$SAGE_SPKG_INST" ]; then
-+    export SAGE_SPKG_INST="/usr/share/sage/installed"
-+fi
- export SAGE_LOGS="$SAGE_ROOT/logs/pkgs"
--export SAGE_SRC="$SAGE_ROOT/src"
-+if [ -z "$SAGE_SRC" ]; then
-+    export SAGE_SRC="$SAGE_ROOT/src"
-+fi
- export SAGE_DOC_SRC="$SAGE_SRC/doc"
- export SAGE_DOC="$SAGE_SHARE/doc/sage"
- 
-@@ -325,12 +318,12 @@
+@@ -325,12 +325,12 @@
  fi
  
  # For PARI/GP
@@ -67,7 +18,7 @@
  
  if [ -z "$SAGE_REPO_ANONYMOUS" ]; then
      SAGE_REPO_ANONYMOUS="git://trac.sagemath.org/sage.git"
-@@ -420,8 +413,10 @@
+@@ -420,8 +420,10 @@
      export PYTHONHOME
  fi
  
@@ -79,7 +30,7 @@
  
  # Use a matplotlib config directory specific to Sage and specific to
  # the version number of matplotlib, by setting the environment
-@@ -468,7 +463,6 @@
+@@ -468,7 +470,6 @@
  	fi
      fi
  fi
@@ -87,7 +38,7 @@
  
  PERL5LIB="$SAGE_LOCAL/lib/perl5:$PERL5LIB" && export PERL5LIB
  
-@@ -642,9 +636,6 @@
+@@ -642,9 +643,6 @@
      LD_LIBRARY_PATH="$SAGE_LOCAL/bin:$LD_LIBRARY_PATH" && export LD_LIBRARY_PATH
  fi
  
diff --git a/debian/patches/debian-scripts-dir.patch b/debian/patches/debian-scripts-dir.patch
index bfcea06..bb5769b 100644
--- a/debian/patches/debian-scripts-dir.patch
+++ b/debian/patches/debian-scripts-dir.patch
@@ -19,7 +19,7 @@ Author: Tobias Hansen <thansen at debian.org>
  if [ $? -ne 0 ]; then
      echo >&2 "Error setting environment variables by sourcing '$0-env';"
      echo >&2 "possibly contact sage-devel (see http://groups.google.com/group/sage-devel)."
-@@ -425,13 +430,13 @@
+@@ -413,13 +418,13 @@
  #####################################################################
  
  if [ "$1" = '-dumpversion' -o "$1" = '--dumpversion' ]; then
@@ -35,7 +35,7 @@ Author: Tobias Hansen <thansen at debian.org>
  	echo "SageMath version ${SAGE_VERSION}, Release Date: ${SAGE_RELEASE_DATE}"
  	exit 0
  fi
-@@ -936,12 +941,12 @@
+@@ -924,12 +929,12 @@
      shift
      sage_setup
      if [ "$SAGE_DEBUG" = "no" ]; then
@@ -54,7 +54,7 @@ Author: Tobias Hansen <thansen at debian.org>
  fi
 --- a/sage/src/bin/sage-env
 +++ b/sage/src/bin/sage-env
-@@ -142,7 +142,7 @@
+@@ -153,7 +153,7 @@
      elif [ "$SAGE_BANNER" != "no" ]; then
          # This file sage-banner is not yet available during the build
          # of Sage, so we ignore errors from cat.
@@ -63,7 +63,7 @@ Author: Tobias Hansen <thansen at debian.org>
      fi
  }
  
-@@ -187,6 +187,8 @@
+@@ -198,6 +198,8 @@
          SAGE_SCRIPTS_DIR="$SAGE_LOCAL/bin"
      elif [ -f "$SAGE_ROOT/src/bin/sage-env" ]; then
          SAGE_SCRIPTS_DIR="$SAGE_ROOT/src/bin"
@@ -72,7 +72,7 @@ Author: Tobias Hansen <thansen at debian.org>
      else
          echo >&2 "Error: You must set the SAGE_SCRIPTS_DIR environment variable to run this"
          return 1
-@@ -268,7 +270,7 @@
+@@ -275,7 +277,7 @@
      SAGE_ORIG_PATH=$PATH && export SAGE_ORIG_PATH 
      SAGE_ORIG_PATH_SET=True && export SAGE_ORIG_PATH_SET 
  fi 
diff --git a/debian/rules b/debian/rules
index b74ef1b..1e5acea 100755
--- a/debian/rules
+++ b/debian/rules
@@ -13,8 +13,6 @@ export CCACHE_BASEDIR := $(CURDIR)/debian/build
 $(shell mkdir -p "$(CCACHE_DIR)")
 endif
 
-export SAGE_ROOT = $(shell pwd)/sage
-export SAGE_SPKG_INST = $(shell pwd)/sage/local/var/lib/sage/installed
 export SAGE_LOCAL = $(shell pwd)/debian/build/usr
 export PYTHONPATH = $(shell pwd)/debian/build/usr/lib/python2.7/dist-packages
 
@@ -68,6 +66,7 @@ override_dh_auto_install:
 # we don't distribute them.
 	find debian/build '(' -name '*.pyc' -o -name '*.pyo' ')' -delete
 	rm -f debian/build/usr/bin/*.bat
+	cp -f debian/adhoc/sage-env debian/build/usr/bin/
 	mkdir -p debian/tmp
 	mv debian/build/* debian/tmp
 # Don't try to rmdir debian/build if it's a mountpoint, useful for doing builds in /run/shm

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagemath.git



More information about the debian-science-commits mailing list