[sagemath] 01/03: Install everything to debian/tmp instead of $HOME
Ximin Luo
infinity0 at debian.org
Sat Oct 15 00:56:49 UTC 2016
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository sagemath.
commit 19560538e1f2bd48a1e85e2ec4c93eaccf294c5d
Author: Ximin Luo <infinity0 at debian.org>
Date: Sat Oct 15 02:18:10 2016 +0200
Install everything to debian/tmp instead of $HOME
---
debian/README.Debian | 35 ++---
debian/patches/debian-install-paths.patch | 144 +++++++++++++++++++++
debian/patches/debian-libgap-sage.patch | 6 +-
debian/patches/debian-paths.patch | 113 +++-------------
debian/patches/debian-sage-env.patch | 11 --
debian/patches/debian-temp-userdir.patch | 139 +++-----------------
.../fixsage-allow-override-sage-local.patch | 86 ++++++++++++
debian/patches/series | 6 +-
debian/rules | 9 +-
9 files changed, 294 insertions(+), 255 deletions(-)
diff --git a/debian/README.Debian b/debian/README.Debian
index 6e72d63..ba359be 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -17,9 +17,8 @@ This uses debian/ccache as a ccache cache, so rebuilds are much quicker.
Then the build (including documentation) should work, but some tests will fail.
This is probably due to a combination of:
-a) the fact we're currently installing to $HOME rather than /usr.
-b) mismatched versions of dependencies; we'll need to upload these.
-c) our hacky patches; we will need to revise these.
+a) mismatched versions of dependencies; we'll need to upload these.
+b) our hacky patches; we will need to revise these.
## TODO (required to get into Debian archives)
@@ -31,9 +30,13 @@ The tests write logging output to sage/logs/ptestlong.log or some other file if
you ran a different test. If you let the test run to completion, near the end
of the logging output, there will be a summary of all the failures.
-You can run individual tests like this (from the sage subdirectory):
-
- $ ./sage -t --long src/sage/geometry/riemannian_manifolds/parametrized_surface3d.py
+After a successful build, you can run individual tests as follows. First, make
+sure you're in the top-level package directory, where debian/ is. Then:
+
+ $ export SAGE_LOCAL=$PWD/debian/tmp/usr
+ $ export PYTHONPATH=$SAGE_LOCAL/lib/python2.7/dist-packages
+ $ cd sage
+ sage$ ./sage -t --long src/sage/geometry/riemannian_manifolds/parametrized_surface3d.py
See https://www.sagemath.org/git-developer-guide/doctesting.html for more
information and helpful tips.
@@ -55,17 +58,19 @@ this assumes that you didn't break any of the previously successful ones :p
You should get something roughly like the following. If you get different
results, please add your experience to the below summary.
-First, remove ".frontend" from /usr/bin/ipython, this will fix 1 test. This is
-already fixed in ipython (Debian) git, we're just waiting for an upload.
+First, patch your local system:
-Next, in /usr/lib/python2.7/dist-packages/sympy/core/function.py, find "class
-AppliedUndef" and remove the whole of "def _sage_" from it, this will fix
-another 2 tests. This is also already fixed in sympy (Debian) git, we're just
-waiting for an upload.
+# fix 1 test
+sudo sed -e 's/\.frontend//g' -i /usr/bin/ipython
+# fix 2 tests
+sudo sed -e '/^class AppliedUndef/,${/def _sage_/,/^\s*$/d}' \
+ -i /usr/lib/python2.7/dist-packages/sympy/core/function.py
+# fix 3 tests
+zcat /usr/share/doc/singular-doc/singular.hlp.gz \
+ | sudo tee /usr/share/doc/singular-doc/singular.hlp >/dev/null
-Next, run `zcat /usr/share/doc/singular-doc/singular.hlp.gz | sudo tee /usr/share/doc/singular-doc/singular.hlp >/dev/null`
-which will fix another 3 tests. This is also already fixed in singular (Debian)
-git, we're just waiting for an upload.
+These are already fixed in Debian's git repos for (respectively) ipython,
+sympy, singular; we're just waiting for an upload.
You can see infinity0's test failures here: https://people.debian.org/~infinity0/res/
Look for files named "sagemath-*_*.log"
diff --git a/debian/patches/debian-install-paths.patch b/debian/patches/debian-install-paths.patch
new file mode 100644
index 0000000..a7f97f4
--- /dev/null
+++ b/debian/patches/debian-install-paths.patch
@@ -0,0 +1,144 @@
+Description: Install to Debian paths
+Author: Tobias Hansen <thansen at debian.org>
+Author: Ximin Luo <infinity0 at debian.org>
+Forwarded: not-needed
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/sage/src/Makefile
++++ b/sage/src/Makefile
+@@ -3,7 +3,7 @@
+ all: sage
+
+ sage: sage/libs/pari/auto_gen.pxi sage/ext/interpreters/__init__.py
+- python -u setup.py install
++ python -u setup.py install --root ../../debian/tmp --install-layout deb -O2
+
+ clean:
+ @echo "Deleting Sage library build artifacts..."
+--- a/sage/src/setup.py
++++ b/sage/src/setup.py
+@@ -155,9 +155,9 @@
+ # (that are likely to change on an upgrade) here:
+ # [At least at the moment. Make sure the headers aren't copied with "-p",
+ # or explicitly touch them in the respective spkg's spkg-install.]
+-lib_headers = { "gmp": [ os.path.join(SAGE_INC, 'gmp.h') ], # cf. #8664, #9896
+- "gmpxx": [ os.path.join(SAGE_INC, 'gmpxx.h') ],
+- "ntl": [ os.path.join(SAGE_INC, 'NTL', 'config.h') ]
++lib_headers = { "gmp": [ os.path.join('/usr/include', 'gmp.h') ], # cf. #8664, #9896
++ "gmpxx": [ os.path.join('/usr/include' 'gmpxx.h') ],
++ "ntl": [ os.path.join('/usr/include', 'NTL', 'config.h') ]
+ }
+
+ import pkgconfig
+@@ -183,7 +183,7 @@
+
+ m.extra_compile_args = m.extra_compile_args + extra_compile_args
+ m.extra_link_args = m.extra_link_args + extra_link_args
+- m.library_dirs = m.library_dirs + libgap_library_dirs + [os.path.join(SAGE_LOCAL, "lib")]
++ m.library_dirs = m.library_dirs + libgap_library_dirs + [os.path.join(SAGE_LOCAL, "lib"), '/usr/lib']
+ m.include_dirs = m.include_dirs + libgap_include_dirs + include_dirs
+
+
+@@ -649,6 +649,8 @@
+ def run(self):
+ install.run(self)
+ self.install_kernel_spec()
++ subprocess.check_call(['sh', '-c',
++ 'mkdir -p %s; for i in /usr/share/sagemath/*; do ln -Tsf "$i" %s/"$(basename $i)"; done' % (SAGE_SHARE,SAGE_SHARE)])
+
+ def install_kernel_spec(self):
+ from sage.repl.ipython_kernel.install import SageKernelSpec
+--- a/sage/sage
++++ b/sage/sage
+@@ -22,6 +22,7 @@
+ # automatically.
+ #SAGE_ROOT=/path/to/sage-version
+
++if test -n "$SAGE_LOCAL"; then export PATH="$SAGE_LOCAL/bin:$PATH"; fi
+
+
+ # Resolve all symbolic links in a filename. This more or less behaves
+--- a/sage/src/sage/env.py
++++ b/sage/src/sage/env.py
+@@ -102,9 +102,9 @@
+ except AttributeError: # in case of use inside virtualenv
+ sitepackages_dirs = [os.path.join(os.path.dirname(site.__file__),
+ 'site-packages')]
+-_add_variable_or_fallback('SITE_PACKAGES', sitepackages_dirs)
++_add_variable_or_fallback('SITE_PACKAGES', [d for d in sitepackages_dirs if "local" not in d])
+
+-_add_variable_or_fallback('SAGE_LIB', SITE_PACKAGES[0])
++_add_variable_or_fallback('SAGE_LIB', opj('$SAGE_LOCAL', SITE_PACKAGES[0]))
+
+ _add_variable_or_fallback('SAGE_CYTHONIZED', opj('$SAGE_SRC', 'build', 'cythonized'))
+
+--- a/sage/configure.ac
++++ b/sage/configure.ac
+@@ -1006,8 +1006,7 @@
+ AC_MSG_ERROR([[Cannot perform incremental update, run "make distclean && make"]])
+ fi
+ else
+- AC_MSG_NOTICE([[creating symbolic link lib64 -> lib]])
+- ln -s lib "$SAGE_LOCAL/lib64"
++ true
+ fi
+ ])
+
+--- a/sage/src/module_list.py
++++ b/sage/src/module_list.py
+@@ -3,7 +3,7 @@
+ from distutils.extension import Extension
+ from sage.env import SAGE_LOCAL
+
+-SAGE_INC = os.path.join(SAGE_LOCAL, 'include')
++SAGE_INC = '/usr/include'
+
+ #########################################################
+ ### pkg-config setup
+--- a/sage/src/sage/doctest/control.py
++++ b/sage/src/sage/doctest/control.py
+@@ -174,6 +174,8 @@
+ True
+ """
+ base, ext = os.path.splitext(filename)
++ if filename.find('sagedev') != -1 or filename.find('sage/dev') != -1:
++ return True
+ if ext not in ('.py', '.pyx', '.pxd', '.pxi', '.sage', '.spyx', '.rst', '.tex'):
+ return True
+ with open(filename) as F:
+--- a/sage/src/sage/repl/ipython_kernel/install.py
++++ b/sage/src/sage/repl/ipython_kernel/install.py
+@@ -10,11 +10,11 @@
+ import errno
+
+ from sage.env import (
+- SAGE_ROOT, SAGE_DOC, SAGE_LOCAL, SAGE_EXTCODE,
++ SAGE_ROOT, SAGE_DOC, SAGE_LOCAL, SAGE_EXTCODE, SAGE_SHARE,
+ SAGE_VERSION
+ )
+ from jupyter_core.paths import ENV_JUPYTER_PATH
+-JUPYTER_PATH = ENV_JUPYTER_PATH[0]
++JUPYTER_PATH = os.path.join(SAGE_SHARE, "..", "jupyter")
+
+
+ class SageKernelSpec(object):
+@@ -109,7 +109,7 @@
+ sage: os.path.isdir(mathjax)
+ True
+ """
+- src = os.path.join(SAGE_LOCAL, 'share', 'mathjax')
++ src = "/usr/share/javascript/mathjax"
+ dst = os.path.join(self.nbextensions_dir, 'mathjax')
+ self.symlink(src, dst)
+
+--- a/sage/src/bin/sage
++++ b/sage/src/bin/sage
+@@ -353,7 +353,7 @@
+ # Prepare for running Sage, either interactively or non-interactively.
+ sage_setup() {
+ # Check that we're not in a source tarball which hasn't been built yet (#13561).
+- if [ ! -d "$SAGE_LOCAL/lib/python/site-packages/sage" ]; then
++ if [ ! -d "$SAGE_LOCAL/lib/python2.7/dist-packages/sage" ]; then
+ echo >&2 '************************************************************************'
+ echo >&2 'It seems that you are attempting to run Sage from an unpacked source'
+ echo >&2 'tarball, but you have not compiled it yet (or maybe the build has not'
diff --git a/debian/patches/debian-libgap-sage.patch b/debian/patches/debian-libgap-sage.patch
index 017248b..efcd34d 100644
--- a/debian/patches/debian-libgap-sage.patch
+++ b/debian/patches/debian-libgap-sage.patch
@@ -78,7 +78,7 @@ Forwarded: not-needed
--- a/sage/src/setup.py
+++ b/sage/src/setup.py
@@ -160,6 +160,12 @@
- "ntl": [ os.path.join('/usr/include', 'NTL', 'config.h') ]
+ "ntl": [ os.path.join(SAGE_INC, 'NTL', 'config.h') ]
}
+import pkgconfig
@@ -94,9 +94,9 @@ Forwarded: not-needed
m.extra_compile_args = m.extra_compile_args + extra_compile_args
m.extra_link_args = m.extra_link_args + extra_link_args
-- m.library_dirs = m.library_dirs + [os.path.join(SAGE_LOCAL, "lib"), '/usr/lib']
+- m.library_dirs = m.library_dirs + [os.path.join(SAGE_LOCAL, "lib")]
- m.include_dirs = m.include_dirs + include_dirs
-+ m.library_dirs = m.library_dirs + libgap_library_dirs + [os.path.join(SAGE_LOCAL, "lib"), '/usr/lib']
++ m.library_dirs = m.library_dirs + libgap_library_dirs + [os.path.join(SAGE_LOCAL, "lib")]
+ m.include_dirs = m.include_dirs + libgap_include_dirs + include_dirs
diff --git a/debian/patches/debian-paths.patch b/debian/patches/debian-paths.patch
index 2596033..ae69f89 100644
--- a/debian/patches/debian-paths.patch
+++ b/debian/patches/debian-paths.patch
@@ -1,67 +1,9 @@
---- a/sage/src/bin/sage
-+++ b/sage/src/bin/sage
-@@ -353,16 +353,16 @@
- # Prepare for running Sage, either interactively or non-interactively.
- sage_setup() {
- # Check that we're not in a source tarball which hasn't been built yet (#13561).
-- if [ ! -d "$SAGE_LOCAL/lib/python/site-packages/sage" ]; then
-- echo >&2 '************************************************************************'
-- echo >&2 'It seems that you are attempting to run Sage from an unpacked source'
-- echo >&2 'tarball, but you have not compiled it yet (or maybe the build has not'
-- echo >&2 'finished). You should run `make` in the Sage root directory first.'
-- echo >&2 'If you did not intend to build Sage from source, you should download'
-- echo >&2 'a binary tarball instead. Read README.txt for more information.'
-- echo >&2 '************************************************************************'
-- exit 1
-- fi
-+ # if [ ! -d "$SAGE_LOCAL/lib/python/site-packages/sage" ]; then
-+ # echo >&2 '************************************************************************'
-+ # echo >&2 'It seems that you are attempting to run Sage from an unpacked source'
-+ # echo >&2 'tarball, but you have not compiled it yet (or maybe the build has not'
-+ # echo >&2 'finished). You should run `make` in the Sage root directory first.'
-+ # echo >&2 'If you did not intend to build Sage from source, you should download'
-+ # echo >&2 'a binary tarball instead. Read README.txt for more information.'
-+ # echo >&2 '************************************************************************'
-+ # exit 1
-+ # fi
-
- # Display the startup banner (unless SAGE_BANNER is explictly "no")
- if [ "$SAGE_BANNER" != "no" ]; then
---- a/sage/src/module_list.py
-+++ b/sage/src/module_list.py
-@@ -3,7 +3,7 @@
- from distutils.extension import Extension
- from sage.env import SAGE_LOCAL
-
--SAGE_INC = os.path.join(SAGE_LOCAL, 'include')
-+SAGE_INC = '/usr/include'
-
- #########################################################
- ### pkg-config setup
---- a/sage/src/sage/doctest/control.py
-+++ b/sage/src/sage/doctest/control.py
-@@ -174,6 +174,8 @@
- True
- """
- base, ext = os.path.splitext(filename)
-+ if filename.find('sagedev') != -1 or filename.find('sage/dev') != -1:
-+ return True
- if ext not in ('.py', '.pyx', '.pxd', '.pxi', '.sage', '.spyx', '.rst', '.tex'):
- return True
- with open(filename) as F:
---- a/sage/src/sage/env.py
-+++ b/sage/src/sage/env.py
-@@ -92,8 +92,8 @@
- _add_variable_or_fallback('SAGE_ROOT', None)
- _add_variable_or_fallback('SAGE_LOCAL', opj('$SAGE_ROOT', 'local'))
- _add_variable_or_fallback('SAGE_ETC', opj('$SAGE_LOCAL', 'etc'))
--_add_variable_or_fallback('SAGE_INC', opj('$SAGE_LOCAL', 'include'))
--_add_variable_or_fallback('SAGE_SHARE', opj('$SAGE_LOCAL', 'share'))
-+_add_variable_or_fallback('SAGE_INC', opj('/usr/include'))
-+_add_variable_or_fallback('SAGE_SHARE', opj('/usr/share/sagemath'))
-
- _add_variable_or_fallback('SAGE_SRC', opj('$SAGE_ROOT', 'src'))
-
+Description: Find system run-time dependencies
+Author: Tobias Hansen <thansen at debian.org>
+Author: Ximin Luo <infinity0 at debian.org>
+Forwarded: not-needed
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/sage/src/sage/ext/pselect.pyx
+++ b/sage/src/sage/ext/pselect.pyx
@@ -290,7 +290,7 @@
@@ -121,30 +63,20 @@
Test GP using the ``-f`` option which prevents the reading of a ``.gprc``
configuration file::
---- a/sage/src/setup.py
-+++ b/sage/src/setup.py
-@@ -155,9 +155,9 @@
- # (that are likely to change on an upgrade) here:
- # [At least at the moment. Make sure the headers aren't copied with "-p",
- # or explicitly touch them in the respective spkg's spkg-install.]
--lib_headers = { "gmp": [ os.path.join(SAGE_INC, 'gmp.h') ], # cf. #8664, #9896
-- "gmpxx": [ os.path.join(SAGE_INC, 'gmpxx.h') ],
-- "ntl": [ os.path.join(SAGE_INC, 'NTL', 'config.h') ]
-+lib_headers = { "gmp": [ os.path.join('/usr/include', 'gmp.h') ], # cf. #8664, #9896
-+ "gmpxx": [ os.path.join('/usr/include' 'gmpxx.h') ],
-+ "ntl": [ os.path.join('/usr/include', 'NTL', 'config.h') ]
- }
-
- # In the loop below, don't append to any list, since many of these
-@@ -177,7 +177,7 @@
+--- a/sage/src/sage/interfaces/qepcad.py
++++ b/sage/src/sage/interfaces/qepcad.py
+@@ -528,11 +528,6 @@
- m.extra_compile_args = m.extra_compile_args + extra_compile_args
- m.extra_link_args = m.extra_link_args + extra_link_args
-- m.library_dirs = m.library_dirs + [os.path.join(SAGE_LOCAL, "lib")]
-+ m.library_dirs = m.library_dirs + [os.path.join(SAGE_LOCAL, "lib"), '/usr/lib']
- m.include_dirs = m.include_dirs + include_dirs
+ TESTS:
+-Check the qepcad configuration file::
+-
+- sage: open('%s/default.qepcadrc'%SAGE_LOCAL).readlines()[-1]
+- 'SINGULAR .../bin\n'
+-
+ Tests related to the not tested examples (nondeterministic order of atoms)::
+ sage: from sage.interfaces.qepcad import _qepcad_atoms
--- a/sage/src/sage/libs/lcalc/lcalc_sage.h
+++ b/sage/src/sage/libs/lcalc/lcalc_sage.h
@@ -1,4 +1,4 @@
@@ -183,14 +115,3 @@
Check that the Sage Notebook is not imported at startup (see
:trac:`15335`)::
---- a/sage/src/sage/repl/ipython_kernel/install.py
-+++ b/sage/src/sage/repl/ipython_kernel/install.py
-@@ -109,7 +109,7 @@
- sage: os.path.isdir(mathjax)
- True
- """
-- src = os.path.join(SAGE_LOCAL, 'share', 'mathjax')
-+ src = "/usr/share/javascript/mathjax"
- dst = os.path.join(self.nbextensions_dir, 'mathjax')
- self.symlink(src, dst)
-
diff --git a/debian/patches/debian-sage-env.patch b/debian/patches/debian-sage-env.patch
index bfd0828..29213ce 100644
--- a/debian/patches/debian-sage-env.patch
+++ b/debian/patches/debian-sage-env.patch
@@ -1,16 +1,5 @@
--- a/sage/src/bin/sage-env
+++ b/sage/src/bin/sage-env
-@@ -247,8 +247,8 @@
- # Setting Sage-related location environment variables.
- export SAGE_LOCAL="$SAGE_ROOT/local"
- export SAGE_ETC="$SAGE_LOCAL/etc"
--export SAGE_SHARE="$SAGE_LOCAL/share"
--export SAGE_EXTCODE="$SAGE_SHARE/sage/ext"
-+export SAGE_SHARE="/usr/share/sagemath"
-+export SAGE_EXTCODE="$SAGE_LOCAL/share/sage/ext"
- export SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed"
- export SAGE_LOGS="$SAGE_ROOT/logs/pkgs"
- export SAGE_SRC="$SAGE_ROOT/src"
@@ -315,12 +315,12 @@
fi
diff --git a/debian/patches/debian-temp-userdir.patch b/debian/patches/debian-temp-userdir.patch
index 33565ef..97cb0f2 100644
--- a/debian/patches/debian-temp-userdir.patch
+++ b/debian/patches/debian-temp-userdir.patch
@@ -1,109 +1,9 @@
Description: Install Sage spkgs to user's home directory
This is a temporary measure to get everything working quickly.
- Eventually we will get rid of this, and install to debian/tmp via --prefix or --root.
+ Eventually we will get rid of this, and add them to the pruner.
Forwarded: not-needed
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/sage/src/Makefile
-+++ b/sage/src/Makefile
-@@ -3,7 +3,7 @@
- all: sage
-
- sage: sage/libs/pari/auto_gen.pxi sage/ext/interpreters/__init__.py
-- python -u setup.py install
-+ python -u setup.py install --user
-
- clean:
- @echo "Deleting Sage library build artifacts..."
---- a/sage/build/pkgs/ipywidgets/spkg-install
-+++ b/sage/build/pkgs/ipywidgets/spkg-install
-@@ -1,3 +1,3 @@
- #!/usr/bin/env bash
-
--cd src && python setup.py install
-+cd src && python setup.py install --user
---- a/sage/build/pkgs/notebook/spkg-install
-+++ b/sage/build/pkgs/notebook/spkg-install
-@@ -12,7 +12,7 @@
- done
-
-
--python setup.py install
-+python setup.py install --user
-
- # Install the Jupyter notebook configuration
- ETC_JUPYTER="$SAGE_ETC"/jupyter
---- a/sage/src/setup.py
-+++ b/sage/src/setup.py
-@@ -46,6 +46,7 @@
-
- from module_list import ext_modules, library_order, aliases
- from sage.env import *
-+SAGE_USER_LIB = os.path.expanduser("~/.sage/local/lib/python2.7/site-packages")
-
- #########################################################
- ### Configuration
-@@ -615,7 +616,7 @@
- python_packages, python_modules = find_python_sources(
- SAGE_SRC, ['sage', 'sage_setup'])
- python_data_files = find_extra_files(python_packages,
-- ".", SAGE_CYTHONIZED, SAGE_LIB, ["ntlwrap.cpp"])
-+ ".", SAGE_CYTHONIZED, SAGE_USER_LIB, ["ntlwrap.cpp"])
-
- print('python_packages = {0}'.format(python_packages))
- print('python_modules = {0}'.format(python_modules))
-@@ -649,6 +650,8 @@
- def run(self):
- install.run(self)
- self.install_kernel_spec()
-+ subprocess.check_call(['sh', '-c',
-+ 'mkdir -p %s; for i in /usr/share/sagemath/*; do ln -Tsf "$i" %s/"$(basename $i)"; done' % (SAGE_SHARE,SAGE_SHARE)])
-
- def install_kernel_spec(self):
- from sage.repl.ipython_kernel.install import SageKernelSpec
---- a/sage/src/sage/repl/ipython_kernel/install.py
-+++ b/sage/src/sage/repl/ipython_kernel/install.py
-@@ -14,7 +14,7 @@
- SAGE_VERSION
- )
- from jupyter_core.paths import ENV_JUPYTER_PATH
--JUPYTER_PATH = ENV_JUPYTER_PATH[0]
-+JUPYTER_PATH = os.path.expanduser("~/.local/share/jupyter")
-
-
- class SageKernelSpec(object):
---- a/sage/sage
-+++ b/sage/sage
-@@ -22,6 +22,7 @@
- # automatically.
- #SAGE_ROOT=/path/to/sage-version
-
-+export PATH="$PATH:$HOME/.sage/local/bin"
-
-
- # Resolve all symbolic links in a filename. This more or less behaves
---- a/sage/src/bin/sage-env
-+++ b/sage/src/bin/sage-env
-@@ -247,7 +247,7 @@
- # Setting Sage-related location environment variables.
- export SAGE_LOCAL="$SAGE_ROOT/local"
- export SAGE_ETC="$SAGE_LOCAL/etc"
--export SAGE_SHARE="/usr/share/sagemath"
-+export SAGE_SHARE="$HOME/.local/share/sagemath"
- export SAGE_EXTCODE="$SAGE_LOCAL/share/sage/ext"
- export SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed"
- export SAGE_LOGS="$SAGE_ROOT/logs/pkgs"
---- a/sage/src/bin/sage-starts
-+++ b/sage/src/bin/sage-starts
-@@ -14,7 +14,7 @@
- # sysadmin. We use --nodotsage so we don't force a .sage directory
- # in the sysadmin's HOME directory.
- cmd='sage.all._write_started_file(); print "Yes, Sage starts."'
--build/bin/sage-logger "./sage --nodotsage -c '$cmd'" logs/start.log
-+build/bin/sage-logger "./sage -c '$cmd'" logs/start.log
-
- if [ $? -ne 0 ]; then
- echo >&2 "Sage failed to start up."
--- a/sage/build/pkgs/sagenb_export/spkg-install
+++ b/sage/build/pkgs/sagenb_export/spkg-install
@@ -1,7 +1,7 @@
@@ -122,30 +22,21 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
-cd src && python setup.py install
+cd src && python setup.py install --user
---- a/sage/src/sage_setup/find.py
-+++ b/sage/src/sage_setup/find.py
-@@ -150,8 +150,8 @@
-
- EXAMPLES::
+--- a/sage/build/pkgs/ipywidgets/spkg-install
++++ b/sage/build/pkgs/ipywidgets/spkg-install
+@@ -1,3 +1,3 @@
+ #!/usr/bin/env bash
-- sage: from site import getsitepackages
-- sage: site_packages = getsitepackages()[0]
-+ sage: from site import getusersitepackages
-+ sage: site_packages = getusersitepackages()
- sage: files_by_module = installed_files_by_module(site_packages)
- sage: from sage.misc.sageinspect import loadable_module_extension
- sage: 'sage/structure/sage_object' + loadable_module_extension() in \
---- a/sage/src/sage/interfaces/qepcad.py
-+++ b/sage/src/sage/interfaces/qepcad.py
-@@ -528,11 +528,6 @@
+-cd src && python setup.py install
++cd src && python setup.py install --user
+--- a/sage/build/pkgs/notebook/spkg-install
++++ b/sage/build/pkgs/notebook/spkg-install
+@@ -12,7 +12,7 @@
+ done
- TESTS:
--Check the qepcad configuration file::
--
-- sage: open('%s/default.qepcadrc'%SAGE_LOCAL).readlines()[-1]
-- 'SINGULAR .../bin\n'
--
- Tests related to the not tested examples (nondeterministic order of atoms)::
+-python setup.py install
++python setup.py install --user
- sage: from sage.interfaces.qepcad import _qepcad_atoms
+ # Install the Jupyter notebook configuration
+ ETC_JUPYTER="$SAGE_ETC"/jupyter
diff --git a/debian/patches/fixsage-allow-override-sage-local.patch b/debian/patches/fixsage-allow-override-sage-local.patch
new file mode 100644
index 0000000..dc22f24
--- /dev/null
+++ b/debian/patches/fixsage-allow-override-sage-local.patch
@@ -0,0 +1,86 @@
+Description: Allow SAGE_LOCAL to be overridden from outside the Makefiles
+ This makes it easier for package managers to create binary distributions.
+ However, keep SAGE_SPKG_INST relative to SAGE_ROOT rather than SAGE_LOCAL
+ since that would be a more intrusive change.
+Author: Ximin Luo <infinity0 at debian.org>
+Forwarded: TBD
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/sage/src/bin/sage-env
++++ b/sage/src/bin/sage-env
+@@ -245,11 +245,11 @@
+ fi
+
+ # Setting Sage-related location environment variables.
+-export SAGE_LOCAL="$SAGE_ROOT/local"
++export SAGE_LOCAL="${SAGE_LOCAL:-$SAGE_ROOT/local}"
+ export SAGE_ETC="$SAGE_LOCAL/etc"
+ export SAGE_SHARE="$SAGE_LOCAL/share"
+ export SAGE_EXTCODE="$SAGE_SHARE/sage/ext"
+-export SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed"
++export SAGE_SPKG_INST="$SAGE_ROOT/local/var/lib/sage/installed"
+ export SAGE_LOGS="$SAGE_ROOT/logs/pkgs"
+ export SAGE_SRC="$SAGE_ROOT/src"
+ export SAGE_DOC_SRC="$SAGE_SRC/doc"
+--- a/sage/src/sage/env.py
++++ b/sage/src/sage/env.py
+@@ -110,7 +110,7 @@
+
+ _add_variable_or_fallback('SAGE_EXTCODE', opj('$SAGE_SHARE', 'sage', 'ext'))
+ _add_variable_or_fallback('SAGE_LOGS', opj('$SAGE_ROOT', 'logs', 'pkgs'))
+-_add_variable_or_fallback('SAGE_SPKG_INST', opj('$SAGE_LOCAL', 'var', 'lib', 'sage', 'installed'))
++_add_variable_or_fallback('SAGE_SPKG_INST', opj('$SAGE_ROOT', 'local', 'var', 'lib', 'sage', 'installed'))
+ _add_variable_or_fallback('SAGE_DOC_SRC', opj('$SAGE_SRC', 'doc'))
+ _add_variable_or_fallback('SAGE_DOC', opj('$SAGE_SHARE', 'doc', 'sage'))
+ _add_variable_or_fallback('DOT_SAGE', opj(os.environ.get('HOME','$SAGE_ROOT'), '.sage'))
+--- a/sage/build/make/install
++++ b/sage/build/make/install
+@@ -7,11 +7,11 @@
+ # Assume current directory is SAGE_ROOT/build/make
+ export SAGE_ROOT=`cd ../.. && pwd -P`
+ export SAGE_SRC="$SAGE_ROOT/src"
+-export SAGE_LOCAL="$SAGE_ROOT/local"
++export SAGE_LOCAL="${SAGE_LOCAL:-SAGE_ROOT/local}"
+ export SAGE_SHARE="$SAGE_LOCAL/share"
+ export SAGE_EXTCODE="$SAGE_SHARE/sage/ext"
+ export SAGE_LOGS="$SAGE_ROOT/logs/pkgs"
+-export SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed"
++export SAGE_SPKG_INST="$SAGE_ROOT/local/var/lib/sage/installed"
+ export SAGE_VERSION=`cat $SAGE_ROOT/VERSION.txt | sed 's+.*\ \(.*\),.*+\1+'`
+
+ if [ -z "${SAGE_ORIG_PATH_SET}" ]; then
+@@ -20,7 +20,7 @@
+ fi
+ export PATH="$SAGE_ROOT/build/bin:$SAGE_SRC/bin:$SAGE_LOCAL/bin:$PATH"
+
+-export PYTHONPATH="$SAGE_LOCAL"
++export PYTHONPATH="${PYTHONPATH:-SAGE_LOCAL}"
+
+ # Storing the start time of the build process. The time is stored in
+ # seconds since 1970-01-01 in a hidden file called
+--- a/sage/configure.ac
++++ b/sage/configure.ac
+@@ -81,10 +81,10 @@
+ # Assume current directory is SAGE_ROOT
+ SAGE_ROOT=`pwd -P`
+ SAGE_SRC="$SAGE_ROOT/src"
+-SAGE_LOCAL="$SAGE_ROOT/local"
++SAGE_LOCAL="${SAGE_LOCAL:-$SAGE_ROOT/local}"
+ SAGE_SHARE="$SAGE_LOCAL/share"
+ SAGE_EXTCODE="$SAGE_SHARE/sage/ext"
+-SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed"
++SAGE_SPKG_INST="$SAGE_ROOT/local/var/lib/sage/installed"
+
+ #---------------------------------------------------------
+ AX_CHECK_ROOT([AC_MSG_ERROR([You cannot build Sage as root, switch to an unpriviledged user])], [])
+@@ -989,8 +989,8 @@
+ AC_CONFIG_COMMANDS(mkdirs,
+ [
+ SAGE_LOGS=${ac_abs_top_builddir}/logs/pkgs
+- SAGE_LOCAL=${ac_abs_top_builddir}/local
+- SAGE_SHARE=${ac_abs_top_builddir}/local/share
++ SAGE_LOCAL=${SAGE_LOCAL:-${ac_abs_top_builddir}/local}
++ SAGE_SHARE=${SAGE_LOCAL}/share
+ SAGE_INST=${ac_abs_top_builddir}/local/var/lib/sage/installed
+ for d in "$SAGE_LOGS" "$SAGE_LOCAL" \
+ "$SAGE_LOCAL/bin" "$SAGE_LOCAL/etc" \
diff --git a/debian/patches/series b/debian/patches/series
index 7335594..7b2004e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,6 +11,7 @@ fixsage-use-lexists-not-exists.patch
fixsage-proper-scipy-rtol.patch
fixsage-revert-lazy-import-dependent-on-python-patch.patch
fixsage-revert-minor-feature-dependent-on-python-patch.patch
+fixsage-allow-override-sage-local.patch
# due to us using a different version of a dependency than what Sage uses
# we'll probably drop these when importing the next version of Sage
@@ -41,12 +42,13 @@ debian-octave.patch
debian-sage-gap-reset.patch
# this next one contains some stuff that should be forwarded upstream
debian-fix-trivial-test-cases.patch
+debian-install-paths.patch
# temporary patches for whatever reason
# they will eventually be gotten rid of
-debian-temp-userdir.patch
temp-disable-parallel-sphinx.patch
temp-cython-include-source.patch
version-temp-singular-4-extra-fixes.patch
-temp-fix-more-tests.patch
version-temp-glpk-4.60-extra-hacky-fixes.patch
+temp-fix-more-tests.patch
+debian-temp-userdir.patch
diff --git a/debian/rules b/debian/rules
index 98bc805..f222ae6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -23,6 +23,9 @@ export CCACHE_DIR := $(PWD)/debian/ccache
$(shell mkdir -p "$(CCACHE_DIR)")
endif
+export SAGE_LOCAL = $(shell pwd)/debian/tmp/usr
+export PYTHONPATH = $(shell pwd)/debian/tmp/usr/lib/python2.7/dist-packages
+
%:
dh $@ --parallel
@@ -36,8 +39,6 @@ override_dh_auto_install:
# upstream "clean" only cleans the sagelib build and not e.g. spkg builds
override_dh_auto_clean:
$(MAKE) --directory=sage distclean
-# TODO: rm the below when we get rid of our "userdir" patches
- rm -rf $$HOME/.sage/local $$HOME/.local/share/sagemath
get-orig-source:
cd sage && git archive --prefix=sagemath_$(DEB_VERSION_UPSTREAM)/sage/ \
@@ -50,7 +51,7 @@ prune:
touch prune
ptestlong:
- cd sage && local/bin/sage-starts
+ cd sage && $(SAGE_LOCAL)/bin/sage-starts
# We do the below instead of `$(MAKE) --directory=sage ptestlong` because
# it has a bug where it can't detect a previous successful build. So it
# will try to rebuild some sagelib files, then the docbuild, then those
@@ -66,7 +67,7 @@ ptestlong:
# its build directory. At least that's my (infinity0) impression; I didn't
# investigate this in too much detail yet.
clean-docbuild:
- rm -rf $$HOME/.local/share/sagemath/doc
+ rm -rf debian/tmp/usr/share/doc/sage
reset: clean clean-docbuild
QUILT_PATCHES=debian/patches quilt pop -af || true
--
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