Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] [WIP] New package: sagemath-9.5.beta5
@ 2021-11-11 14:12 tornaria
  2021-11-11 16:08 ` dkwo
                   ` (77 more replies)
  0 siblings, 78 replies; 79+ messages in thread
From: tornaria @ 2021-11-11 14:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 624 bytes --]

There is a new pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta5
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 4316 bytes --]

From a3f2026d7738a65824d0536677a5cfebff7f5e97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 1/2] add option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..0ac9d7dda65a 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From 9e7ae4a1e0b33ed1ea5cfad89b3f8fa2016324cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 2/2] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..49d835c5f39c
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
@ 2021-11-11 16:08 ` dkwo
  2021-11-12  7:27 ` fosslinux
                   ` (76 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-11 16:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-966426866

Comment:
I'd go with `sagemath`.
Is it possible to not build as root, or otherwise pass the option?
```
checking for root user... yes
configure: error: You cannot build Sage as root, switch to an unprivileged user.  (If building in a container, use --enable-build-as-root.)
```
We need more expert advice with relocation.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
  2021-11-11 16:08 ` dkwo
@ 2021-11-12  7:27 ` fosslinux
  2021-11-12 20:16 ` dkwo
                   ` (75 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: fosslinux @ 2021-11-12  7:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 189 bytes --]

New comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-966883839

Comment:
Should use the `--enable-build-as-root` option

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
  2021-11-11 16:08 ` dkwo
  2021-11-12  7:27 ` fosslinux
@ 2021-11-12 20:16 ` dkwo
  2021-11-12 20:22 ` dkwo
                   ` (74 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-12 20:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1491 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967473305

Comment:
With this, at least it gets to the end
```
=> Registering new packages to /host/binpkgs/sagemath
index: added `sage-9.5.beta5_1' (x86_64).
index: 1 packages registered.
=> sage-9.5.beta5_1: removing autodeps, please wait...
=> sage-9.5.beta5_1: cleaning build directory...
=> sage: removing files from destdir...
```
on the `x86_64`
```
make[2]: Leaving directory '/builddir/sage-9.5.beta5/build/make'

real    22m23.377s
user    164m31.944s
sys     6m1.798s
Sage build/upgrade complete!
```
Obviously, it complains that
```
=> sage-9.5.beta5_1: running pre-pkg hook: 99-pkglint ...
=> WARNING: sage-9.5.beta5_1: liblinbox.so.0 not found in common/shlibs!
=> WARNING: sage-9.5.beta5_1: liblrcalc.so.1 not found in common/shlibs!
=> WARNING: sage-9.5.beta5_1: libbrial_groebner.so.3 not found in common/shlibs!
=> WARNING: sage-9.5.beta5_1: libcliquer.so.1 not found in common/shlibs!
=> WARNING: sage-9.5.beta5_1: libpython3.9.so.1.0 not found in common/shlibs!
=> WARNING: sage-9.5.beta5_1: libbrial.so.3 not found in common/shlibs!
=> WARNING: sage-9.5.beta5_1: libgap.so.0 not found in common/shlibs!
=> WARNING: sage-9.5.beta5_1: libbraiding.so.0 not found in common/shlibs!
=> WARNING: sage-9.5.beta5_1: libhomfly.so.0 not found in common/shlibs!
```
and lots of `=> WARNING: sage-9.5.beta5_1: removed empty dir: ...`

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (2 preceding siblings ...)
  2021-11-12 20:16 ` dkwo
@ 2021-11-12 20:22 ` dkwo
  2021-11-12 20:28 ` dkwo
                   ` (73 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-12 20:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1586 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967482959

Comment:
Other than that, it installs fine.
I will run doctests and perhaps test on musl, but it looks not so bad.
```
[nicolo@mabragor ~]$ sage
/usr/lib/sage-9.5.beta5/bin/sage-env: line 122: cd: /builddir/sage-9.5.beta5: No such file or directory
Warning: overwriting SAGE_ROOT environment variable:
Old SAGE_ROOT=/builddir/sage-9.5.beta5
New SAGE_ROOT=
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.5.beta5, Release Date: 2021-10-28               │
│ Using Python 3.9.7. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: 2+2
4
```

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (3 preceding siblings ...)
  2021-11-12 20:22 ` dkwo
@ 2021-11-12 20:28 ` dkwo
  2021-11-12 20:37 ` dkwo
                   ` (72 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-12 20:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 269 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967493612

Comment:
Either `./configure --prefix=SAGE_LOCAL` or edit `#SAGE_ROOT=/path/to/sage-version` at the beginning of the scritp should fix that.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (4 preceding siblings ...)
  2021-11-12 20:28 ` dkwo
@ 2021-11-12 20:37 ` dkwo
  2021-11-12 22:06 ` fosslinux
                   ` (71 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-12 20:37 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 3042 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967508279

Comment:
About the doctests, I'm still unable to perform them
From within sage
```
sage: run_doctests(sage.combinat.affine_permutation)
too few successful tests, not using stored timings
Running doctests with ID 2021-11-12-21-34-16-32069d04.
Using --optional=sage
Doctesting 1 file.
sage -t --random-seed=0 /builddir/sage-9.5.beta5/src/sage/combinat/affine_permutation.py
    FileNotFoundError in doctesting framework
**********************************************************************
Traceback (most recent call last):
  File "/usr/lib/sage-9.5.beta5/lib/python3.9/site-packages/sage/doctest/forker.py", line 2465, in __call__
    doctests, extras = self._run(runner, options, results)
  File "/usr/lib/sage-9.5.beta5/lib/python3.9/site-packages/sage/doctest/forker.py", line 2513, in _run
    doctests, extras = self.source.create_doctests(sage_namespace)
  File "/usr/lib/sage-9.5.beta5/lib/python3.9/site-packages/sage/doctest/sources.py", line 725, in create_doctests
    raise IOError(errno.ENOENT, "File does not exist", self.path)
FileNotFoundError: [Errno 2] File does not exist: '/builddir/sage-9.5.beta5/src/sage/combinat/affine_permutation.py'

----------------------------------------------------------------------
sage -t --random-seed=0 /builddir/sage-9.5.beta5/src/sage/combinat/affine_permutation.py  # FileNotFoundError in doctesting framework
----------------------------------------------------------------------
Total time for all tests: 0.0 seconds
    cpu time: 0.0 seconds
    cumulative wall time: 0.0 seconds
```
From terminal
```
[nicolo@mabragor ~]$ sage --testall
/usr/lib/sage-9.5.beta5/bin/sage-env: line 122: cd: /builddir/sage-9.5.beta5: No such file or directory
Warning: overwriting SAGE_ROOT environment variable:
Old SAGE_ROOT=/builddir/sage-9.5.beta5
New SAGE_ROOT=
Running doctests with ID 2021-11-12-21-36-43-b1335b9b.
Using --optional=dochtml,pip,sage,sage.geometry.polyhedron,sage.rings.real_double
Doctesting entire Sage library.
Traceback (most recent call last):
  File "/usr/lib/sage-9.5.beta5/bin/sage-runtests", line 151, in <module>
    err = DC.run()
  File "/usr/lib/sage-9.5.beta5/lib/python3.9/site-packages/sage/doctest/control.py", line 1251, in run
    self.expand_files_into_sources()
  File "/usr/lib/sage-9.5.beta5/lib/python3.9/site-packages/sage/doctest/control.py", line 835, in expand_files_into_sources
    self.sources = [FileDocTestSource(path, self.options) for path in expand()]
  File "/usr/lib/sage-9.5.beta5/lib/python3.9/site-packages/sage/doctest/control.py", line 835, in <listcomp>
    self.sources = [FileDocTestSource(path, self.options) for path in expand()]
  File "/usr/lib/sage-9.5.beta5/lib/python3.9/site-packages/sage/doctest/sources.py", line 527, in __init__
    raise ValueError("unknown file extension %r"%ext)
ValueError: unknown file extension ''
```
What am I missing?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (5 preceding siblings ...)
  2021-11-12 20:37 ` dkwo
@ 2021-11-12 22:06 ` fosslinux
  2021-11-12 22:12 ` [PR REVIEW] " Duncaen
                   ` (70 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: fosslinux @ 2021-11-12 22:06 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

New comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967659661

Comment:
You can ignore the `common/shlibs` and `empty dir` messages.

The doctest failures probably have something to do with using python 3.9; why is this?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PR REVIEW] [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (6 preceding siblings ...)
  2021-11-12 22:06 ` fosslinux
@ 2021-11-12 22:12 ` Duncaen
  2021-11-13  1:27 ` tornaria
                   ` (69 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: Duncaen @ 2021-11-12 22:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 181 bytes --]

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#discussion_r748614634

Comment:
things like this should be quoted.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (7 preceding siblings ...)
  2021-11-12 22:12 ` [PR REVIEW] " Duncaen
@ 2021-11-13  1:27 ` tornaria
  2021-11-13  1:30 ` tornaria
                   ` (68 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-13  1:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 790 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967754923

Comment:
> We need more expert advice with relocation.

I think one way would be to compile sage in-place, then remove all unnecessary stuff (or vinstall all necessary stuff).

I'll give it a try later.

The alternative is how sage builds binary tarballs: compile sage in a directory with a particular pathname (long enough), then search-and-replace this pathname with the location it will be installed.

In their binary tarballs they do this search-and-replace step the first time sage runs after being extracted, in this way sage can be extracted anywhere and will fix its paths the first time it runs. We would do this at xbps-src install time.


^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (8 preceding siblings ...)
  2021-11-13  1:27 ` tornaria
@ 2021-11-13  1:30 ` tornaria
  2021-11-13  1:33 ` tornaria
                   ` (67 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-13  1:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1169 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967755491

Comment:
> Obviously, it complains that
> 
> ```
> => sage-9.5.beta5_1: running pre-pkg hook: 99-pkglint ...
> => WARNING: sage-9.5.beta5_1: liblinbox.so.0 not found in common/shlibs!
> => WARNING: sage-9.5.beta5_1: liblrcalc.so.1 not found in common/shlibs!
> => WARNING: sage-9.5.beta5_1: libbrial_groebner.so.3 not found in common/shlibs!
> => WARNING: sage-9.5.beta5_1: libcliquer.so.1 not found in common/shlibs!
> => WARNING: sage-9.5.beta5_1: libpython3.9.so.1.0 not found in common/shlibs!
> => WARNING: sage-9.5.beta5_1: libbrial.so.3 not found in common/shlibs!
> => WARNING: sage-9.5.beta5_1: libgap.so.0 not found in common/shlibs!
> => WARNING: sage-9.5.beta5_1: libbraiding.so.0 not found in common/shlibs!
> => WARNING: sage-9.5.beta5_1: libhomfly.so.0 not found in common/shlibs!
> ```

These are false warnings, we don't want this pkg to provide any shlibs and those shlibs will not be in any standard path anyway. As a matter of fact, all of those should eventually be gone and used from system instead.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (9 preceding siblings ...)
  2021-11-13  1:30 ` tornaria
@ 2021-11-13  1:33 ` tornaria
  2021-11-13  3:14 ` [PR PATCH] [Updated] " tornaria
                   ` (66 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-13  1:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 604 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967756058

Comment:
> You can ignore the `common/shlibs` and `empty dir` messages.
> 
> The doctest failures probably have something to do with using python 3.9; why is this?

No, this is because sage needs the source files to be available, and I didn't include in the pkg. This is not just for testing, but also for inline help. You can see it complains about missing `/builddir/sage-9.5.beta5/...` files, which is where the source files were.

I'll do a second attempt soon.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (10 preceding siblings ...)
  2021-11-13  1:33 ` tornaria
@ 2021-11-13  3:14 ` tornaria
  2021-11-13  3:18 ` tornaria
                   ` (65 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-13  3:14 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta5
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 7976 bytes --]

From c3a3d3732b428ccd187895647561cb8233f309e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 1/3] add option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..0ac9d7dda65a 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From de92a506b36c787110d68b4c49abd71ae9d50cb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 2/3] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..49d835c5f39c
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 5515c6226a169bba1158fc6464a811d7cb8f259e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 3/3] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 49d835c5f39c..fd19d60b2a1d 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $SAGE_ROOT
+	ln -sfT $SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (11 preceding siblings ...)
  2021-11-13  3:14 ` [PR PATCH] [Updated] " tornaria
@ 2021-11-13  3:18 ` tornaria
  2021-11-13  8:59 ` dkwo
                   ` (64 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-13  3:18 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 810 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967770614

Comment:
Second draft:
 - rename pkg from sage to sagemath (please remove sage before installing sagemath as I didn't set replaces=)
 - updated sage to sage-9.5.beta6
 - now it builds in place at `/usr/lib/sage-$version`
 - the resulting pkg includes a lot of useless stuff that comes with the distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).

A useful reference is https://github.com/sagemath/binary-pkg.

Now it's possible to run tests on the installed sage, for instance:
```
$ sage -tp 8 --all
```
to test all with 8 parallel jobs.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (12 preceding siblings ...)
  2021-11-13  3:18 ` tornaria
@ 2021-11-13  8:59 ` dkwo
  2021-11-13  9:02 ` dkwo
                   ` (63 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-13  8:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 281 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967865094

Comment:
It's getting better.
Could you include your `pyzmq` patch, at least until we're using sage's python modules, so that it also builds on `musl`?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (13 preceding siblings ...)
  2021-11-13  8:59 ` dkwo
@ 2021-11-13  9:02 ` dkwo
  2021-11-13  9:28 ` dkwo
                   ` (62 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-13  9:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 234 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967870203

Comment:
>     * now it builds in place at `/usr/lib/sage-$version`

@leahneukirchen What do you think?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (14 preceding siblings ...)
  2021-11-13  9:02 ` dkwo
@ 2021-11-13  9:28 ` dkwo
  2021-11-13  9:36 ` dkwo
                   ` (61 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-13  9:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 452 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967916355

Comment:
>     * the resulting pkg includes a lot of useless stuff that comes with the distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).

Definitely :)
`Size required on disk:        7300MB `

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (15 preceding siblings ...)
  2021-11-13  9:28 ` dkwo
@ 2021-11-13  9:36 ` dkwo
  2021-11-13 10:22 ` dkwo
                   ` (60 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-13  9:36 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967928792

Comment:
Dumb question: does this in htop mean it is using system python? 
`python3 /usr/lib/sage-9.5.beta6/src/bin/sage-runtests -p 12 --all`

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (16 preceding siblings ...)
  2021-11-13  9:36 ` dkwo
@ 2021-11-13 10:22 ` dkwo
  2021-11-13 10:48 ` dkwo
                   ` (59 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-13 10:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 183 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968008642

Comment:
Could you add `gengetopt` to the makedepends?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (17 preceding siblings ...)
  2021-11-13 10:22 ` dkwo
@ 2021-11-13 10:48 ` dkwo
  2021-11-13 10:50 ` [PR PATCH] [Updated] " tornaria
                   ` (58 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-13 10:48 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 761 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968048978

Comment:
It seems `giac` is not picked up, could you add it also to `depends`?
```
 RuntimeError: unable to start giac because the command 'giac --sage' failed: The command was not found or was not executable: giac.

    In order to use the Giac interface you need to have Giac installed
    and have a program called "giac" in your PATH. You need a giac version
    supporting "giac --sage" ( roughly after 0.9.1 of march 2011). Some giac
    instructions  and the help's langage depend of you LANG variable. To obtain
    inline help for  giac commands, you also need to have the program "cas_help"
    in your PATH.
```

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (18 preceding siblings ...)
  2021-11-13 10:48 ` dkwo
@ 2021-11-13 10:50 ` tornaria
  2021-11-13 10:59 ` tornaria
                   ` (57 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-13 10:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta5
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 10469 bytes --]

From 5701339d82dc6127ada60ee9487a4a0e9186adb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 1/4] hooks: option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..c0f2198e44cf 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$_no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From e5df033c986d4451162ba9d605bc2438b4e35461 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 2/4] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 0e85019dec9235654b682c14f80e0fdf8f5b6c0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 3/4] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From b0a333cb0447a65134497b60a91a443d3a5f4132 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 4/4] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..8cbfc4023df3 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopts texinfo
 "
 
 # TODO: standard

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (19 preceding siblings ...)
  2021-11-13 10:50 ` [PR PATCH] [Updated] " tornaria
@ 2021-11-13 10:59 ` tornaria
  2021-11-13 11:05 ` tornaria
                   ` (56 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-13 10:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta5
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 10468 bytes --]

From 5701339d82dc6127ada60ee9487a4a0e9186adb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 1/4] hooks: option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..c0f2198e44cf 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$_no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From e5df033c986d4451162ba9d605bc2438b4e35461 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 2/4] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 0e85019dec9235654b682c14f80e0fdf8f5b6c0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 3/4] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From ad557eb75ef34ad8c4c2febd27e9b90f0f28c21b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 4/4] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..56166cd44272 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopt texinfo
 "
 
 # TODO: standard

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (20 preceding siblings ...)
  2021-11-13 10:59 ` tornaria
@ 2021-11-13 11:05 ` tornaria
  2021-11-13 11:42 ` tornaria
                   ` (55 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-13 11:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2499 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968050979

Comment:
New on sagemath-9.5.beta6_2:
 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts

This one should save ~ 3.8G installed size.

Again, it should be possible to run tests on the installed sage, for instance:
```
$ sage -tp 8 --all
```
to test all with 8 parallel jobs. There are a few tests failing will look into it when I get a chance. It may also be useful to compare tests failing on `./xbps-src check sagemath` vs test failing on installed sage.
```
----------------------------------------------------------------------
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/env.py  # 1 doctest failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/functions/min_max.py  # 2 doctests failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/lfunctions/sympow.py  # 10 doctests failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/lfunctions/pari.py  # 1 doctest failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/modular/abvar/abvar.py  # 1 doctest failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/modular/hecke/submodule.py  # 1 doctest failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/repl/ipython_kernel/install.py  # 1 doctest failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/schemes/elliptic_curves/ell_rational_field.py  # 9 doctests failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage_docbuild/__init__.py  # 1 doctest failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage_setup/find.py  # 3 doctests failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/tests/cmdline.py  # 1 doctest failed
----------------------------------------------------------------------
Total time for all tests: 1186.4 seconds
    cpu time: 7017.0 seconds
    cumulative wall time: 8303.5 seconds
```

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (21 preceding siblings ...)
  2021-11-13 11:05 ` tornaria
@ 2021-11-13 11:42 ` tornaria
  2021-11-13 12:30 ` dkwo
                   ` (54 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-13 11:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 421 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968055202

Comment:
> It seems `giac` is not picked up, could you add it also to `depends`?

Good point, we have to explicitly add anything that is needed at runtime that is not implicitly required by shlibs. Maybe we should try to run all tests in a barebones chroot with only sagemath installed.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (22 preceding siblings ...)
  2021-11-13 11:42 ` tornaria
@ 2021-11-13 12:30 ` dkwo
  2021-11-13 13:48 ` dkwo
                   ` (53 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-13 12:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 8035 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968061042

Comment:
Was the building taking 90+ min on the ci also before?

I'm not yet using a chroot, but my system is quite clean: it seems we also miss `singular, pari` from `depends`.
As a consequence, I was still getting a bit more doctest failures with previous version:
```
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/tests/cmdline.py  # 5 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/schemes/elliptic_curves/ell_rational_field.py  # 14 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/rings/number_field/number_field.py  # 6 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/sageinspect.py  # 35 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/sagedoc.py  # 6 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/modular/abvar/abvar.py  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/rings/number_field/number_field_element.pyx  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/modular/hecke/submodule.py  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/rings/integer.pyx  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/repl/ipython_extension.py  # 6 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/graphs/connectivity.pyx  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/parallel/decorate.py  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/rings/number_field/number_field_rel.py  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/rings/number_field/galois_group.py  # 11 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/persist.pyx  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/structure/element.pyx  # 37 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/inline_fortran.py  # 3 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/functions/min_max.py  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage_docbuild/__init__.py  # 5 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/features/__init__.py  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/lfunctions/pari.py  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage_setup/find.py  # 3 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/superseded.py  # 6 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/groups/galois_group.py  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/interfaces/gp.py  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/groups/perm_gps/permgroup_morphism.py  # 3 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/env.py  # 4 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/rings/polynomial/ore_polynomial_element.pyx  # 6 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/repl/ipython_kernel/install.py  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/tests/books/judson-abstract-algebra/galois-sage.py  # 5 doctests
 failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/rings/tate_algebra_ideal.pyx  # 6 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/lfunctions/sympow.py  # 10 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/interfaces/qsieve.py  # 7 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/cython.py  # 21 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/structure/factory.pyx  # 8 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/graphs/graph_decompositions/fast_digraph.pyx  # 5 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/session.pyx  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/lazy_attribute.pyx  # 3 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/ext/memory_allocator.pxd  # 3 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/ext/memory_allocator.pyx  # 7 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/groups/pari_group.py  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/nested_class.pyx  # 6 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/arith/long.pxd  # 14 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/repl/load.py  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/docs/instancedoc.pyx  # 4 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/cpython/cython_metaclass.pyx  # 4 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/rings/integer_fake.pxd  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/cpython/wrapperdescr.pxd  # 6 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/symbolic/pynac.pxi  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/inherit_comparison.pyx  # 5 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/cpython/string.pyx  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/docs/conf.py  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/cpython/getattr.pyx  # 4 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/cachefunc.pyx  # 54 doctests failed
```

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (23 preceding siblings ...)
  2021-11-13 12:30 ` dkwo
@ 2021-11-13 13:48 ` dkwo
  2021-11-13 13:50 ` dkwo
                   ` (52 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-13 13:48 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 200 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968071538

Comment:
perhaps also add to depends: flintqs pari-datapkgs and zn_poly

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (24 preceding siblings ...)
  2021-11-13 13:48 ` dkwo
@ 2021-11-13 13:50 ` dkwo
  2021-11-13 13:53 ` leahneukirchen
                   ` (51 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-13 13:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 176 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968071841

Comment:
Sorry, forget about singular and pari.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (25 preceding siblings ...)
  2021-11-13 13:50 ` dkwo
@ 2021-11-13 13:53 ` leahneukirchen
  2021-11-13 14:20 ` leahneukirchen
                   ` (50 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: leahneukirchen @ 2021-11-13 13:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 189 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968072324

Comment:
Running the test suite also requires git.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (26 preceding siblings ...)
  2021-11-13 13:53 ` leahneukirchen
@ 2021-11-13 14:20 ` leahneukirchen
  2021-11-13 14:22 ` leahneukirchen
                   ` (49 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: leahneukirchen @ 2021-11-13 14:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 160 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968075951

Comment:
Also sympow.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (27 preceding siblings ...)
  2021-11-13 14:20 ` leahneukirchen
@ 2021-11-13 14:22 ` leahneukirchen
  2021-11-13 14:55 ` leahneukirchen
                   ` (48 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: leahneukirchen @ 2021-11-13 14:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968075951

Comment:
Also sympow.

We may want to add this patch: https://gitweb.gentoo.org/repo/gentoo.git/tree/sci-mathematics/sympow/files/sympow-2.023.6-no-pkgdatafilesbindir-warnings.patch

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (28 preceding siblings ...)
  2021-11-13 14:22 ` leahneukirchen
@ 2021-11-13 14:55 ` leahneukirchen
  2021-11-13 14:58 ` leahneukirchen
                   ` (47 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: leahneukirchen @ 2021-11-13 14:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1274 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968081092

Comment:
I made all but 6 tests pass:

> sage -t --random-seed=2922128458579573960176688891507420022 usr/lib/sage-9.5.beta6/src/sage/functions/min_max.py  # 2 doctests failed

Lack of symbolic execution and wrong rounding, this one should be investigated.

> sage -t --random-seed=2922128458579573960176688891507420022 usr/lib/sage-9.5.beta6/src/sage/lfunctions/pari.py  # 1 doctest failed

Just a warning: `      ***   Warning: normalizing a series with 0 leading term.`

> sage -t --random-seed=2922128458579573960176688891507420022 usr/lib/sage-9.5.beta6/src/sage_setup/find.py  # 1 doctest failed

`find_extra_files`, not sure why there should be a `wrapper_cdf.h`.

> sage -t --random-seed=2922128458579573960176688891507420022 usr/lib/sage-9.5.beta6/src/sage/env.py  # 1 doctest failed

`_get_shared_lib_path` may be broken

> sage -t --random-seed=2922128458579573960176688891507420022 usr/lib/sage-9.5.beta6/src/sage/misc/sagedoc.py  # 4 doctests failed
> sage -t --random-seed=2922128458579573960176688891507420022 usr/lib/sage-9.5.beta6/src/sage/docs/conf.py  # 1 doctest failed

No docs are installed.


^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (29 preceding siblings ...)
  2021-11-13 14:55 ` leahneukirchen
@ 2021-11-13 14:58 ` leahneukirchen
  2021-11-13 15:00 ` dkwo
                   ` (46 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: leahneukirchen @ 2021-11-13 14:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 223 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968081422

Comment:
Also we should install pytest with `sage --pip install` to have more tests.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (30 preceding siblings ...)
  2021-11-13 14:58 ` leahneukirchen
@ 2021-11-13 15:00 ` dkwo
  2021-11-13 15:07 ` leahneukirchen
                   ` (45 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-13 15:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 255 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968081812

Comment:
Very well.
Indeed, sage uses the same patch for sympow, see https://git.sagemath.org/sage.git/tree/build/pkgs/sympow

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (31 preceding siblings ...)
  2021-11-13 15:00 ` dkwo
@ 2021-11-13 15:07 ` leahneukirchen
  2021-11-13 15:11 ` leahneukirchen
                   ` (44 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: leahneukirchen @ 2021-11-13 15:07 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 343 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968082964

Comment:
> sage -t --warn-long 35.7 --random-seed=327098103431076596046796804314805549386 usr/lib/sage-9.5.beta6/src/sage>/rings/tate_algebra_ideal.pyx
May be a upstream bug, does someone want to report?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (32 preceding siblings ...)
  2021-11-13 15:07 ` leahneukirchen
@ 2021-11-13 15:11 ` leahneukirchen
  2021-11-13 15:28 ` dkwo
                   ` (43 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: leahneukirchen @ 2021-11-13 15:11 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 328 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968083600

Comment:
> sage -t --warn-long 35.7 --random-seed=327098103431076596046796804314805549386 usr/lib/sage-9.5.beta6/src/sage/tests/cmdline.py

Not sure about that one, has a missing fixture?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (33 preceding siblings ...)
  2021-11-13 15:11 ` leahneukirchen
@ 2021-11-13 15:28 ` dkwo
  2021-11-13 15:34 ` leahneukirchen
                   ` (42 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-13 15:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 371 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968085864

Comment:
@leahneukirchen Did you find anything missing other than these?
```
+depends="giac git FlintQS zn_poly sympow
+ pari-elldata-small pari-galdata pari-galpol-small pari-seadata"
```
Are you also testing with `sage -tp NUM --all` ?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (34 preceding siblings ...)
  2021-11-13 15:28 ` dkwo
@ 2021-11-13 15:34 ` leahneukirchen
  2021-11-14  4:42 ` ericonr
                   ` (41 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: leahneukirchen @ 2021-11-13 15:34 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968086750

Comment:
These: flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran 

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (35 preceding siblings ...)
  2021-11-13 15:34 ` leahneukirchen
@ 2021-11-14  4:42 ` ericonr
  2021-11-14  4:43 ` ericonr
                   ` (40 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: ericonr @ 2021-11-14  4:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 459 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968205411

Comment:
I maintain my comment from https://github.com/void-linux/void-packages/pull/34053#issuecomment-968073629

> _get_shared_lib_path may be broken

Could a patch like https://github.com/void-linux/void-packages/blob/67adbca402734d3a4fabab246e355850bf7b736b/srcpkgs/python3/patches/musl-find_library.patch be necessary?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (36 preceding siblings ...)
  2021-11-14  4:42 ` ericonr
@ 2021-11-14  4:43 ` ericonr
  2021-11-14 14:27 ` leahneukirchen
                   ` (39 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: ericonr @ 2021-11-14  4:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 455 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968205411

Comment:
I keep my comment from https://github.com/void-linux/void-packages/pull/34053#issuecomment-968073629

> _get_shared_lib_path may be broken

Could a patch like https://github.com/void-linux/void-packages/blob/67adbca402734d3a4fabab246e355850bf7b736b/srcpkgs/python3/patches/musl-find_library.patch be necessary?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (37 preceding siblings ...)
  2021-11-14  4:43 ` ericonr
@ 2021-11-14 14:27 ` leahneukirchen
  2021-11-14 15:20 ` tornaria
                   ` (38 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: leahneukirchen @ 2021-11-14 14:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 201 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968301144

Comment:
I tried on glibc, not sure how that patch would help?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (38 preceding siblings ...)
  2021-11-14 14:27 ` leahneukirchen
@ 2021-11-14 15:20 ` tornaria
  2021-11-14 16:31 ` leahneukirchen
                   ` (37 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-14 15:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 355 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968310951

Comment:
> These: flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran

Are all those `*-devel` pkgs really necessary for running sage?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (39 preceding siblings ...)
  2021-11-14 15:20 ` tornaria
@ 2021-11-14 16:31 ` leahneukirchen
  2021-11-14 21:28 ` [PR PATCH] [Updated] " tornaria
                   ` (36 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: leahneukirchen @ 2021-11-14 16:31 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 196 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968323262

Comment:
For just running, no. But some doctests need it.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (40 preceding siblings ...)
  2021-11-14 16:31 ` leahneukirchen
@ 2021-11-14 21:28 ` tornaria
  2021-11-14 21:47 ` tornaria
                   ` (35 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-14 21:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta5
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 13268 bytes --]

From 5701339d82dc6127ada60ee9487a4a0e9186adb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 1/5] hooks: option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..c0f2198e44cf 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$_no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From e5df033c986d4451162ba9d605bc2438b4e35461 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 2/5] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 0e85019dec9235654b682c14f80e0fdf8f5b6c0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 3/5] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From ad557eb75ef34ad8c4c2febd27e9b90f0f28c21b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 4/5] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..56166cd44272 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopt texinfo
 "
 
 # TODO: standard

From 5c604df178fb44f4e1fa1cf02a96582f672e5fdd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 14 Nov 2021 18:23:29 -0300
Subject: [PATCH 5/5] sagemath: revbump to 9.5.beta6_3 for changes

 - add depends needed for runtime and for testing
 - add python_version=3
 - disable skipping 03-rewrite-python-shebang as it seems to be harmless
   after adding python_version=3
 - fix cleaning up of $wrksrc and $_SAGE_ROOT
 - use sage-${version}_${revision} for the binary symlink; this way it
   won't override whatever sage is installed in the system so I can test
   on a live system.
---
 srcpkgs/sagemath/template | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 56166cd44272..cfe97e039974 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,19 +1,24 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=2
+revision=3
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
 make_check_target=ptest
 # for now skip building docs
 make_build_target=build
+depends="giac git FlintQS zn_poly sympow
+ pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
+ flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+python_version=3
 
 # path where sage will be installed
 _SAGE_ROOT=/usr/lib/sage-${version}
@@ -37,7 +42,8 @@ nostrip=yes
 noshlibprovides=yes
 
 # don't rewrite python shebang as sage uses its own python (for now)
-_no_python_shebang=yes
+# after python_version=3, this seems harmless... strange...
+#_no_python_shebang=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
@@ -46,9 +52,12 @@ post_extract() {
 }
 
 do_clean() {
-	# undo post_extract()
-	rm $wrksrc
-	mv $_SAGE_ROOT $wrksrc
+	rm -rf $wrksrc $_SAGE_ROOT
+}
+
+post_build() {
+	# install pytest for more tests
+	./sage -i pytest
 }
 
 do_install() {
@@ -58,7 +67,9 @@ do_install() {
 	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
 	# symlink main binary
 	vmkdir usr/bin
-	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
+	# for now use sage-${version}_${revision} so it doesn't override
+	# other sage installed in the system
+	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
 ### copied from sage-deps, to be kept in sync

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (41 preceding siblings ...)
  2021-11-14 21:28 ` [PR PATCH] [Updated] " tornaria
@ 2021-11-14 21:47 ` tornaria
  2021-11-15 15:58 ` leahneukirchen
                   ` (34 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-14 21:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1561 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968369692

Comment:
New on sagemath-9.5.beta6_3:
     - add depends needed for runtime and for testing
     - add `python_version=3`
     - disable skipping `03-rewrite-python-shebang` as it seems to be harmless after adding `python_version=3` (unexpected... let's try and be alert in case problems arise)
     - fix cleaning up of `$wrksrc` and `$_SAGE_ROOT`
     - use `sage-${version}_${revision}` for the binary symlink; this way it won't override whatever sage is installed in the system so I can test on a live system.

The doctest failures for `sympow` should be fixed when #34077 is merged.

At some point I plan on:
 - investigating all the doctest failures, try to fix them or find a workaround (goal: enable check and still have CI pass)
 - investigate https://trac.sagemath.org/ticket/30766 to see if we can get it working on system python 3.10.
 - add more packages to void:
    - standard pkgs missing: `brial cliquer gfan libbraiding libhomfly lrcalc nauty palp pdf2svg tachyon`
    - optional pkgs missing: `4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb`

Note that https://trac.sagemath.org/ticket/30766 mentions some updates necessary to support python 3.10, some of which we don't have, namely:
 - `python3-Babel` update to 2.9.1
 - `python3-traitlets` update to 5.1.1
 - `python3-distlib` update to 0.3.3

Most probably I won't have time to follow up much on this PR before next weekend.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (42 preceding siblings ...)
  2021-11-14 21:47 ` tornaria
@ 2021-11-15 15:58 ` leahneukirchen
  2021-11-15 16:16 ` tornaria
                   ` (33 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: leahneukirchen @ 2021-11-15 15:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 244 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-969053713

Comment:
I think we are still installing too much. Wouldn't it be enough if /usr/lib/sage was $SAGELOCAL?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (43 preceding siblings ...)
  2021-11-15 15:58 ` leahneukirchen
@ 2021-11-15 16:16 ` tornaria
  2021-11-17  9:20 ` dkwo
                   ` (32 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-15 16:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1089 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-969072495

Comment:
> I think we are still installing too much. Wouldn't it be enough if /usr/lib/sage was $SAGELOCAL?

That's what revision 1 did, namely: instead of compiling in place, compile in `/build` and use `--prefix=/usr/lib/sage-$version`. Then the whole of $SAGELOCAL ended up in /usr/lib/sage-$version but it didn''t work since sage expects to have all source available for inline help and for doctesting; moreover it was looking for it at `/builddir/sage-$version`, etc...

So from what's installed now (revision 3), we must keep at least `local` and `src`. From the rest `logs` we can definitely kill, I didn't do it just to have it around while we are trying working in case it's useful but it should go. I don't know about `build`, there's 22M left and I would need to look carefully to see what's needed and what's not needed. The rest is small stuff most of it should be safe to remove but I rather have all tests passing before I start pruning.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (44 preceding siblings ...)
  2021-11-15 16:16 ` tornaria
@ 2021-11-17  9:20 ` dkwo
  2021-11-20 22:12 ` [PR PATCH] [Updated] " tornaria
                   ` (31 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-17  9:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 584 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-971388341

Comment:
> Note that https://trac.sagemath.org/ticket/30766 mentions some updates necessary to support python 3.10, some of which we don't have, namely:
> 
>     * `python3-Babel` update to 2.9.1
> 
>     * `python3-traitlets` update to 5.1.1
> 
>     * `python3-distlib` update to 0.3.3
> 

Aren't those shipped by `sage` anyway at the moment though, even if `python3` comes from system?
If so, their priority is on the same level as say `gap`.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (45 preceding siblings ...)
  2021-11-17  9:20 ` dkwo
@ 2021-11-20 22:12 ` tornaria
  2021-11-21  9:37 ` dkwo
                   ` (30 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-20 22:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta5
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 14379 bytes --]

From 34773deb2ca2fdbea3d61f5cf93e9aec8ac79beb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 1/6] hooks: option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..c0f2198e44cf 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$_no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From 9bda4cb647d64026e2e82f99ef8a1a251c96c628 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 2/6] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 21a5106c8b7b48ca751cd71503dc9b0e31f9cc38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 3/6] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From 38f69160565dc1334195cc3b549e0e99f128056f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 4/6] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..56166cd44272 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopt texinfo
 "
 
 # TODO: standard

From 4dc5be66df29ef22f8d1a02fc42a974e442686c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 14 Nov 2021 18:23:29 -0300
Subject: [PATCH 5/6] sagemath: revbump to 9.5.beta6_3 for changes

 - add depends needed for runtime and for testing
 - add python_version=3
 - disable skipping 03-rewrite-python-shebang as it seems to be harmless
   after adding python_version=3
 - fix cleaning up of $wrksrc and $_SAGE_ROOT
 - use sage-${version}_${revision} for the binary symlink; this way it
   won't override whatever sage is installed in the system so I can test
   on a live system.
---
 srcpkgs/sagemath/template | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 56166cd44272..cfe97e039974 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,19 +1,24 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=2
+revision=3
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
 make_check_target=ptest
 # for now skip building docs
 make_build_target=build
+depends="giac git FlintQS zn_poly sympow
+ pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
+ flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+python_version=3
 
 # path where sage will be installed
 _SAGE_ROOT=/usr/lib/sage-${version}
@@ -37,7 +42,8 @@ nostrip=yes
 noshlibprovides=yes
 
 # don't rewrite python shebang as sage uses its own python (for now)
-_no_python_shebang=yes
+# after python_version=3, this seems harmless... strange...
+#_no_python_shebang=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
@@ -46,9 +52,12 @@ post_extract() {
 }
 
 do_clean() {
-	# undo post_extract()
-	rm $wrksrc
-	mv $_SAGE_ROOT $wrksrc
+	rm -rf $wrksrc $_SAGE_ROOT
+}
+
+post_build() {
+	# install pytest for more tests
+	./sage -i pytest
 }
 
 do_install() {
@@ -58,7 +67,9 @@ do_install() {
 	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
 	# symlink main binary
 	vmkdir usr/bin
-	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
+	# for now use sage-${version}_${revision} so it doesn't override
+	# other sage installed in the system
+	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
 ### copied from sage-deps, to be kept in sync

From 65e8719b8e0e6ee7dc25073e158b843eef7f94e4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 20 Nov 2021 19:01:21 -0300
Subject: [PATCH 6/6] sagemath: update to 9.5.beta7.

---
 srcpkgs/sagemath/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index cfe97e039974..3f9a3e9e077f 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
-version=9.5.beta6
-revision=3
+version=9.5.beta7
+revision=1
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -17,7 +17,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
 # path where sage will be installed

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (46 preceding siblings ...)
  2021-11-20 22:12 ` [PR PATCH] [Updated] " tornaria
@ 2021-11-21  9:37 ` dkwo
  2021-11-21 14:00 ` tornaria
                   ` (29 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-21  9:37 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 5849 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-974783747

Comment:
With the `beta7`, using
```
checkdepends=${makedepends}
do_check() {
  ./sage -tp ${XBPS_MAKEJOBS} --all
}
```
I got the same errors as reported in https://github.com/void-linux/void-packages/pull/34030#issuecomment-968081092 , plus a few more ones, of the same nature (rounding errors). Do we have any issue or missing patch with `arb`?
```
sage -t --random-seed=143111302483655198481928268308882618130 src/sage/functions/gamma.py  # 1 doctest failed
File "src/sage/functions/gamma.py", line 1052, in sage.functions.gamma.Function_beta._method_arguments
Failed example:
    RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))
Expected:
    [7.407662 +/- 6.17e-7]
Got:
    [7.4076616 +/- 5.44e-8]

sage -t --random-seed=143111302483655198481928268308882618130 src/sage/rings/complex_arb.pyx  # 3 doctests failed
File "src/sage/rings/complex_arb.pyx", line 4192, in sage.rings.complex_arb.ComplexBall.Ei
Failed example:
    CBF(Ei(I))
Expected:
    [0.337403922900968 +/- 3.76e-16] + [2.51687939716208 +/- 2.01e-15]*I
Got:
    [0.337403922900968 +/- 4.31e-16] + [2.51687939716208 +/- 2.01e-15]*I
**********************************************************************
File "src/sage/rings/complex_arb.pyx", line 4242, in sage.rings.complex_arb.ComplexBall.Ci
Failed example:
    CBF(Ci(I))
Expected:
    [0.837866940980208 +/- 4.72e-16] + [1.570796326794897 +/- 5.54e-16]*I
Got:
    [0.837866940980208 +/- 4.78e-16] + [1.570796326794897 +/- 5.54e-16]*I
**********************************************************************
File "src/sage/rings/complex_arb.pyx", line 4294, in sage.rings.complex_arb.ComplexBall.Chi
Failed example:
    CBF(Chi(I))
Expected:
    [0.337403922900968 +/- 3.25e-16] + [1.570796326794897 +/- 5.54e-16]*I
Got:
    [0.337403922900968 +/- 3.80e-16] + [1.570796326794897 +/- 5.54e-16]*I

sage -t --random-seed=143111302483655198481928268308882618130 src/sage/rings/real_arb.pyx  # 12 doctests failed
File "src/sage/rings/real_arb.pyx", line 3492, in sage.rings.real_arb.RealBall.Ei
Failed example:
    RBF(1).Ei()
Expected:
    [1.89511781635594 +/- 4.94e-15]
Got:
    [1.89511781635594 +/- 5.11e-15]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3497, in sage.rings.real_arb.RealBall.Ei
Failed example:
    RBF(Ei(1))
Expected:
    [1.89511781635594 +/- 4.94e-15]
Got:
    [1.89511781635594 +/- 5.11e-15]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3534, in sage.rings.real_arb.RealBall.Ci
Failed example:
    RBF(1).Ci()
Expected:
    [0.337403922900968 +/- 3.25e-16]
Got:
    [0.337403922900968 +/- 3.80e-16]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3539, in sage.rings.real_arb.RealBall.Ci
Failed example:
    RBF(Ci(1))
Expected:
    [0.337403922900968 +/- 3.25e-16]
Got:
    [0.337403922900968 +/- 3.80e-16]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3578, in sage.rings.real_arb.RealBall.Chi
Failed example:
    RBF(1).Chi()
Expected:
    [0.837866940980208 +/- 4.72e-16]
Got:
    [0.837866940980208 +/- 4.78e-16]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3583, in sage.rings.real_arb.RealBall.Chi
Failed example:
    RBF(Chi(1))
Expected:
    [0.837866940980208 +/- 4.72e-16]
Got:
    [0.837866940980208 +/- 4.78e-16]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3600, in sage.rings.real_arb.RealBall.li
Failed example:
    RBF(3).li()
Expected:
    [2.16358859466719 +/- 4.72e-15]
Got:
    [2.16358859466719 +/- 5.11e-15]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3624, in sage.rings.real_arb.RealBall.Li
Failed example:
    RBF(3).Li()
Expected:
    [1.11842481454970 +/- 7.61e-15]
Got:
    [1.11842481454970 +/- 8.00e-15]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3651, in sage.rings.real_arb.RealBall.beta
Failed example:
    RBF(sin(3)).beta(RBF(2/3).sqrt())
Expected:
    [7.407661629415 +/- 1.07e-13]
Got:
    [7.4076616294151 +/- 5.60e-14]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3653, in sage.rings.real_arb.RealBall.beta
Failed example:
    RealBallField(100)(7/2).beta(1)
Expected:
    [0.28571428571428571428571428571 +/- 5.23e-30]
Got:
    [0.28571428571428571428571428571 +/- 4.93e-30]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3688, in sage.rings.real_arb.RealBall.gamma
Failed example:
    RBF(gamma(3/2, RBF(2).sqrt()))
Expected:
    [0.37118875695353 +/- 3.00e-15]
Got:
    [0.37118875695353 +/- 3.01e-15]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3690, in sage.rings.real_arb.RealBall.gamma
Failed example:
    RBF(3/2).gamma_inc(RBF(2).sqrt())
Expected:
    [0.37118875695353 +/- 3.00e-15]
Got:
    [0.37118875695353 +/- 3.01e-15]

sage -t --random-seed=143111302483655198481928268308882618130 src/sage/symbolic/function.pyx  # 1 doctest failed
File "src/sage/symbolic/function.pyx", line 629, in sage.symbolic.function.Function._is_numerical
Failed example:
    gamma(b, 1)
Expected:
    [0.50728223 +/- 4.67e-9]
Got:
    [0.507282234 +/- 3.81e-10]
```

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (47 preceding siblings ...)
  2021-11-21  9:37 ` dkwo
@ 2021-11-21 14:00 ` tornaria
  2021-11-21 19:44 ` dkwo
                   ` (28 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-21 14:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 420 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-974822824

Comment:
Are you using system arb? There used to be some issue with rounding in `gamma_fmpq` that was fixed upstream in 2.21.1 (cf https://github.com/fredrik-johansson/arb/commit/450435a84a40acc1871cd84f1caf2ea47c11a18c)

Since sagemath is still shipping 2.19, maybe that's the reason?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (48 preceding siblings ...)
  2021-11-21 14:00 ` tornaria
@ 2021-11-21 19:44 ` dkwo
  2021-11-22 12:51 ` tornaria
                   ` (27 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-21 19:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-974882319

Comment:
I believe I'm using system `arb`.
Btw, I have a weird issue: if I build beta7, it only rebuilds sage the library, while using the rest from my system.
Wasn't the build supposed to happen in a chroot? How come it knows I have beta6 installed?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (49 preceding siblings ...)
  2021-11-21 19:44 ` dkwo
@ 2021-11-22 12:51 ` tornaria
  2021-11-22 13:17 ` [WIP] New package: sagemath-9.5.beta7 dkwo
                   ` (26 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-22 12:51 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2361 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975490505

Comment:
 Report on test failures for `sagemath-9.5.beta7_1` using all possible standard packages from system.

1. Failures due to missing documentation. These are all marked "optional - dochtml".

Solution: disable "dochtml" in the options to test so they are skipped.

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/docs/conf.py  # 1 doctest failed
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/misc/sagedoc.py  # 4 doctests failed
```

2. Problem because a new warning in pari 2.13.3

Solution: this will be fixed by https://trac.sagemath.org/ticket/32797

Patch: https://git.sagemath.org/sage.git/patch/?id=f5f7a86908daf60b25e66e6a189c51ada7e0a732

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/lfunctions/pari.py  # 1 doctest failed
```

3. Problem because libSingular is used from system

Solution: this will be fixed by https://trac.sagemath.org/ticket/32880

Patch: https://git.sagemath.org/sage.git/patch/?id=17e308fd9d56d022ed28592f93f07ec8dce530ef

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/env.py  # 1 doctest failed
```

4. Problem because giac is upgraded to 1.7.0.x

This is reported in https://trac.sagemath.org/ticket/32880

No solution yet

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/functions/min_max.py  # 2 doctests failed
```

5. Problems because arb is upgraded to 2.21

This will be fixed by https://trac.sagemath.org/ticket/32905

Note that downgrading the shared lib to arb-2.20.0_1 (without even recompiling sage) makes all of these tests to pass.

Patch: https://git.sagemath.org/sage.git/patch/?id=2ee7b99e0270f80cf03b80418372f45274f46051

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/functions/gamma.py  # 1 doctest failed
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/rings/complex_arb.pyx  # 3 doctests failed
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/rings/real_arb.pyx  # 12 doctests failed
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/symbolic/function.pyx  # 1 doctest failed
```


^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (50 preceding siblings ...)
  2021-11-22 12:51 ` tornaria
@ 2021-11-22 13:17 ` dkwo
  2021-11-22 14:30 ` [PR PATCH] [Updated] " tornaria
                   ` (25 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-22 13:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 389 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975513044

Comment:
Very well, so we are left with
```
src/sage_setup/find.py
src/sage/tests/cmdline.py
src/sage/rings/tate_algebra_ideal.pyx
```
failing, right?
Could you add `https` to distfiles and the newly added packages to makedepends, in the next iteration?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (51 preceding siblings ...)
  2021-11-22 13:17 ` [WIP] New package: sagemath-9.5.beta7 dkwo
@ 2021-11-22 14:30 ` tornaria
  2021-11-22 14:35 ` tornaria
                   ` (24 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-22 14:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta7
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 27063 bytes --]

From 0fc1a24bb0e451b7e38a19567a34917d42ac85e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 1/7] hooks: option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..c0f2198e44cf 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$_no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From 39ee86e12aae3feb374fe263d8c977d14f6c19c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 2/7] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 338692887c7186b776b192af8dcc536849cceb8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 3/7] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From 21b053172d023a556f022f632af48b5efedefb81 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 4/7] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..56166cd44272 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopt texinfo
 "
 
 # TODO: standard

From d131943a21b36a2c35b65566cf8ef82652b7574c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 14 Nov 2021 18:23:29 -0300
Subject: [PATCH 5/7] sagemath: revbump to 9.5.beta6_3 for changes

 - add depends needed for runtime and for testing
 - add python_version=3
 - disable skipping 03-rewrite-python-shebang as it seems to be harmless
   after adding python_version=3
 - fix cleaning up of $wrksrc and $_SAGE_ROOT
 - use sage-${version}_${revision} for the binary symlink; this way it
   won't override whatever sage is installed in the system so I can test
   on a live system.
---
 srcpkgs/sagemath/template | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 56166cd44272..cfe97e039974 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,19 +1,24 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=2
+revision=3
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
 make_check_target=ptest
 # for now skip building docs
 make_build_target=build
+depends="giac git FlintQS zn_poly sympow
+ pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
+ flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+python_version=3
 
 # path where sage will be installed
 _SAGE_ROOT=/usr/lib/sage-${version}
@@ -37,7 +42,8 @@ nostrip=yes
 noshlibprovides=yes
 
 # don't rewrite python shebang as sage uses its own python (for now)
-_no_python_shebang=yes
+# after python_version=3, this seems harmless... strange...
+#_no_python_shebang=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
@@ -46,9 +52,12 @@ post_extract() {
 }
 
 do_clean() {
-	# undo post_extract()
-	rm $wrksrc
-	mv $_SAGE_ROOT $wrksrc
+	rm -rf $wrksrc $_SAGE_ROOT
+}
+
+post_build() {
+	# install pytest for more tests
+	./sage -i pytest
 }
 
 do_install() {
@@ -58,7 +67,9 @@ do_install() {
 	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
 	# symlink main binary
 	vmkdir usr/bin
-	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
+	# for now use sage-${version}_${revision} so it doesn't override
+	# other sage installed in the system
+	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
 ### copied from sage-deps, to be kept in sync

From 0b68044a2f53c384e07956484b673b8a5ef876b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 20 Nov 2021 19:01:21 -0300
Subject: [PATCH 6/7] sagemath: update to 9.5.beta7.

---
 srcpkgs/sagemath/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index cfe97e039974..3f9a3e9e077f 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
-version=9.5.beta6
-revision=3
+version=9.5.beta7
+revision=1
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -17,7 +17,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
 # path where sage will be installed

From 7dcff791d4a6eccd8584ea713f56346f84661fcc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 10:23:03 -0300
Subject: [PATCH 7/7] sagemath: add more dependencies

Also:
 - add patches so more doctests pass
 - add do_check() to skip building docs
 - use https for distfiles
---
 ...08fd9d56d022ed28592f93f07ec8dce530ef.patch |  49 ++++++
 ...b99e0270f80cf03b80418372f45274f46051.patch | 163 ++++++++++++++++++
 ...a86908daf60b25e66e6a189c51ada7e0a732.patch |  25 +++
 .../patches/skip-optional-dochtml.patch       |  13 ++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 260 insertions(+), 5 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
 create mode 100644 srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
 create mode 100644 srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
 create mode 100644 srcpkgs/sagemath/patches/skip-optional-dochtml.patch

diff --git a/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
new file mode 100644
index 000000000000..e295bb91af5b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
@@ -0,0 +1,49 @@
+From 17e308fd9d56d022ed28592f93f07ec8dce530ef Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Mon, 15 Nov 2021 23:37:15 -0500
+Subject: Trac #32880: use GAP instead of Singular to test
+ _get_shared_lib_path().
+
+We still have a doctest for _get_shared_lib_path() that tries to find
+the path to libSingular; however, we no longer actually need it to
+find libSingular because the path to libSingular is contained in
+LIBSINGULAR_PATH.
+
+Since _get_shared_lib_path() is a bit fragile, this commit replaces
+that test case with one for libgap, which is still always installed
+via SPKG and for which we still need _get_shared_lib_path() to be able
+to find the path.
+---
+ src/sage/env.py | 12 ++----------
+ 1 file changed, 2 insertions(+), 10 deletions(-)
+
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 40ace13..3bd4826 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -267,20 +267,12 @@ def _get_shared_lib_path(*libnames: str) -> Optional[str]:
+ 
+     EXAMPLES::
+ 
+-        sage: import sys
+-        sage: from fnmatch import fnmatch
+         sage: from sage.env import _get_shared_lib_path
+-        sage: lib_filename = _get_shared_lib_path("Singular", "singular-Singular")
+-        sage: if sys.platform == 'cygwin':
+-        ....:     pattern = "*/cygSingular-*.dll"
+-        ....: elif sys.platform == 'darwin':
+-        ....:     pattern = "*/libSingular-*.dylib"
+-        ....: else:
+-        ....:     pattern = "*/lib*Singular-*.so"
+-        sage: fnmatch(str(lib_filename), pattern)
++        sage: "gap" in _get_shared_lib_path("gap")
+         True
+         sage: _get_shared_lib_path("an_absurd_lib") is None
+         True
++
+     """
+ 
+     for libname in libnames:
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
new file mode 100644
index 000000000000..32e641edb3aa
--- /dev/null
+++ b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
@@ -0,0 +1,163 @@
+From 2ee7b99e0270f80cf03b80418372f45274f46051 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Samuel=20Leli=C3=A8vre?= <samuel.lelievre@gmail.com>
+Date: Sat, 20 Nov 2021 13:34:16 +0100
+Subject: 32905: abs tol for some CBF and RBF doctests
+
+---
+ src/sage/functions/gamma.py    |  2 +-
+ src/sage/rings/complex_arb.pyx |  6 +++---
+ src/sage/rings/real_arb.pyx    | 24 ++++++++++++------------
+ src/sage/symbolic/function.pyx |  2 +-
+ 4 files changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/src/sage/functions/gamma.py b/src/sage/functions/gamma.py
+index 3a4deef..307deb1 100644
+--- a/src/sage/functions/gamma.py
++++ b/src/sage/functions/gamma.py
+@@ -1049,7 +1049,7 @@ class Function_beta(GinacFunction):
+         r"""
+         TESTS::
+ 
+-            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))
++            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))  # abs tol 6e-7
+             [7.407662 +/- 6.17e-7]
+         """
+         return [x, y]
+diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx
+index ce9b1b1..7e10ec9 100644
+--- a/src/sage/rings/complex_arb.pyx
++++ b/src/sage/rings/complex_arb.pyx
+@@ -4189,7 +4189,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ei(I))
++            sage: CBF(Ei(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.76e-16] + [2.51687939716208 +/- 2.01e-15]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4239,7 +4239,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ci(I))
++            sage: CBF(Ci(I))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4291,7 +4291,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Chi(I))
++            sage: CBF(Chi(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx
+index 80a840e..49caa63 100644
+--- a/src/sage/rings/real_arb.pyx
++++ b/src/sage/rings/real_arb.pyx
+@@ -3489,12 +3489,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ei()
++            sage: RBF(1).Ei()  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ei(1))
++            sage: RBF(Ei(1))  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3531,12 +3531,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ci()
++            sage: RBF(1).Ci()  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ci(1))
++            sage: RBF(Ci(1))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3575,12 +3575,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Chi()
++            sage: RBF(1).Chi()  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Chi(1))
++            sage: RBF(Chi(1))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3597,7 +3597,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).li()
++            sage: RBF(3).li()  # abs tol 1e-15
+             [2.16358859466719 +/- 4.72e-15]
+ 
+         TESTS::
+@@ -3621,7 +3621,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).Li()
++            sage: RBF(3).Li()  # abs tol 1e-15
+             [1.11842481454970 +/- 7.61e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3648,9 +3648,9 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())
++            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())  # abs tol 1e-13
+             [7.407661629415 +/- 1.07e-13]
+-            sage: RealBallField(100)(7/2).beta(1)
++            sage: RealBallField(100)(7/2).beta(1)  # abs tol 1e-30
+             [0.28571428571428571428571428571 +/- 5.23e-30]
+             sage: RealBallField(100)(7/2).beta(1, 1/2)
+             [0.025253813613805268728601584361 +/- 2.53e-31]
+@@ -3685,9 +3685,9 @@ cdef class RealBall(RingElement):
+ 
+             sage: RBF(1/2).gamma()
+             [1.772453850905516 +/- ...e-16]
+-            sage: RBF(gamma(3/2, RBF(2).sqrt()))
++            sage: RBF(gamma(3/2, RBF(2).sqrt()))  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+-            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())
++            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+ 
+         .. SEEALSO::
+diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx
+index 89cdce5..480a601 100644
+--- a/src/sage/symbolic/function.pyx
++++ b/src/sage/symbolic/function.pyx
+@@ -626,7 +626,7 @@ cdef class Function(SageObject):
+             sage: b = RBF(3/2, 1e-10)
+             sage: airy_ai(b)
+             airy_ai([1.500000000 +/- 1.01e-10])
+-            sage: gamma(b, 1)
++            sage: gamma(b, 1)  # abs tol 4.5e-9
+             [0.50728223 +/- 4.67e-9]
+             sage: hurwitz_zeta(b, b)
+             hurwitz_zeta([1.500000000 +/- 1.01e-10], [1.500000000 +/- 1.01e-10])
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
new file mode 100644
index 000000000000..ec0467757ee7
--- /dev/null
+++ b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
@@ -0,0 +1,25 @@
+From f5f7a86908daf60b25e66e6a189c51ada7e0a732 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sat, 30 Oct 2021 10:21:52 +0200
+Subject: Fix test failure caused by new warning
+
+---
+ src/sage/lfunctions/pari.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py
+index 0aaf91c..33d5266 100644
+--- a/src/sage/lfunctions/pari.py
++++ b/src/sage/lfunctions/pari.py
+@@ -316,7 +316,7 @@ def lfun_number_field(K):
+         sage: L(3)
+         1.15202784126080
+         sage: L(0)
+-        0.000000000000000
++        ...0.000000000000000
+     """
+     return pari.lfuncreate(K)
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/skip-optional-dochtml.patch b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
new file mode 100644
index 000000000000..e49b18a52fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
@@ -0,0 +1,13 @@
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 288c889bd1..b9a4d3038a 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -15,7 +15,7 @@ os.environ['SAGE_STARTUP_FILE'] = os.path.join(DOT_SAGE, 'init-doctests.sage')
+ 
+ def _get_optional_defaults():
+     """Return the default value for the --optional flag."""
+-    optional = ['sage', 'dochtml', 'optional']
++    optional = ['sage', 'optional']
+ 
+     # This should be good-enough to determine if we are in a sage source
+     # repository working tree
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 3f9a3e9e077f..d4130be12a7a 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -16,7 +16,7 @@ short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
-distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+distfiles="https://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
@@ -47,6 +47,7 @@ noshlibprovides=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
+	rm -rf $_SAGE_ROOT
 	mv -T $wrksrc $_SAGE_ROOT
 	ln -sfT $_SAGE_ROOT $wrksrc
 }
@@ -72,6 +73,11 @@ do_install() {
 	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
+do_check() {
+	# since make check will build the docs, run test like this instead
+	./sage -tp ${XBPS_MAKEJOBS} --all
+}
+
 ### copied from sage-deps, to be kept in sync
 
 # hard dependencies
@@ -103,10 +109,9 @@ makedepends+="
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
  gengetopt texinfo
+ brial-devel cliquer-devel gfan libbraiding-devel libhomfly-devel
+ lrcalc-devel nauty-devel palp tachyon
 "
 
-# TODO: standard
-# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
-
 # TODO: optional
-# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
+# 4ti2 coxeter3 libsemigroups lrslib pdf2svg perl_mongodb polymake

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (52 preceding siblings ...)
  2021-11-22 14:30 ` [PR PATCH] [Updated] " tornaria
@ 2021-11-22 14:35 ` tornaria
  2021-11-22 14:55 ` tornaria
                   ` (23 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-22 14:35 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 607 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975591928

Comment:
New version:
 - add more dependencies
 - add patches so more doctests pass
 - add do_check() to skip building docs
 - use https for distfiles

With this, the only expected doctest failures are the 2 in `src/sage/functions/min_max.py` which seem to be caused by the upgrade to giac-1.7.0 and are reported upstream at https://trac.sagemath.org/ticket/32880 with no fix so far.

The main thing now is to see if this can be made to work with system python 3.10.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (53 preceding siblings ...)
  2021-11-22 14:35 ` tornaria
@ 2021-11-22 14:55 ` tornaria
  2021-11-22 15:22 ` tornaria
                   ` (22 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-22 14:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 438 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975609798

Comment:
> ```
> src/sage_setup/find.py
> src/sage/tests/cmdline.py
> src/sage/rings/tate_algebra_ideal.pyx
> ```

I get the failure in `cmdline.py` when running tests inside the xbps-src chroot, but not when running outside.

As for the other two, I've never seen them. Are they on musl or glibc?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (54 preceding siblings ...)
  2021-11-22 14:55 ` tornaria
@ 2021-11-22 15:22 ` tornaria
  2021-11-22 15:30 ` dkwo
                   ` (21 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-22 15:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975637205

Comment:
The failures in `cmdline.py` are because we installed pytest... If we don't, then this failures go away.

The second one should go away after https://trac.sagemath.org/ticket/32892. The first one, I don't know.

We could workaround it by not installing pytest in post_build()...



^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (55 preceding siblings ...)
  2021-11-22 15:22 ` tornaria
@ 2021-11-22 15:30 ` dkwo
  2021-11-22 15:30 ` dkwo
                   ` (20 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-22 15:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 737 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975643915

Comment:
They are on glibc.
Does `sage-9.5.beta7_1 -t --warn-long 35.7 --random-seed=327098103431076596046796804314805549386 /usr/lib/sage-9.5.beta7/src/sage/rings/tate_algebra_ideal.pyx` pass for you (outside of chroot, just in the terminal)?
Same for `sage-9.5.beta7_1 -t --random-seed=2922128458579573960176688891507420022 /usr/lib/sage-9.5.beta7/src/sage_setup/find.py` ?
Btw, I now have
```
$ ls /usr/lib/sage-9.5.beta
sage-9.5.beta5/ sage-9.5.beta6/ sage-9.5.beta7/
```
even after removing `sage` via xbps-remove. Should I remove those by hand?
I thought we added `pytest` to have more tests..

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (56 preceding siblings ...)
  2021-11-22 15:30 ` dkwo
@ 2021-11-22 15:30 ` dkwo
  2021-11-22 15:41 ` dkwo
                   ` (19 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-22 15:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975643915

Comment:
They are on glibc.
Does `sage-9.5.beta7_1 -t --warn-long 35.7 --random-seed=327098103431076596046796804314805549386 /usr/lib/sage-9.5.beta7/src/sage/rings/tate_algebra_ideal.pyx` pass for you (outside of chroot, just in the terminal)?
Same for `sage-9.5.beta7_1 -t --random-seed=2922128458579573960176688891507420022 /usr/lib/sage-9.5.beta7/src/sage_setup/find.py` ?
Btw, I now have
```
$ ls /usr/lib/sage-9.5.beta
sage-9.5.beta5/ sage-9.5.beta6/ sage-9.5.beta7/
```
even after removing `sagemath` via xbps-remove. Should I remove those by hand?
I thought we added `pytest` to have more tests..

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (57 preceding siblings ...)
  2021-11-22 15:30 ` dkwo
@ 2021-11-22 15:41 ` dkwo
  2021-11-22 16:30 ` dkwo
                   ` (18 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-22 15:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 340 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975655162

Comment:
Anyhow, great work.
Now that we run tests in the chroot, shall we trim down the `depends` and what is actually installed?
I guess `giac` was needed there, but not all `devel` stuff (just to run sage).

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (58 preceding siblings ...)
  2021-11-22 15:41 ` dkwo
@ 2021-11-22 16:30 ` dkwo
  2021-11-22 16:35 ` tornaria
                   ` (17 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-22 16:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 275 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975701012

Comment:
Ok, I stand corrected: if run from inside the chroot, both `src/sage/rings/tate_algebra_ideal.pyx` and `src/sage_setup/find.py` now pass.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (59 preceding siblings ...)
  2021-11-22 16:30 ` dkwo
@ 2021-11-22 16:35 ` tornaria
  2021-11-22 17:09 ` dkwo
                   ` (16 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-22 16:35 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1584 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975706551

Comment:
With that particular random-seed it fails every time:
```
$ ./sage -t --random-seed=327098103431076596046796804314805549386 src/sage/rings/tate_algebra_ideal.pyx 
Running doctests with ID 2021-11-22-13-31-59-591c1eef.
Git branch: develop
Using --optional=build,pip,sage,sage.geometry.polyhedron,sage.rings.real_double,sage_spkg,void
Doctesting 1 file.
sage -t --warn-long 36.3 --random-seed=327098103431076596046796804314805549386 src/sage/rings/tate_algebra_ideal.pyx
**********************************************************************
File "src/sage/rings/tate_algebra_ideal.pyx", line 198, in sage.rings.tate_algebra_ideal.TateAlgebraIdeal._contains_
Failed example:
    I.random_element() in I
Expected:
    True
Got:
    False
**********************************************************************
```

The second one I can't reproduce:
```
$ ./sage -t --random-seed=2922128458579573960176688891507420022 src/sage_setup/find.py
Running doctests with ID 2021-11-22-13-33-39-21d4fa99.
Git branch: develop
Using --optional=build,pip,sage,sage.geometry.polyhedron,sage.rings.real_double,sage_spkg,void
Doctesting 1 file.
sage -t --warn-long 36.3 --random-seed=2922128458579573960176688891507420022 src/sage_setup/find.py
    [45 tests, 0.63 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------
```

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (60 preceding siblings ...)
  2021-11-22 16:35 ` tornaria
@ 2021-11-22 17:09 ` dkwo
  2021-11-22 17:28 ` tornaria
                   ` (15 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-22 17:09 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 6740 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975739343

Comment:
Are these intentional?
`Shebang converted to '#!/usr/bin/python3': /usr/lib/sage-9.5.beta7/src/setup.py`

As for the second, it still fails for me _outside_ of chroot, but perhaps it is just missing stuff.
```
[nicolo@mabragor ~]$ sage-9.5.beta7_1 -t --random-seed=2922128458579573960176688891507420022 /usr/lib/sage-9.5.beta7/src/sage_setup/find
.py
Running doctests with ID 2021-11-22-18-06-28-7269724d.
Git branch: develop
Using --optional=build,pip,sage,sage.geometry.polyhedron,sage.rings.real_double,sage_spkg,void
Doctesting 1 file.
sage -t --warn-long 42.8 --random-seed=2922128458579573960176688891507420022 /usr/lib/sage-9.5.beta7/src/sage_setup/find.py
**********************************************************************
File "/usr/lib/sage-9.5.beta7/src/sage_setup/find.py", line 303, in sage_setup.find.find_extra_files
Failed example:
    extras["sage/ext/interpreters"]
Expected:
    ['.../src/sage/ext/interpreters/wrapper_cdf.pxd', ...wrapper_cdf.h...]
Got:
    ['/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_rr.pxd',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_cdf.pyx',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_cc.pyx',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_rdf.pyx',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_rdf.pxd',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_py.pyx',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_cc.pxd',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_py.pxd',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_cdf.pxd',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_rr.pyx',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_el.pxd',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_el.pyx']
**********************************************************************
File "/usr/lib/sage-9.5.beta7/src/sage_setup/find.py", line 364, in sage_setup.find.installed_files_by_module
Failed example:
    (f1, f2) = sorted(files_by_module['sage.structure'])
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/doctest/forker.py", line 694, i
n _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/doctest/forker.py", line 1088,
in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage_setup.find.installed_files_by_module[5]>", line 1, in <module>
        (f1, f2) = sorted(files_by_module['sage.structure'])
    ValueError: not enough values to unpack (expected 2, got 1)
**********************************************************************
File "/usr/lib/sage-9.5.beta7/src/sage_setup/find.py", line 365, in sage_setup.find.installed_files_by_module
Failed example:
    f1
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/doctest/forker.py", line 694, i
n _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/doctest/forker.py", line 1088,
in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage_setup.find.installed_files_by_module[6]>", line 1, in <module>
        f1
    NameError: name 'f1' is not defined
**********************************************************************
File "/usr/lib/sage-9.5.beta7/src/sage_setup/find.py", line 367, in sage_setup.find.installed_files_by_module
Failed example:
    f2
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/doctest/forker.py", line 694, i
n _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/doctest/forker.py", line 1088,
in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage_setup.find.installed_files_by_module[7]>", line 1, in <module>
        f2
    NameError: name 'f2' is not defined
**********************************************************************
**********************************************************************
2 items had failures:
   1 of   7 in sage_setup.find.find_extra_files
   3 of  10 in sage_setup.find.installed_files_by_module
    [45 tests, 4 failures, 0.54 s]
----------------------------------------------------------------------
sage -t --warn-long 42.8 --random-seed=2922128458579573960176688891507420022 /usr/lib/sage-9.5.beta7/src/sage_setup/find.py  # 4 doctest
s failed
----------------------------------------------------------------------
Total time for all tests: 0.6 seconds
    cpu time: 0.5 seconds
    cumulative wall time: 0.5 seconds
========================================================= test session starts ==========================================================
platform linux -- Python 3.9.7, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
rootdir: /usr/lib/sage-9.5.beta7/src, configfile: tox.ini
collected 0 items

=========================================================== warnings summary ===========================================================
../../usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/_pytest/cacheprovider.py:428
  /usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/_pytest/cacheprovider.py:428: PytestCacheWarni
ng: cache could not write path /usr/lib/sage-9.5.beta7/src/.pytest_cache/v/cache/nodeids
    config.cache.set("cache/nodeids", sorted(self.cached_nodeids))

../../usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/_pytest/stepwise.py:49
  /usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/_pytest/stepwise.py:49: PytestCacheWarning: ca
che could not write path /usr/lib/sage-9.5.beta7/src/.pytest_cache/v/cache/stepwise
    session.config.cache.set(STEPWISE_CACHE_DIR, [])

-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================= 2 warnings in 0.00s ==========================================================
```

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (61 preceding siblings ...)
  2021-11-22 17:09 ` dkwo
@ 2021-11-22 17:28 ` tornaria
  2021-11-22 17:52 ` dkwo
                   ` (14 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-22 17:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2377 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975490505

Comment:
 Report on test failures for `sagemath-9.5.beta7_1` using all possible standard packages from system.

1. Failures due to missing documentation. These are all marked "optional - dochtml".

Solution: disable "dochtml" in the options to test so they are skipped.

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/docs/conf.py  # 1 doctest failed
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/misc/sagedoc.py  # 4 doctests failed
```

2. Problem because a new warning in pari 2.13.3

Solution: this will be fixed by https://trac.sagemath.org/ticket/32797

Patch: https://git.sagemath.org/sage.git/patch/?id=f5f7a86908daf60b25e66e6a189c51ada7e0a732

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/lfunctions/pari.py  # 1 doctest failed
```

3. Problem because libSingular is used from system

Solution: this will be fixed by https://trac.sagemath.org/ticket/32880

Patch: https://git.sagemath.org/sage.git/patch/?id=17e308fd9d56d022ed28592f93f07ec8dce530ef

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/env.py  # 1 doctest failed
```

4. Problem because giac is upgraded to 1.7.0.x

This is reported in https://trac.sagemath.org/ticket/31563
No solution yet

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/functions/min_max.py  # 2 doctests failed
```

5. Problems because arb is upgraded to 2.21

This will be fixed by https://trac.sagemath.org/ticket/32905

Note that downgrading the shared lib to arb-2.20.0_1 (without even recompiling sage) makes all of these tests to pass.

Patch: https://git.sagemath.org/sage.git/patch/?id=2ee7b99e0270f80cf03b80418372f45274f46051

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/functions/gamma.py  # 1 doctest failed
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/rings/complex_arb.pyx  # 3 doctests failed
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/rings/real_arb.pyx  # 12 doctests failed
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/symbolic/function.pyx  # 1 doctest failed
```

EDIT: fix a link

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (62 preceding siblings ...)
  2021-11-22 17:28 ` tornaria
@ 2021-11-22 17:52 ` dkwo
  2021-11-22 23:41 ` tornaria
                   ` (13 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-22 17:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 648 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975775712

Comment:
Also, it would be useful to have a symlink so that sage can be used from jupyterlab.
Arch does it like that:
```
# fix symlinks to assets
  _pythonpath=`python -c "from sysconfig import get_path; print(get_path('platlib'))"`
  for _i in $(ls "$srcdir"/sage-$pkgver/src/sage/ext_data/notebook-ipython); do
    rm "$pkgdir"/usr/share/jupyter/kernels/sagemath/$_i
    ln -s $_pythonpath/sage/ext_data/notebook-ipython/$_i "$pkgdir"/usr/share/jupyter/kernels/sagemath/
  done
```
I'll look into it later.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (63 preceding siblings ...)
  2021-11-22 17:52 ` dkwo
@ 2021-11-22 23:41 ` tornaria
  2021-11-23  3:22 ` [PR PATCH] [Updated] " tornaria
                   ` (12 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-22 23:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 3749 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-976010587

Comment:
Doctest failures in `x86_64-musl`:
```
----------------------------------------------------------------------
sage -t --random-seed=263343733075529654576520741661576957914 src/sage/functions/min_max.py  # 2 doctests failed
sage -t --random-seed=263343733075529654576520741661576957914 src/sage/tests/cmdline.py  # 1 doctest failed
sage -t --random-seed=263343733075529654576520741661576957914 src/sage/lfunctions/sympow.py  # 3 doctests failed
sage -t --random-seed=263343733075529654576520741661576957914 src/sage/misc/gperftools.py  # 1 doctest failed
----------------------------------------------------------------------
```

The first two are just the same as in glibc. The second one is actually fixed by just not installing pytest which I'll do in the next commit.

The third one is
```
sage -t --random-seed=263343733075529654576520741661576957914 src/sage/lfunctions/sympow.py
**********************************************************************
File "src/sage/lfunctions/sympow.py", line 279, in sage.lfunctions.sympow.Sympow.analytic_rank
Failed example:
    sympow.analytic_rank(EllipticCurve('389a'))
Expected:
    (2, '7.59317e-01')
Got:
    (2, '7.59316e-01')
**********************************************************************
File "src/sage/lfunctions/sympow.py", line 281, in sage.lfunctions.sympow.Sympow.analytic_rank
Failed example:
    sympow.analytic_rank(EllipticCurve('5077a'))
Expected:
    (3, '1.73185e+00')
Got:
    (3, '1.73184e+00')
**********************************************************************
File "src/sage/lfunctions/sympow.py", line 283, in sage.lfunctions.sympow.Sympow.analytic_rank
Failed example:
    sympow.analytic_rank(EllipticCurve([1, -1, 0, -79, 289]))
Expected:
    (4, '8.94385e+00')
Got:
    (4, '8.94384e+00')
**********************************************************************
1 item had failures:
   3 of   6 in sage.lfunctions.sympow.Sympow.analytic_rank
    [10 tests, 3 failures, 0.90 s]
```
Seems like a mishandling of fpu control words in sympow that affects musl printing routines (I doubt is anything more than printing since all is computed at least to double precision which is ~18 digits it would be unexpected to get a difference in the 6th decimal place).

The last one is
```
sage -t --random-seed=263343733075529654576520741661576957914 src/sage/misc/gperftools.py
**********************************************************************
File "src/sage/misc/gperftools.py", line 118, in sage.misc.gperftools.Profiler._libc
Failed example:
    Profiler()._libc()
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/doctest/forker.py", line 694, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/doctest/forker.py", line 1088, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.misc.gperftools.Profiler._libc[1]>", line 1, in <module>
        Profiler()._libc()
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/misc/gperftools.py", line 129, in _libc
        raise ImportError('failed to open libc')
    ImportError: failed to open libc
**********************************************************************
1 item had failures:
   1 of   3 in sage.misc.gperftools.Profiler._libc
    [35 tests, 1 failure, 0.89 s]
```
I'll look into it.


^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (64 preceding siblings ...)
  2021-11-22 23:41 ` tornaria
@ 2021-11-23  3:22 ` tornaria
  2021-11-23  3:25 ` tornaria
                   ` (11 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-23  3:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta7
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 42178 bytes --]

From e483ed0e729742ec8eb83eb81d0f7007ad95708e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 19:24:50 -0300
Subject: [PATCH 1/9] sympow: do not mess with fpu control word

It turns out doing that on musl results in wrong output for doubles.
Moreover any cpu with sse2 should not be using fp registers anyway.

For i686 without sse, the configure will figure out that floats are
80 bits and add -ffloat-store to CFLAGS to force them to be 64 bits.

A simple way to test it is to run

    $ sympow -curve '[0,0,0,0,1]' -analrank
    ...
    Analytic Rank is 0 : L-value 7.01091e-01

When broken this prints "7.01092e-01" instead.

The actual value computed to 128 bits with pari is:

    $ echo 'elllseries(ellinit([0,0,0,0,1]),1)' | gp -q
    0.70109105266272713058750953952514706773

so the glibc output is the correct one.

What is broken is not computing but printing, as fmt_fp in musl uses
long double, which means messing with fpu control word breaks it.
This is important since sagemath parses sympow output.

This affects sagemath doctests as in

    $ sage -t src/sage/lfunctions/sympow.py
    ...
    (3 failures)

After this commit, the doctest in question passes.
---
 .../patches/dont-change-fpu-control-word.patch   | 16 ++++++++++++++++
 srcpkgs/sympow/template                          |  2 +-
 2 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/sympow/patches/dont-change-fpu-control-word.patch

diff --git a/srcpkgs/sympow/patches/dont-change-fpu-control-word.patch b/srcpkgs/sympow/patches/dont-change-fpu-control-word.patch
new file mode 100644
index 000000000000..2a1155111268
--- /dev/null
+++ b/srcpkgs/sympow/patches/dont-change-fpu-control-word.patch
@@ -0,0 +1,16 @@
+--- a/Configure	2021-11-22 22:20:42.512565997 -0300
++++ b/Configure	2021-11-22 23:10:09.986457874 -0300
+@@ -154,9 +154,10 @@
+ done
+ 
+ # Select the most appropriate FPU control scheme
+-for FLAG in '-DISOC99_FENV' '-DFPUCONTROLH' '-Dx86'; do
+-    try_add_CFLAG $FLAG && break
+-done
++## disable messing with fpu control word -- not worth it
++# for FLAG in '-DISOC99_FENV' '-DFPUCONTROLH' '-Dx86'; do
++#     try_add_CFLAG $FLAG && break
++# done
+ 
+ # Some flags to try as last resort.  These hurt performance, so only add
+ # them if needed.
diff --git a/srcpkgs/sympow/template b/srcpkgs/sympow/template
index d484cf847f57..48e2399b72e3 100644
--- a/srcpkgs/sympow/template
+++ b/srcpkgs/sympow/template
@@ -1,7 +1,7 @@
 # Template file for 'sympow'
 pkgname=sympow
 version=2.023.6
-revision=2
+revision=3
 wrksrc=${pkgname}-v${version}
 build_style=configure
 make_build_target=all

From 6b25dfcb8e39077d1283daa31e621c1ac8227454 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 2/9] hooks: option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..c0f2198e44cf 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$_no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From 0962da75c6bb03ae4757480178a1949f3457c41b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 3/9] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 7cfead0840766a381c15e94e194645dbeb8df255 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 4/9] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From 63c3e5960b171bdea8a63c08251f904307128c06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 5/9] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..56166cd44272 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopt texinfo
 "
 
 # TODO: standard

From 6d80881d35949067e13d1b1c8f77525ead03cd00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 14 Nov 2021 18:23:29 -0300
Subject: [PATCH 6/9] sagemath: revbump to 9.5.beta6_3 for changes

 - add depends needed for runtime and for testing
 - add python_version=3
 - disable skipping 03-rewrite-python-shebang as it seems to be harmless
   after adding python_version=3
 - fix cleaning up of $wrksrc and $_SAGE_ROOT
 - use sage-${version}_${revision} for the binary symlink; this way it
   won't override whatever sage is installed in the system so I can test
   on a live system.
---
 srcpkgs/sagemath/template | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 56166cd44272..cfe97e039974 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,19 +1,24 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=2
+revision=3
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
 make_check_target=ptest
 # for now skip building docs
 make_build_target=build
+depends="giac git FlintQS zn_poly sympow
+ pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
+ flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+python_version=3
 
 # path where sage will be installed
 _SAGE_ROOT=/usr/lib/sage-${version}
@@ -37,7 +42,8 @@ nostrip=yes
 noshlibprovides=yes
 
 # don't rewrite python shebang as sage uses its own python (for now)
-_no_python_shebang=yes
+# after python_version=3, this seems harmless... strange...
+#_no_python_shebang=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
@@ -46,9 +52,12 @@ post_extract() {
 }
 
 do_clean() {
-	# undo post_extract()
-	rm $wrksrc
-	mv $_SAGE_ROOT $wrksrc
+	rm -rf $wrksrc $_SAGE_ROOT
+}
+
+post_build() {
+	# install pytest for more tests
+	./sage -i pytest
 }
 
 do_install() {
@@ -58,7 +67,9 @@ do_install() {
 	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
 	# symlink main binary
 	vmkdir usr/bin
-	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
+	# for now use sage-${version}_${revision} so it doesn't override
+	# other sage installed in the system
+	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
 ### copied from sage-deps, to be kept in sync

From 442e3dfd448344ce1843b68417367a975f2bfc94 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 20 Nov 2021 19:01:21 -0300
Subject: [PATCH 7/9] sagemath: update to 9.5.beta7.

---
 srcpkgs/sagemath/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index cfe97e039974..3f9a3e9e077f 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
-version=9.5.beta6
-revision=3
+version=9.5.beta7
+revision=1
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -17,7 +17,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
 # path where sage will be installed

From f165af50129b01e61b67c57659aa2af0d21e897b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 10:23:03 -0300
Subject: [PATCH 8/9] sagemath: add more dependencies

Also:
 - add patches so more doctests pass
 - add do_check() to skip building docs
 - use https for distfiles
---
 ...08fd9d56d022ed28592f93f07ec8dce530ef.patch |  49 ++++++
 ...b99e0270f80cf03b80418372f45274f46051.patch | 163 ++++++++++++++++++
 ...a86908daf60b25e66e6a189c51ada7e0a732.patch |  25 +++
 .../patches/skip-optional-dochtml.patch       |  13 ++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 260 insertions(+), 5 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
 create mode 100644 srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
 create mode 100644 srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
 create mode 100644 srcpkgs/sagemath/patches/skip-optional-dochtml.patch

diff --git a/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
new file mode 100644
index 000000000000..e295bb91af5b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
@@ -0,0 +1,49 @@
+From 17e308fd9d56d022ed28592f93f07ec8dce530ef Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Mon, 15 Nov 2021 23:37:15 -0500
+Subject: Trac #32880: use GAP instead of Singular to test
+ _get_shared_lib_path().
+
+We still have a doctest for _get_shared_lib_path() that tries to find
+the path to libSingular; however, we no longer actually need it to
+find libSingular because the path to libSingular is contained in
+LIBSINGULAR_PATH.
+
+Since _get_shared_lib_path() is a bit fragile, this commit replaces
+that test case with one for libgap, which is still always installed
+via SPKG and for which we still need _get_shared_lib_path() to be able
+to find the path.
+---
+ src/sage/env.py | 12 ++----------
+ 1 file changed, 2 insertions(+), 10 deletions(-)
+
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 40ace13..3bd4826 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -267,20 +267,12 @@ def _get_shared_lib_path(*libnames: str) -> Optional[str]:
+ 
+     EXAMPLES::
+ 
+-        sage: import sys
+-        sage: from fnmatch import fnmatch
+         sage: from sage.env import _get_shared_lib_path
+-        sage: lib_filename = _get_shared_lib_path("Singular", "singular-Singular")
+-        sage: if sys.platform == 'cygwin':
+-        ....:     pattern = "*/cygSingular-*.dll"
+-        ....: elif sys.platform == 'darwin':
+-        ....:     pattern = "*/libSingular-*.dylib"
+-        ....: else:
+-        ....:     pattern = "*/lib*Singular-*.so"
+-        sage: fnmatch(str(lib_filename), pattern)
++        sage: "gap" in _get_shared_lib_path("gap")
+         True
+         sage: _get_shared_lib_path("an_absurd_lib") is None
+         True
++
+     """
+ 
+     for libname in libnames:
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
new file mode 100644
index 000000000000..32e641edb3aa
--- /dev/null
+++ b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
@@ -0,0 +1,163 @@
+From 2ee7b99e0270f80cf03b80418372f45274f46051 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Samuel=20Leli=C3=A8vre?= <samuel.lelievre@gmail.com>
+Date: Sat, 20 Nov 2021 13:34:16 +0100
+Subject: 32905: abs tol for some CBF and RBF doctests
+
+---
+ src/sage/functions/gamma.py    |  2 +-
+ src/sage/rings/complex_arb.pyx |  6 +++---
+ src/sage/rings/real_arb.pyx    | 24 ++++++++++++------------
+ src/sage/symbolic/function.pyx |  2 +-
+ 4 files changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/src/sage/functions/gamma.py b/src/sage/functions/gamma.py
+index 3a4deef..307deb1 100644
+--- a/src/sage/functions/gamma.py
++++ b/src/sage/functions/gamma.py
+@@ -1049,7 +1049,7 @@ class Function_beta(GinacFunction):
+         r"""
+         TESTS::
+ 
+-            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))
++            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))  # abs tol 6e-7
+             [7.407662 +/- 6.17e-7]
+         """
+         return [x, y]
+diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx
+index ce9b1b1..7e10ec9 100644
+--- a/src/sage/rings/complex_arb.pyx
++++ b/src/sage/rings/complex_arb.pyx
+@@ -4189,7 +4189,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ei(I))
++            sage: CBF(Ei(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.76e-16] + [2.51687939716208 +/- 2.01e-15]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4239,7 +4239,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ci(I))
++            sage: CBF(Ci(I))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4291,7 +4291,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Chi(I))
++            sage: CBF(Chi(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx
+index 80a840e..49caa63 100644
+--- a/src/sage/rings/real_arb.pyx
++++ b/src/sage/rings/real_arb.pyx
+@@ -3489,12 +3489,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ei()
++            sage: RBF(1).Ei()  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ei(1))
++            sage: RBF(Ei(1))  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3531,12 +3531,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ci()
++            sage: RBF(1).Ci()  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ci(1))
++            sage: RBF(Ci(1))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3575,12 +3575,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Chi()
++            sage: RBF(1).Chi()  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Chi(1))
++            sage: RBF(Chi(1))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3597,7 +3597,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).li()
++            sage: RBF(3).li()  # abs tol 1e-15
+             [2.16358859466719 +/- 4.72e-15]
+ 
+         TESTS::
+@@ -3621,7 +3621,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).Li()
++            sage: RBF(3).Li()  # abs tol 1e-15
+             [1.11842481454970 +/- 7.61e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3648,9 +3648,9 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())
++            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())  # abs tol 1e-13
+             [7.407661629415 +/- 1.07e-13]
+-            sage: RealBallField(100)(7/2).beta(1)
++            sage: RealBallField(100)(7/2).beta(1)  # abs tol 1e-30
+             [0.28571428571428571428571428571 +/- 5.23e-30]
+             sage: RealBallField(100)(7/2).beta(1, 1/2)
+             [0.025253813613805268728601584361 +/- 2.53e-31]
+@@ -3685,9 +3685,9 @@ cdef class RealBall(RingElement):
+ 
+             sage: RBF(1/2).gamma()
+             [1.772453850905516 +/- ...e-16]
+-            sage: RBF(gamma(3/2, RBF(2).sqrt()))
++            sage: RBF(gamma(3/2, RBF(2).sqrt()))  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+-            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())
++            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+ 
+         .. SEEALSO::
+diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx
+index 89cdce5..480a601 100644
+--- a/src/sage/symbolic/function.pyx
++++ b/src/sage/symbolic/function.pyx
+@@ -626,7 +626,7 @@ cdef class Function(SageObject):
+             sage: b = RBF(3/2, 1e-10)
+             sage: airy_ai(b)
+             airy_ai([1.500000000 +/- 1.01e-10])
+-            sage: gamma(b, 1)
++            sage: gamma(b, 1)  # abs tol 4.5e-9
+             [0.50728223 +/- 4.67e-9]
+             sage: hurwitz_zeta(b, b)
+             hurwitz_zeta([1.500000000 +/- 1.01e-10], [1.500000000 +/- 1.01e-10])
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
new file mode 100644
index 000000000000..ec0467757ee7
--- /dev/null
+++ b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
@@ -0,0 +1,25 @@
+From f5f7a86908daf60b25e66e6a189c51ada7e0a732 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sat, 30 Oct 2021 10:21:52 +0200
+Subject: Fix test failure caused by new warning
+
+---
+ src/sage/lfunctions/pari.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py
+index 0aaf91c..33d5266 100644
+--- a/src/sage/lfunctions/pari.py
++++ b/src/sage/lfunctions/pari.py
+@@ -316,7 +316,7 @@ def lfun_number_field(K):
+         sage: L(3)
+         1.15202784126080
+         sage: L(0)
+-        0.000000000000000
++        ...0.000000000000000
+     """
+     return pari.lfuncreate(K)
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/skip-optional-dochtml.patch b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
new file mode 100644
index 000000000000..e49b18a52fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
@@ -0,0 +1,13 @@
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 288c889bd1..b9a4d3038a 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -15,7 +15,7 @@ os.environ['SAGE_STARTUP_FILE'] = os.path.join(DOT_SAGE, 'init-doctests.sage')
+ 
+ def _get_optional_defaults():
+     """Return the default value for the --optional flag."""
+-    optional = ['sage', 'dochtml', 'optional']
++    optional = ['sage', 'optional']
+ 
+     # This should be good-enough to determine if we are in a sage source
+     # repository working tree
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 3f9a3e9e077f..d4130be12a7a 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -16,7 +16,7 @@ short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
-distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+distfiles="https://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
@@ -47,6 +47,7 @@ noshlibprovides=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
+	rm -rf $_SAGE_ROOT
 	mv -T $wrksrc $_SAGE_ROOT
 	ln -sfT $_SAGE_ROOT $wrksrc
 }
@@ -72,6 +73,11 @@ do_install() {
 	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
+do_check() {
+	# since make check will build the docs, run test like this instead
+	./sage -tp ${XBPS_MAKEJOBS} --all
+}
+
 ### copied from sage-deps, to be kept in sync
 
 # hard dependencies
@@ -103,10 +109,9 @@ makedepends+="
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
  gengetopt texinfo
+ brial-devel cliquer-devel gfan libbraiding-devel libhomfly-devel
+ lrcalc-devel nauty-devel palp tachyon
 "
 
-# TODO: standard
-# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
-
 # TODO: optional
-# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
+# 4ti2 coxeter3 libsemigroups lrslib pdf2svg perl_mongodb polymake

From b971fa9d0ce6f514e5a7749d9f14ae843ae57fbe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 15:16:23 -0300
Subject: [PATCH 9/9] sagemath: more changes

 - do not install pytest, which is still broken (pending trac 31924)
 - add patch from sagemath trac 32892
 - replace the patch to fix the build of pyzmq on musl by a different
   one from sagemath trac 32828 which is what will be merged upstream
 - patch to fix doctest failure on musl (src/sage/misc/gperftools.py)
 - rebase on latest sympow rev to fix doctest failure on musl
   (src/sage/lfunctions/sympow.py)
 - enable check on CI to see what happens...
---
 ...hat-fixes-ctypes.util.find_library-c.patch |  64 +++++++++
 ...754ad30c6a1bd1fdbd6d62011055bf13b24a.patch |  27 ++++
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch |  15 --
 .../patches/trac-32828-fix-pyzmq.patch        | 134 ++++++++++++++++++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 235 insertions(+), 20 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
 create mode 100644 srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
 delete mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch

diff --git a/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch b/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
new file mode 100644
index 000000000000..4f89c2bd8fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
@@ -0,0 +1,64 @@
+From dc1a0e8168a9ffb4fbf07dd03c0846b4933a6dbe Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Mon, 22 Nov 2021 23:57:37 -0300
+Subject: [PATCH] Add a patch that fixes ctypes.util.find_library('c')
+
+The issue causes a failure doctesting src/sage/misc/gperftools.py
+---
+ .../python3/patches/musl-find_library.patch   | 44 +++++++++++++++++++
+ 1 file changed, 44 insertions(+)
+ create mode 100644 build/pkgs/python3/patches/musl-find_library.patch
+
+diff --git a/build/pkgs/python3/patches/musl-find_library.patch b/build/pkgs/python3/patches/musl-find_library.patch
+new file mode 100644
+index 0000000000..82f436b407
+--- /dev/null
++++ b/build/pkgs/python3/patches/musl-find_library.patch
+@@ -0,0 +1,44 @@
++--- a/Lib/ctypes/util.py
+++++ b/Lib/ctypes/util.py
++@@ -204,6 +204,41 @@
++         def find_library(name, is64 = False):
++             return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
++ 
+++    elif True:
+++
+++        # Patched for Alpine Linux / musl - search manually system paths
+++        def _is_elf(filepath):
+++            try:
+++                with open(filepath, 'rb') as fh:
+++                    return fh.read(4) == b'\x7fELF'
+++            except:
+++                return False
+++
+++        def find_library(name):
+++            from glob import glob
+++            # absolute name?
+++            if os.path.isabs(name):
+++                return name
+++            # special case for libm, libcrypt and libpthread and musl
+++            if name in ['m', 'crypt', 'pthread']:
+++                name = 'c'
+++            elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']:
+++                name = 'libc.so'
+++            # search in standard locations (musl order)
+++            paths = ['/lib', '/usr/local/lib', '/usr/lib']
+++            if 'LD_LIBRARY_PATH' in os.environ:
+++                paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths
+++            for d in paths:
+++                f = os.path.join(d, name)
+++                if _is_elf(f):
+++                    return os.path.basename(f)
+++
+++                prefix = os.path.join(d, 'lib'+name)
+++                for suffix in ['.so', '.so.*']:
+++                    for f in glob('{0}{1}'.format(prefix, suffix)):
+++                        if _is_elf(f):
+++                            return os.path.basename(f)
+++
++     else:
++ 
++         def _findSoname_ldconfig(name):
+-- 
+2.34.0
+
diff --git a/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch b/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
new file mode 100644
index 000000000000..ea05b2b6a524
--- /dev/null
+++ b/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
@@ -0,0 +1,27 @@
+From 89b8754ad30c6a1bd1fdbd6d62011055bf13b24a Mon Sep 17 00:00:00 2001
+From: Tobias Diez <code@tobiasdiez.com>
+Date: Wed, 17 Nov 2021 22:24:32 +0100
+Subject: Fix exit code for pytest in case of no matched files
+
+---
+ src/bin/sage-runtests | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 882456d..8b362ca 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -157,6 +157,10 @@ if __name__ == "__main__":
+         if args.verbose:
+             pytest_options.append("-v")
+         exit_code_pytest = pytest.main(pytest_options + args.filenames)
++        if exit_code_pytest == 5:
++            # Exit code 5 means there were no test files, pass in this case
++            exit_code_pytest = 0
++
+     except ModuleNotFoundError:
+         print("Pytest is not installed, skip checking tests that rely on it.")
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
deleted file mode 100644
index 9190830d835e..000000000000
--- a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
-index 0ce404ee5a..b7260c6d27 100644
---- a/build/pkgs/pyzmq/spkg-install.in
-+++ b/build/pkgs/pyzmq/spkg-install.in
-@@ -1,6 +1,9 @@
- # Since we use environment vars we have to generate setup.cfg
- 
--echo "[build_ext]" > src/setup.cfg
-+echo "[global]" > src/setup.cfg
-+echo "skip_check_zmq = True" >> src/setup.cfg
-+
-+echo "[build_ext]" >> src/setup.cfg
- 
- # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
- # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
new file mode 100644
index 000000000000..426932c95c9b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
@@ -0,0 +1,134 @@
+diff --git a/build/pkgs/pyzmq/checksums.ini b/build/pkgs/pyzmq/checksums.ini
+index 3824fd2ce9..20509db618 100644
+--- a/build/pkgs/pyzmq/checksums.ini
++++ b/build/pkgs/pyzmq/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=pyzmq-VERSION.tar.gz
+-sha1=50abf6482a6395f15dce0b2774021e12c9f4faad
+-md5=f261acf884460e93d30f7113c8e9242e
+-cksum=1661206741
++sha1=d8bb8cb345c0bfd9e67a95ac796bf4b10354dde6
++md5=ecf13c72fbea05ba5ddc771295409d48
++cksum=1680251717
+ upstream_url=https://pypi.io/packages/source/p/pyzmq/pyzmq-VERSION.tar.gz
+diff --git a/build/pkgs/pyzmq/package-version.txt b/build/pkgs/pyzmq/package-version.txt
+index 0398faf11c..8326e27f9b 100644
+--- a/build/pkgs/pyzmq/package-version.txt
++++ b/build/pkgs/pyzmq/package-version.txt
+@@ -1 +1 @@
+-22.2.1
++22.3.0
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..069d87767f 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,17 +1,11 @@
+-# Since we use environment vars we have to generate setup.cfg
+-
+-echo "[build_ext]" > src/setup.cfg
+-
+-# (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+-# the path---which is never used but is a good habit to support---but
+-# that simply does not work. Sorry.)
+-
+-echo "library_dirs = $SAGE_LOCAL/lib/" >> src/setup.cfg
+-echo "include_dirs = $SAGE_LOCAL/include/" >> src/setup.cfg
+-
+-echo "[configure]" >> src/setup.cfg
+-
+ cd src
+ 
++# Generate setup.cfg
++cat > setup.cfg <<EOF
++[global]
++zmq_prefix = $SAGE_LOCAL
++no_libzmq_extension = True
++EOF
++
+ # Configure and install
+ sdh_pip_install .
+diff --git a/build/pkgs/setuptools/checksums.ini b/build/pkgs/setuptools/checksums.ini
+index 6a280871e7..d9290d04ff 100644
+--- a/build/pkgs/setuptools/checksums.ini
++++ b/build/pkgs/setuptools/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=setuptools-VERSION.tar.gz
+-sha1=5d97de0e774b2269c85685a4aa8fd5956bcfd2bb
+-md5=ff20ab7e0d51c5ad0a9438c50e598c06
+-cksum=3564252314
++sha1=cd4e5d1f7c47f86354fc89d040d869cde244da3b
++md5=79b36f59270a6f2e45d6a9a0c6dc68c1
++cksum=430889097
+ upstream_url=https://pypi.io/packages/source/s/setuptools/setuptools-VERSION.tar.gz
+diff --git a/build/pkgs/setuptools/package-version.txt b/build/pkgs/setuptools/package-version.txt
+index e6ea636051..aec1257e4c 100644
+--- a/build/pkgs/setuptools/package-version.txt
++++ b/build/pkgs/setuptools/package-version.txt
+@@ -1 +1 @@
+-58.2.0
++59.2.0
+diff --git a/build/pkgs/zeromq/checksums.ini b/build/pkgs/zeromq/checksums.ini
+index ea8c36bce5..dc802612dd 100644
+--- a/build/pkgs/zeromq/checksums.ini
++++ b/build/pkgs/zeromq/checksums.ini
+@@ -1,4 +1,5 @@
+ tarball=zeromq-VERSION.tar.gz
+-sha1=1132f839d703486c4ee1cf22f056585dfbb329c2
+-md5=a1c95b34384257e986842f4d006957b8
+-cksum=136261411
++sha1=47277a64749049123d1401600e8cfbab10a3ae28
++md5=c897d4005a3f0b8276b00b7921412379
++cksum=1500782345
++upstream_url=https://github.com/zeromq/libzmq/releases/download/vVERSION/zeromq-VERSION.tar.gz
+diff --git a/build/pkgs/zeromq/package-version.txt b/build/pkgs/zeromq/package-version.txt
+index df0228dfae..eda862a98c 100644
+--- a/build/pkgs/zeromq/package-version.txt
++++ b/build/pkgs/zeromq/package-version.txt
+@@ -1 +1 @@
+-4.2.5
++4.3.4
+diff --git a/build/pkgs/zeromq/patches/getrandom.patch b/build/pkgs/zeromq/patches/getrandom.patch
+deleted file mode 100644
+index e665114e1c..0000000000
+--- a/build/pkgs/zeromq/patches/getrandom.patch
++++ /dev/null
+@@ -1,39 +0,0 @@
+-Patch taken from upstream git repo
+-and after running aclocal && autoconf
+-and removing changes to autotools input files
+-
+-commit 4ff814f204ee38177a392526cf12c8c0019b480f
+-Author: Luca Boccassi <luca.boccassi@gmail.com>
+-Date:   Wed May 9 10:41:20 2018 +0100
+-
+-    Problem: getrandom test does not check if it's working
+-
+-    Solution: check return value in autoconf and CMake. On some platforms
+-    the function is available but not implemented (eg: GNU/Hurd).
+-
+-diff -ru zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake b/builds/cmake/Modules/ZMQSourceRunChecks.cmake
+---- zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-03-23 20:33:36.000000000 +0100
+-+++ b/builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-07-24 12:39:23.340035053 +0200
+-@@ -287,7 +287,8 @@
+- int main (int argc, char *argv [])
+- {
+-     char buf[4];
+--    getrandom(buf, 4, 0);
+-+    int rc = getrandom(buf, 4, 0);
+-+    return rc == -1 ? 1 : 0;
+- }
+- "
+-     ZMQ_HAVE_GETRANDOM)
+-diff -ru zeromq-4.2.5//configure b/configure
+---- zeromq-4.2.5//configure	2018-03-23 20:34:18.000000000 +0100
+-+++ b/configure	2018-07-24 12:39:49.018035120 +0200
+-@@ -23315,7 +23315,8 @@
+- int main (int argc, char *argv [])
+- {
+-     char buf[4];
+--    getrandom(buf, 4, 0);
+-+    int rc = getrandom(buf, 4, 0);
+-+    return rc == -1 ? 1 : 0;
+- }
+- 
+- _ACEOF
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index d4130be12a7a..622ee06d85b8 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -29,7 +29,7 @@ case ${version} in
 esac
 
 # for now, skip check in ci, since we still have a few tests failing
-make_check=ci-skip
+#make_check=ci-skip
 
 # for now, just build native; we'll worry about cross later
 # besides, some dependencies are nocross (e.g. ntl)
@@ -56,10 +56,15 @@ do_clean() {
 	rm -rf $wrksrc $_SAGE_ROOT
 }
 
-post_build() {
-	# install pytest for more tests
-	./sage -i pytest
-}
+# DISABLED pytest since it brings more harm than good
+# it seems currently all it does is to look for files matching
+# *_test.py and run pytest on those, but I don't think these are meant
+# to be run on pytest (and one even gives a failure...)
+#
+# post_build() {
+# 	# install pytest for more tests
+# 	./sage -i pytest
+# }
 
 do_install() {
 	vcopy $_SAGE_ROOT usr/lib/

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (65 preceding siblings ...)
  2021-11-23  3:22 ` [PR PATCH] [Updated] " tornaria
@ 2021-11-23  3:25 ` tornaria
  2021-11-23  9:22 ` dkwo
                   ` (10 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-23  3:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 613 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-976130713

Comment:
New version:
 - do not install pytest, which is still broken (pending trac 31924)
 - add patch from sagemath trac 32892
 - replace the patch to fix the build of pyzmq on musl by a different one from sagemath trac 32828 which is what will be merged upstream
 - patch to fix doctest failure on musl (src/sage/misc/gperftools.py)
 - rebase on latest sympow rev to fix doctest failure on musl (src/sage/lfunctions/sympow.py)
 - enable check on CI to see what happens...

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (66 preceding siblings ...)
  2021-11-23  3:25 ` tornaria
@ 2021-11-23  9:22 ` dkwo
  2021-11-23 12:16 ` tornaria
                   ` (9 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-23  9:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1144 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-976320284

Comment:
This looks good.
Now on x86_64 (both glibc and musl) only
`sage -t --random-seed=239417738005644781849247931063272806042 src/sage/functions/min_max.py  # 2 doctests failed`
fails, as you pointed out, while on i686 there are also
```
sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/base.py  # Killed due to abort
sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx  # Killed due to abort
sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx  # Timed out
sage -t --random-seed=313681864676731812413561326645236136667 src/sage/schemes/elliptic_curves/ell_rational_field.py  # 2 doctests failed
```
of which only the last one seems a real failure.
Btw, do we need `linbox` in makedepends at the moment? see
`linbox-1.6.3.p1:                             standard, will be installed as an SPKG`

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (67 preceding siblings ...)
  2021-11-23  9:22 ` dkwo
@ 2021-11-23 12:16 ` tornaria
  2021-11-24 19:28 ` tornaria
                   ` (8 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-23 12:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1831 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-976455781

Comment:
Same here, on 64 bit (glibc and musl) only the single failure due to giac-1.7

> ```
> sage -t --random-seed=313681864676731812413561326645236136667 src/sage/schemes/elliptic_curves/ell_rational_field.py  # 2 doctests failed
> ```
This is due to a faulty sympow on i686, see https://github.com/void-linux/void-packages/pull/34209#issuecomment-976444205


> ```
> sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/base.py  # Killed due to abort
> sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx  # Killed due to abort
> sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx  # Timed out
> ```

These 3 in polyhedron might also be caused by miscompilation of some external program or library, it would be useful to try to see which external packages are used in those files, remove them from makedepends and recompile/rerun these tests.

In addition to those I also had (on i686)
```
sage -t --random-seed=335940497943411300414171505300249115189 src/sage/functions/orthogonal_polys.py  # Timed out
```

No idea if this is related, but it could also be due to some miscompilation.


> Btw, do we need `linbox` in makedepends at the moment? see `linbox-1.6.3.p1: standard, will be installed as an SPKG`

No, linbox is not picked up from system yet, there is https://trac.sagemath.org/ticket/29631 which I'll try later. Note that the message is different for packages not found (something like "pkg is not available from system, will be installed as SPKG").



^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (68 preceding siblings ...)
  2021-11-23 12:16 ` tornaria
@ 2021-11-24 19:28 ` tornaria
  2021-11-25 22:41 ` tornaria
                   ` (7 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-24 19:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1843 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-976455781

Comment:
Same here, on 64 bit (glibc and musl) only the single failure due to giac-1.7

On i686:

> ```
> sage -t --random-seed=313681864676731812413561326645236136667 src/sage/schemes/elliptic_curves/ell_rational_field.py  # 2 doctests failed
> ```
This is due to a faulty sympow on i686, see https://github.com/void-linux/void-packages/pull/34209#issuecomment-976444205


> ```
> sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/base.py  # Killed due to abort
> sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx  # Killed due to abort
> sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx  # Timed out
> ```

These 3 in polyhedron might also be caused by miscompilation of some external program or library, it would be useful to try to see which external packages are used in those files, remove them from makedepends and recompile/rerun these tests.

In addition to those I also had (on i686)
```
sage -t --random-seed=335940497943411300414171505300249115189 src/sage/functions/orthogonal_polys.py  # Timed out
```

No idea if this is related, but it could also be due to some miscompilation.


> Btw, do we need `linbox` in makedepends at the moment? see `linbox-1.6.3.p1: standard, will be installed as an SPKG`

No, linbox is not picked up from system yet, there is https://trac.sagemath.org/ticket/29631 which I'll try later. Note that the message is different for packages not found (something like "pkg is not available from system, will be installed as SPKG").



^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (69 preceding siblings ...)
  2021-11-24 19:28 ` tornaria
@ 2021-11-25 22:41 ` tornaria
  2021-11-26  3:04 ` [PR PATCH] [Updated] " tornaria
                   ` (6 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-25 22:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 625 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975591928

Comment:
New version:
 - add more dependencies
 - add patches so more doctests pass
 - add do_check() to skip building docs
 - use https for distfiles

With this, the only expected doctest failures are the 2 in `src/sage/functions/min_max.py` which seem to be caused by the upgrade to giac-1.7.0 and are reported upstream at https://trac.sagemath.org/ticket/31563 with no fix so far.

The main thing now is to see if this can be made to work with system python 3.10.

Edit: fix link

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (70 preceding siblings ...)
  2021-11-25 22:41 ` tornaria
@ 2021-11-26  3:04 ` tornaria
  2021-11-26  3:12 ` tornaria
                   ` (5 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-26  3:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta7
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 45198 bytes --]

From 05b0c3942ad86b95e93f06a7e17ac518ffa1cf9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 1/8] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 262f31eb166bdf8dde211a724d570c5c4f6156d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 2/8] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From 701eb7ed5c1cb69f94a8c1faa7bc63392e8e4b53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 3/8] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..56166cd44272 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopt texinfo
 "
 
 # TODO: standard

From d15b8d8ffe769fc6e94d39f8f8041ca208574ca1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 14 Nov 2021 18:23:29 -0300
Subject: [PATCH 4/8] sagemath: revbump to 9.5.beta6_3 for changes

 - add depends needed for runtime and for testing
 - add python_version=3
 - disable skipping 03-rewrite-python-shebang as it seems to be harmless
   after adding python_version=3
 - fix cleaning up of $wrksrc and $_SAGE_ROOT
 - use sage-${version}_${revision} for the binary symlink; this way it
   won't override whatever sage is installed in the system so I can test
   on a live system.
---
 srcpkgs/sagemath/template | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 56166cd44272..cfe97e039974 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,19 +1,24 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=2
+revision=3
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
 make_check_target=ptest
 # for now skip building docs
 make_build_target=build
+depends="giac git FlintQS zn_poly sympow
+ pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
+ flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+python_version=3
 
 # path where sage will be installed
 _SAGE_ROOT=/usr/lib/sage-${version}
@@ -37,7 +42,8 @@ nostrip=yes
 noshlibprovides=yes
 
 # don't rewrite python shebang as sage uses its own python (for now)
-_no_python_shebang=yes
+# after python_version=3, this seems harmless... strange...
+#_no_python_shebang=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
@@ -46,9 +52,12 @@ post_extract() {
 }
 
 do_clean() {
-	# undo post_extract()
-	rm $wrksrc
-	mv $_SAGE_ROOT $wrksrc
+	rm -rf $wrksrc $_SAGE_ROOT
+}
+
+post_build() {
+	# install pytest for more tests
+	./sage -i pytest
 }
 
 do_install() {
@@ -58,7 +67,9 @@ do_install() {
 	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
 	# symlink main binary
 	vmkdir usr/bin
-	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
+	# for now use sage-${version}_${revision} so it doesn't override
+	# other sage installed in the system
+	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
 ### copied from sage-deps, to be kept in sync

From dc8d1fa87812662564ba7c360f9ccad4bdb2aab4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 20 Nov 2021 19:01:21 -0300
Subject: [PATCH 5/8] sagemath: update to 9.5.beta7.

---
 srcpkgs/sagemath/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index cfe97e039974..3f9a3e9e077f 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
-version=9.5.beta6
-revision=3
+version=9.5.beta7
+revision=1
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -17,7 +17,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
 # path where sage will be installed

From 8180fcfea461af888ee490398f6bbb9b5431a2f3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 10:23:03 -0300
Subject: [PATCH 6/8] sagemath: add more dependencies

Also:
 - add patches so more doctests pass
 - add do_check() to skip building docs
 - use https for distfiles
---
 ...08fd9d56d022ed28592f93f07ec8dce530ef.patch |  49 ++++++
 ...b99e0270f80cf03b80418372f45274f46051.patch | 163 ++++++++++++++++++
 ...a86908daf60b25e66e6a189c51ada7e0a732.patch |  25 +++
 .../patches/skip-optional-dochtml.patch       |  13 ++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 260 insertions(+), 5 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
 create mode 100644 srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
 create mode 100644 srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
 create mode 100644 srcpkgs/sagemath/patches/skip-optional-dochtml.patch

diff --git a/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
new file mode 100644
index 000000000000..e295bb91af5b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
@@ -0,0 +1,49 @@
+From 17e308fd9d56d022ed28592f93f07ec8dce530ef Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Mon, 15 Nov 2021 23:37:15 -0500
+Subject: Trac #32880: use GAP instead of Singular to test
+ _get_shared_lib_path().
+
+We still have a doctest for _get_shared_lib_path() that tries to find
+the path to libSingular; however, we no longer actually need it to
+find libSingular because the path to libSingular is contained in
+LIBSINGULAR_PATH.
+
+Since _get_shared_lib_path() is a bit fragile, this commit replaces
+that test case with one for libgap, which is still always installed
+via SPKG and for which we still need _get_shared_lib_path() to be able
+to find the path.
+---
+ src/sage/env.py | 12 ++----------
+ 1 file changed, 2 insertions(+), 10 deletions(-)
+
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 40ace13..3bd4826 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -267,20 +267,12 @@ def _get_shared_lib_path(*libnames: str) -> Optional[str]:
+ 
+     EXAMPLES::
+ 
+-        sage: import sys
+-        sage: from fnmatch import fnmatch
+         sage: from sage.env import _get_shared_lib_path
+-        sage: lib_filename = _get_shared_lib_path("Singular", "singular-Singular")
+-        sage: if sys.platform == 'cygwin':
+-        ....:     pattern = "*/cygSingular-*.dll"
+-        ....: elif sys.platform == 'darwin':
+-        ....:     pattern = "*/libSingular-*.dylib"
+-        ....: else:
+-        ....:     pattern = "*/lib*Singular-*.so"
+-        sage: fnmatch(str(lib_filename), pattern)
++        sage: "gap" in _get_shared_lib_path("gap")
+         True
+         sage: _get_shared_lib_path("an_absurd_lib") is None
+         True
++
+     """
+ 
+     for libname in libnames:
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
new file mode 100644
index 000000000000..32e641edb3aa
--- /dev/null
+++ b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
@@ -0,0 +1,163 @@
+From 2ee7b99e0270f80cf03b80418372f45274f46051 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Samuel=20Leli=C3=A8vre?= <samuel.lelievre@gmail.com>
+Date: Sat, 20 Nov 2021 13:34:16 +0100
+Subject: 32905: abs tol for some CBF and RBF doctests
+
+---
+ src/sage/functions/gamma.py    |  2 +-
+ src/sage/rings/complex_arb.pyx |  6 +++---
+ src/sage/rings/real_arb.pyx    | 24 ++++++++++++------------
+ src/sage/symbolic/function.pyx |  2 +-
+ 4 files changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/src/sage/functions/gamma.py b/src/sage/functions/gamma.py
+index 3a4deef..307deb1 100644
+--- a/src/sage/functions/gamma.py
++++ b/src/sage/functions/gamma.py
+@@ -1049,7 +1049,7 @@ class Function_beta(GinacFunction):
+         r"""
+         TESTS::
+ 
+-            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))
++            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))  # abs tol 6e-7
+             [7.407662 +/- 6.17e-7]
+         """
+         return [x, y]
+diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx
+index ce9b1b1..7e10ec9 100644
+--- a/src/sage/rings/complex_arb.pyx
++++ b/src/sage/rings/complex_arb.pyx
+@@ -4189,7 +4189,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ei(I))
++            sage: CBF(Ei(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.76e-16] + [2.51687939716208 +/- 2.01e-15]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4239,7 +4239,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ci(I))
++            sage: CBF(Ci(I))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4291,7 +4291,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Chi(I))
++            sage: CBF(Chi(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx
+index 80a840e..49caa63 100644
+--- a/src/sage/rings/real_arb.pyx
++++ b/src/sage/rings/real_arb.pyx
+@@ -3489,12 +3489,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ei()
++            sage: RBF(1).Ei()  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ei(1))
++            sage: RBF(Ei(1))  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3531,12 +3531,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ci()
++            sage: RBF(1).Ci()  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ci(1))
++            sage: RBF(Ci(1))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3575,12 +3575,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Chi()
++            sage: RBF(1).Chi()  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Chi(1))
++            sage: RBF(Chi(1))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3597,7 +3597,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).li()
++            sage: RBF(3).li()  # abs tol 1e-15
+             [2.16358859466719 +/- 4.72e-15]
+ 
+         TESTS::
+@@ -3621,7 +3621,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).Li()
++            sage: RBF(3).Li()  # abs tol 1e-15
+             [1.11842481454970 +/- 7.61e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3648,9 +3648,9 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())
++            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())  # abs tol 1e-13
+             [7.407661629415 +/- 1.07e-13]
+-            sage: RealBallField(100)(7/2).beta(1)
++            sage: RealBallField(100)(7/2).beta(1)  # abs tol 1e-30
+             [0.28571428571428571428571428571 +/- 5.23e-30]
+             sage: RealBallField(100)(7/2).beta(1, 1/2)
+             [0.025253813613805268728601584361 +/- 2.53e-31]
+@@ -3685,9 +3685,9 @@ cdef class RealBall(RingElement):
+ 
+             sage: RBF(1/2).gamma()
+             [1.772453850905516 +/- ...e-16]
+-            sage: RBF(gamma(3/2, RBF(2).sqrt()))
++            sage: RBF(gamma(3/2, RBF(2).sqrt()))  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+-            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())
++            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+ 
+         .. SEEALSO::
+diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx
+index 89cdce5..480a601 100644
+--- a/src/sage/symbolic/function.pyx
++++ b/src/sage/symbolic/function.pyx
+@@ -626,7 +626,7 @@ cdef class Function(SageObject):
+             sage: b = RBF(3/2, 1e-10)
+             sage: airy_ai(b)
+             airy_ai([1.500000000 +/- 1.01e-10])
+-            sage: gamma(b, 1)
++            sage: gamma(b, 1)  # abs tol 4.5e-9
+             [0.50728223 +/- 4.67e-9]
+             sage: hurwitz_zeta(b, b)
+             hurwitz_zeta([1.500000000 +/- 1.01e-10], [1.500000000 +/- 1.01e-10])
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
new file mode 100644
index 000000000000..ec0467757ee7
--- /dev/null
+++ b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
@@ -0,0 +1,25 @@
+From f5f7a86908daf60b25e66e6a189c51ada7e0a732 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sat, 30 Oct 2021 10:21:52 +0200
+Subject: Fix test failure caused by new warning
+
+---
+ src/sage/lfunctions/pari.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py
+index 0aaf91c..33d5266 100644
+--- a/src/sage/lfunctions/pari.py
++++ b/src/sage/lfunctions/pari.py
+@@ -316,7 +316,7 @@ def lfun_number_field(K):
+         sage: L(3)
+         1.15202784126080
+         sage: L(0)
+-        0.000000000000000
++        ...0.000000000000000
+     """
+     return pari.lfuncreate(K)
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/skip-optional-dochtml.patch b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
new file mode 100644
index 000000000000..e49b18a52fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
@@ -0,0 +1,13 @@
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 288c889bd1..b9a4d3038a 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -15,7 +15,7 @@ os.environ['SAGE_STARTUP_FILE'] = os.path.join(DOT_SAGE, 'init-doctests.sage')
+ 
+ def _get_optional_defaults():
+     """Return the default value for the --optional flag."""
+-    optional = ['sage', 'dochtml', 'optional']
++    optional = ['sage', 'optional']
+ 
+     # This should be good-enough to determine if we are in a sage source
+     # repository working tree
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 3f9a3e9e077f..d4130be12a7a 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -16,7 +16,7 @@ short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
-distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+distfiles="https://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
@@ -47,6 +47,7 @@ noshlibprovides=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
+	rm -rf $_SAGE_ROOT
 	mv -T $wrksrc $_SAGE_ROOT
 	ln -sfT $_SAGE_ROOT $wrksrc
 }
@@ -72,6 +73,11 @@ do_install() {
 	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
+do_check() {
+	# since make check will build the docs, run test like this instead
+	./sage -tp ${XBPS_MAKEJOBS} --all
+}
+
 ### copied from sage-deps, to be kept in sync
 
 # hard dependencies
@@ -103,10 +109,9 @@ makedepends+="
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
  gengetopt texinfo
+ brial-devel cliquer-devel gfan libbraiding-devel libhomfly-devel
+ lrcalc-devel nauty-devel palp tachyon
 "
 
-# TODO: standard
-# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
-
 # TODO: optional
-# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
+# 4ti2 coxeter3 libsemigroups lrslib pdf2svg perl_mongodb polymake

From f5c88fcfbf0927363290cc68718f746356b8ba30 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 15:16:23 -0300
Subject: [PATCH 7/8] sagemath: more changes

 - do not install pytest, which is still broken (pending trac 31924)
 - add patch from sagemath trac 32892
 - replace the patch to fix the build of pyzmq on musl by a different
   one from sagemath trac 32828 which is what will be merged upstream
 - patch to fix doctest failure on musl (src/sage/misc/gperftools.py)
 - rebase on latest sympow rev to fix doctest failure on musl
   (src/sage/lfunctions/sympow.py)
 - enable check on CI to see what happens...
---
 ...hat-fixes-ctypes.util.find_library-c.patch |  64 +++++++++
 ...754ad30c6a1bd1fdbd6d62011055bf13b24a.patch |  27 ++++
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch |  15 --
 .../patches/trac-32828-fix-pyzmq.patch        | 134 ++++++++++++++++++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 235 insertions(+), 20 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
 create mode 100644 srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
 delete mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch

diff --git a/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch b/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
new file mode 100644
index 000000000000..4f89c2bd8fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
@@ -0,0 +1,64 @@
+From dc1a0e8168a9ffb4fbf07dd03c0846b4933a6dbe Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Mon, 22 Nov 2021 23:57:37 -0300
+Subject: [PATCH] Add a patch that fixes ctypes.util.find_library('c')
+
+The issue causes a failure doctesting src/sage/misc/gperftools.py
+---
+ .../python3/patches/musl-find_library.patch   | 44 +++++++++++++++++++
+ 1 file changed, 44 insertions(+)
+ create mode 100644 build/pkgs/python3/patches/musl-find_library.patch
+
+diff --git a/build/pkgs/python3/patches/musl-find_library.patch b/build/pkgs/python3/patches/musl-find_library.patch
+new file mode 100644
+index 0000000000..82f436b407
+--- /dev/null
++++ b/build/pkgs/python3/patches/musl-find_library.patch
+@@ -0,0 +1,44 @@
++--- a/Lib/ctypes/util.py
+++++ b/Lib/ctypes/util.py
++@@ -204,6 +204,41 @@
++         def find_library(name, is64 = False):
++             return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
++ 
+++    elif True:
+++
+++        # Patched for Alpine Linux / musl - search manually system paths
+++        def _is_elf(filepath):
+++            try:
+++                with open(filepath, 'rb') as fh:
+++                    return fh.read(4) == b'\x7fELF'
+++            except:
+++                return False
+++
+++        def find_library(name):
+++            from glob import glob
+++            # absolute name?
+++            if os.path.isabs(name):
+++                return name
+++            # special case for libm, libcrypt and libpthread and musl
+++            if name in ['m', 'crypt', 'pthread']:
+++                name = 'c'
+++            elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']:
+++                name = 'libc.so'
+++            # search in standard locations (musl order)
+++            paths = ['/lib', '/usr/local/lib', '/usr/lib']
+++            if 'LD_LIBRARY_PATH' in os.environ:
+++                paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths
+++            for d in paths:
+++                f = os.path.join(d, name)
+++                if _is_elf(f):
+++                    return os.path.basename(f)
+++
+++                prefix = os.path.join(d, 'lib'+name)
+++                for suffix in ['.so', '.so.*']:
+++                    for f in glob('{0}{1}'.format(prefix, suffix)):
+++                        if _is_elf(f):
+++                            return os.path.basename(f)
+++
++     else:
++ 
++         def _findSoname_ldconfig(name):
+-- 
+2.34.0
+
diff --git a/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch b/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
new file mode 100644
index 000000000000..ea05b2b6a524
--- /dev/null
+++ b/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
@@ -0,0 +1,27 @@
+From 89b8754ad30c6a1bd1fdbd6d62011055bf13b24a Mon Sep 17 00:00:00 2001
+From: Tobias Diez <code@tobiasdiez.com>
+Date: Wed, 17 Nov 2021 22:24:32 +0100
+Subject: Fix exit code for pytest in case of no matched files
+
+---
+ src/bin/sage-runtests | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 882456d..8b362ca 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -157,6 +157,10 @@ if __name__ == "__main__":
+         if args.verbose:
+             pytest_options.append("-v")
+         exit_code_pytest = pytest.main(pytest_options + args.filenames)
++        if exit_code_pytest == 5:
++            # Exit code 5 means there were no test files, pass in this case
++            exit_code_pytest = 0
++
+     except ModuleNotFoundError:
+         print("Pytest is not installed, skip checking tests that rely on it.")
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
deleted file mode 100644
index 9190830d835e..000000000000
--- a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
-index 0ce404ee5a..b7260c6d27 100644
---- a/build/pkgs/pyzmq/spkg-install.in
-+++ b/build/pkgs/pyzmq/spkg-install.in
-@@ -1,6 +1,9 @@
- # Since we use environment vars we have to generate setup.cfg
- 
--echo "[build_ext]" > src/setup.cfg
-+echo "[global]" > src/setup.cfg
-+echo "skip_check_zmq = True" >> src/setup.cfg
-+
-+echo "[build_ext]" >> src/setup.cfg
- 
- # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
- # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
new file mode 100644
index 000000000000..426932c95c9b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
@@ -0,0 +1,134 @@
+diff --git a/build/pkgs/pyzmq/checksums.ini b/build/pkgs/pyzmq/checksums.ini
+index 3824fd2ce9..20509db618 100644
+--- a/build/pkgs/pyzmq/checksums.ini
++++ b/build/pkgs/pyzmq/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=pyzmq-VERSION.tar.gz
+-sha1=50abf6482a6395f15dce0b2774021e12c9f4faad
+-md5=f261acf884460e93d30f7113c8e9242e
+-cksum=1661206741
++sha1=d8bb8cb345c0bfd9e67a95ac796bf4b10354dde6
++md5=ecf13c72fbea05ba5ddc771295409d48
++cksum=1680251717
+ upstream_url=https://pypi.io/packages/source/p/pyzmq/pyzmq-VERSION.tar.gz
+diff --git a/build/pkgs/pyzmq/package-version.txt b/build/pkgs/pyzmq/package-version.txt
+index 0398faf11c..8326e27f9b 100644
+--- a/build/pkgs/pyzmq/package-version.txt
++++ b/build/pkgs/pyzmq/package-version.txt
+@@ -1 +1 @@
+-22.2.1
++22.3.0
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..069d87767f 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,17 +1,11 @@
+-# Since we use environment vars we have to generate setup.cfg
+-
+-echo "[build_ext]" > src/setup.cfg
+-
+-# (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+-# the path---which is never used but is a good habit to support---but
+-# that simply does not work. Sorry.)
+-
+-echo "library_dirs = $SAGE_LOCAL/lib/" >> src/setup.cfg
+-echo "include_dirs = $SAGE_LOCAL/include/" >> src/setup.cfg
+-
+-echo "[configure]" >> src/setup.cfg
+-
+ cd src
+ 
++# Generate setup.cfg
++cat > setup.cfg <<EOF
++[global]
++zmq_prefix = $SAGE_LOCAL
++no_libzmq_extension = True
++EOF
++
+ # Configure and install
+ sdh_pip_install .
+diff --git a/build/pkgs/setuptools/checksums.ini b/build/pkgs/setuptools/checksums.ini
+index 6a280871e7..d9290d04ff 100644
+--- a/build/pkgs/setuptools/checksums.ini
++++ b/build/pkgs/setuptools/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=setuptools-VERSION.tar.gz
+-sha1=5d97de0e774b2269c85685a4aa8fd5956bcfd2bb
+-md5=ff20ab7e0d51c5ad0a9438c50e598c06
+-cksum=3564252314
++sha1=cd4e5d1f7c47f86354fc89d040d869cde244da3b
++md5=79b36f59270a6f2e45d6a9a0c6dc68c1
++cksum=430889097
+ upstream_url=https://pypi.io/packages/source/s/setuptools/setuptools-VERSION.tar.gz
+diff --git a/build/pkgs/setuptools/package-version.txt b/build/pkgs/setuptools/package-version.txt
+index e6ea636051..aec1257e4c 100644
+--- a/build/pkgs/setuptools/package-version.txt
++++ b/build/pkgs/setuptools/package-version.txt
+@@ -1 +1 @@
+-58.2.0
++59.2.0
+diff --git a/build/pkgs/zeromq/checksums.ini b/build/pkgs/zeromq/checksums.ini
+index ea8c36bce5..dc802612dd 100644
+--- a/build/pkgs/zeromq/checksums.ini
++++ b/build/pkgs/zeromq/checksums.ini
+@@ -1,4 +1,5 @@
+ tarball=zeromq-VERSION.tar.gz
+-sha1=1132f839d703486c4ee1cf22f056585dfbb329c2
+-md5=a1c95b34384257e986842f4d006957b8
+-cksum=136261411
++sha1=47277a64749049123d1401600e8cfbab10a3ae28
++md5=c897d4005a3f0b8276b00b7921412379
++cksum=1500782345
++upstream_url=https://github.com/zeromq/libzmq/releases/download/vVERSION/zeromq-VERSION.tar.gz
+diff --git a/build/pkgs/zeromq/package-version.txt b/build/pkgs/zeromq/package-version.txt
+index df0228dfae..eda862a98c 100644
+--- a/build/pkgs/zeromq/package-version.txt
++++ b/build/pkgs/zeromq/package-version.txt
+@@ -1 +1 @@
+-4.2.5
++4.3.4
+diff --git a/build/pkgs/zeromq/patches/getrandom.patch b/build/pkgs/zeromq/patches/getrandom.patch
+deleted file mode 100644
+index e665114e1c..0000000000
+--- a/build/pkgs/zeromq/patches/getrandom.patch
++++ /dev/null
+@@ -1,39 +0,0 @@
+-Patch taken from upstream git repo
+-and after running aclocal && autoconf
+-and removing changes to autotools input files
+-
+-commit 4ff814f204ee38177a392526cf12c8c0019b480f
+-Author: Luca Boccassi <luca.boccassi@gmail.com>
+-Date:   Wed May 9 10:41:20 2018 +0100
+-
+-    Problem: getrandom test does not check if it's working
+-
+-    Solution: check return value in autoconf and CMake. On some platforms
+-    the function is available but not implemented (eg: GNU/Hurd).
+-
+-diff -ru zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake b/builds/cmake/Modules/ZMQSourceRunChecks.cmake
+---- zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-03-23 20:33:36.000000000 +0100
+-+++ b/builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-07-24 12:39:23.340035053 +0200
+-@@ -287,7 +287,8 @@
+- int main (int argc, char *argv [])
+- {
+-     char buf[4];
+--    getrandom(buf, 4, 0);
+-+    int rc = getrandom(buf, 4, 0);
+-+    return rc == -1 ? 1 : 0;
+- }
+- "
+-     ZMQ_HAVE_GETRANDOM)
+-diff -ru zeromq-4.2.5//configure b/configure
+---- zeromq-4.2.5//configure	2018-03-23 20:34:18.000000000 +0100
+-+++ b/configure	2018-07-24 12:39:49.018035120 +0200
+-@@ -23315,7 +23315,8 @@
+- int main (int argc, char *argv [])
+- {
+-     char buf[4];
+--    getrandom(buf, 4, 0);
+-+    int rc = getrandom(buf, 4, 0);
+-+    return rc == -1 ? 1 : 0;
+- }
+- 
+- _ACEOF
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index d4130be12a7a..622ee06d85b8 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -29,7 +29,7 @@ case ${version} in
 esac
 
 # for now, skip check in ci, since we still have a few tests failing
-make_check=ci-skip
+#make_check=ci-skip
 
 # for now, just build native; we'll worry about cross later
 # besides, some dependencies are nocross (e.g. ntl)
@@ -56,10 +56,15 @@ do_clean() {
 	rm -rf $wrksrc $_SAGE_ROOT
 }
 
-post_build() {
-	# install pytest for more tests
-	./sage -i pytest
-}
+# DISABLED pytest since it brings more harm than good
+# it seems currently all it does is to look for files matching
+# *_test.py and run pytest on those, but I don't think these are meant
+# to be run on pytest (and one even gives a failure...)
+#
+# post_build() {
+# 	# install pytest for more tests
+# 	./sage -i pytest
+# }
 
 do_install() {
 	vcopy $_SAGE_ROOT usr/lib/

From b6265d590293584b50ef1df433845cae39e6f2fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 25 Nov 2021 22:47:35 -0300
Subject: [PATCH 8/8] sagemath: more changes

 - skip a doctest which fails due to giac 1.7.0
 - rename patches to include trac ticket #
 - add a patch to use system linbox (needs to run ./bootstrap)
 - look for an optional file ${XBPS_DISTDIR}/sagemath-check ; if that
   file exists, its contents are used as arguments for sage check
   Intended usage: place the names of files that you want to doctest
   instead of all files (useful when you have a few failing doctests you
   are trying to fix)
---
 ...p-doctest-giac-1.7.0--see-trac-31563.patch | 14 +++++++++
 ...119d27d091b3894860547673c2f6b224f61a.patch | 31 +++++++++++++++++++
 ...86908daf60b25e66e6a189c51ada7e0a732.patch} |  0
 ...8fd9d56d022ed28592f93f07ec8dce530ef.patch} |  0
 ...54ad30c6a1bd1fdbd6d62011055bf13b24a.patch} |  0
 ...99e0270f80cf03b80418372f45274f46051.patch} |  0
 srcpkgs/sagemath/template                     | 10 +++++-
 7 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
 rename srcpkgs/sagemath/patches/{f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch => trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch} (100%)
 rename srcpkgs/sagemath/patches/{17e308fd9d56d022ed28592f93f07ec8dce530ef.patch => trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch} (100%)
 rename srcpkgs/sagemath/patches/{89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch => trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch} (100%)
 rename srcpkgs/sagemath/patches/{2ee7b99e0270f80cf03b80418372f45274f46051.patch => trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch} (100%)

diff --git a/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch b/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
new file mode 100644
index 000000000000..563bb8526788
--- /dev/null
+++ b/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
@@ -0,0 +1,14 @@
+--- a/src/sage/functions/min_max.py
++++ b/src/sage/functions/min_max.py
+@@ -233,9 +233,9 @@ class MaxSymbolic(MinMax_base):
+             sage: f = max_symbolic(sin(x), cos(x))
+             sage: r = integral(f, x, 0, 1)
+             ...
+-            sage: r
++            sage: r             # not tested -- broken with giac 1.7.0
+             sqrt(2) - cos(1)
+-            sage: r.n()
++            sage: r.n()         # not tested -- broken with giac 1.7.0
+             0.873911256504955
+         """
+         return max_symbolic(args)
diff --git a/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch b/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
new file mode 100644
index 000000000000..8154c2453c15
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
@@ -0,0 +1,31 @@
+From 7072119d27d091b3894860547673c2f6b224f61a Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Fri, 12 Nov 2021 10:07:44 -0500
+Subject: Trac #29631: new spkg-configure.m4 for linbox.
+
+This is essentially the file posted as an attachment on Trac 29631 by
+Thierry Thomas. I've chosen to leave the lower bound at the latest
+v1.6.3, since in the intervening months most distributions appear to
+have updated.
+---
+ build/pkgs/linbox/spkg-configure.m4 | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+ create mode 100644 build/pkgs/linbox/spkg-configure.m4
+
+diff --git a/build/pkgs/linbox/spkg-configure.m4 b/build/pkgs/linbox/spkg-configure.m4
+new file mode 100644
+index 00000000..fbf405c
+--- /dev/null
++++ b/build/pkgs/linbox/spkg-configure.m4
+@@ -0,0 +1,8 @@
++SAGE_SPKG_CONFIGURE([linbox], [
++  SAGE_SPKG_DEPCHECK([fflas-ffpack flint fplll givaro gmp iml m4ri m4rie mpfr ntl], [
++    PKG_CHECK_MODULES([LINBOX],
++                      [linbox >= 1.6.3],
++                      [],
++                      [sage_spkg_install_linbox=yes])
++  ])
++])
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
rename to srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
diff --git a/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch b/srcpkgs/sagemath/patches/trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
rename to srcpkgs/sagemath/patches/trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
diff --git a/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch b/srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
rename to srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
diff --git a/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch b/srcpkgs/sagemath/patches/trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
rename to srcpkgs/sagemath/patches/trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 622ee06d85b8..1ab0e9f7d65c 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -56,6 +56,10 @@ do_clean() {
 	rm -rf $wrksrc $_SAGE_ROOT
 }
 
+pre_configure() {
+	./bootstrap
+}
+
 # DISABLED pytest since it brings more harm than good
 # it seems currently all it does is to look for files matching
 # *_test.py and run pytest on those, but I don't think these are meant
@@ -79,8 +83,12 @@ do_install() {
 }
 
 do_check() {
+	TEST=--all
+	if [ -f ${XBPS_DISTDIR}/sagemath-check ] ; then
+		TEST="$(grep -v "^#" ${XBPS_DISTDIR}/sagemath-check)"
+	fi
 	# since make check will build the docs, run test like this instead
-	./sage -tp ${XBPS_MAKEJOBS} --all
+	./sage -tp ${XBPS_MAKEJOBS} ${TEST}
 }
 
 ### copied from sage-deps, to be kept in sync

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (71 preceding siblings ...)
  2021-11-26  3:04 ` [PR PATCH] [Updated] " tornaria
@ 2021-11-26  3:12 ` tornaria
  2021-11-26  9:30 ` dkwo
                   ` (4 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-26  3:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 596 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-979655784

Comment:
The new version uses system linbox. Also includes a patch to skip the doctest that fails because of giac 1.7.0 so we expect all tests to pass on x86_64 and x86_64-musl. As for i686, I'll ignore it for now, there are better ways to spend my time and I'm not even sure anyone will use it.

Most of the patches are expected to be merged upstream (probably soon, possibly for 9.5).

The main blocker at this time seems to be making it run on python 3.10.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (72 preceding siblings ...)
  2021-11-26  3:12 ` tornaria
@ 2021-11-26  9:30 ` dkwo
  2021-11-26  9:31 ` dkwo
                   ` (3 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-26  9:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 893 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-979820980

Comment:
Sounds reasonable.
On musl, the failures are not real (I think)
```
sage -t --random-seed=53597881869110074179920514523677232559 src/sage/parallel/map_reduce.py  # Timed out
sage -t --random-seed=53597881869110074179920514523677232559 src/sage/schemes/affine/affine_point.py  # Killed due to kill signal
```
Do you think python3.10 will make it into sage9.5?

Can you bring the `depends` down to what is really necessary, and make sure it removes properly with xbps-remove?
(last time I tried, it left behind `/usr/lib/sage..`)
Maybe this is creating issues?
```
# for now use sage-${version}_${revision} so it doesn't override
# other sage installed in the system
ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
```

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (73 preceding siblings ...)
  2021-11-26  9:30 ` dkwo
@ 2021-11-26  9:31 ` dkwo
  2021-11-26  9:33 ` dkwo
                   ` (2 subsequent siblings)
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-26  9:31 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 674 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-979820980

Comment:
Sounds reasonable.
On musl, the failures are not real (I think)
```
sage -t --random-seed=53597881869110074179920514523677232559 src/sage/parallel/map_reduce.py  # Timed out
sage -t --random-seed=53597881869110074179920514523677232559 src/sage/schemes/affine/affine_point.py  # Killed due to kill signal
```
Do you think python3.10 will make it into sage9.5?

Can you bring the `depends` down to what is really necessary, and make sure it removes properly with xbps-remove?
(last time I tried, it left behind `/usr/lib/sage..`)

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (74 preceding siblings ...)
  2021-11-26  9:31 ` dkwo
@ 2021-11-26  9:33 ` dkwo
  2021-11-26 13:10 ` tornaria
  2021-11-27 14:08 ` dkwo
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-26  9:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 699 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-979820980

Comment:
Sounds reasonable.
On musl, the failures are not real (I think) (and similar for i686)
```
sage -t --random-seed=53597881869110074179920514523677232559 src/sage/parallel/map_reduce.py  # Timed out
sage -t --random-seed=53597881869110074179920514523677232559 src/sage/schemes/affine/affine_point.py  # Killed due to kill signal
```

Do you think python3.10 will make it into sage9.5?

Can you bring the `depends` down to what is really necessary, and make sure it removes properly with xbps-remove?
(last time I tried, it left behind `/usr/lib/sage..`)

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (75 preceding siblings ...)
  2021-11-26  9:33 ` dkwo
@ 2021-11-26 13:10 ` tornaria
  2021-11-27 14:08 ` dkwo
  77 siblings, 0 replies; 79+ messages in thread
From: tornaria @ 2021-11-26 13:10 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1243 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-979968082

Comment:
> Sounds reasonable. On musl, the failures are not real (I think) (and similar for i686)
> 
> ```
> sage -t --random-seed=53597881869110074179920514523677232559 src/sage/parallel/map_reduce.py  # Timed out
> sage -t --random-seed=53597881869110074179920514523677232559 src/sage/schemes/affine/affine_point.py  # Killed due to kill signal
> ```

Why do you mean with "not real" ? Occasionally a timeout could be a false positive: when a test takes too long it could sometimes goes over the timeout (in that case it should has to be tagged as "# long test" so it's still a bug). All of these may be very real, just random. The failures on i686 are definitely real.
  
> Do you think python3.10 will make it into sage9.5?

I don't know, it's progressing slowly.

> Can you bring the `depends` down to what is really necessary,

What should I remove? We have to make sure all tests pass because a failed tests is a missing feature.

> and make sure it removes properly with xbps-remove? (last time I tried, it left behind `/usr/lib/sage..`)

Can you tell me which files are left behind?

^ permalink raw reply	[flat|nested] 79+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (76 preceding siblings ...)
  2021-11-26 13:10 ` tornaria
@ 2021-11-27 14:08 ` dkwo
  77 siblings, 0 replies; 79+ messages in thread
From: dkwo @ 2021-11-27 14:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1012 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-980633918

Comment:
With regard to removing:
```
[nicolo@mabragor void-packages]$ du /usr/lib/sage-9.5.beta7
du: cannot access '/usr/lib/sage-9.5.beta7': No such file or directory
nicolo@mabragor void-packages]$ xi sagemath
Size required on disk:        3846MB
doas xbps-remove -R sagemath
[nicolo@mabragor void-packages]$ du /usr/lib/sage-9.5.beta7/
4       /usr/lib/sage-9.5.beta7/local/share/gap/bin/x86_64-pc-linux-gnu-default64-kv7
8       /usr/lib/sage-9.5.beta7/local/share/gap/bin
12      /usr/lib/sage-9.5.beta7/local/share/gap
16      /usr/lib/sage-9.5.beta7/local/share
20      /usr/lib/sage-9.5.beta7/local
24      /usr/lib/sage-9.5.beta7/
```
With regard to `depends`: I'm not an expert, but I thought we should not need `-devel` packages to run it. Are tests supposed to pass even for the user or just in the build process?

As for the failures, you may be right.

^ permalink raw reply	[flat|nested] 79+ messages in thread

end of thread, other threads:[~2021-11-27 14:08 UTC | newest]

Thread overview: 79+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
2021-11-11 16:08 ` dkwo
2021-11-12  7:27 ` fosslinux
2021-11-12 20:16 ` dkwo
2021-11-12 20:22 ` dkwo
2021-11-12 20:28 ` dkwo
2021-11-12 20:37 ` dkwo
2021-11-12 22:06 ` fosslinux
2021-11-12 22:12 ` [PR REVIEW] " Duncaen
2021-11-13  1:27 ` tornaria
2021-11-13  1:30 ` tornaria
2021-11-13  1:33 ` tornaria
2021-11-13  3:14 ` [PR PATCH] [Updated] " tornaria
2021-11-13  3:18 ` tornaria
2021-11-13  8:59 ` dkwo
2021-11-13  9:02 ` dkwo
2021-11-13  9:28 ` dkwo
2021-11-13  9:36 ` dkwo
2021-11-13 10:22 ` dkwo
2021-11-13 10:48 ` dkwo
2021-11-13 10:50 ` [PR PATCH] [Updated] " tornaria
2021-11-13 10:59 ` tornaria
2021-11-13 11:05 ` tornaria
2021-11-13 11:42 ` tornaria
2021-11-13 12:30 ` dkwo
2021-11-13 13:48 ` dkwo
2021-11-13 13:50 ` dkwo
2021-11-13 13:53 ` leahneukirchen
2021-11-13 14:20 ` leahneukirchen
2021-11-13 14:22 ` leahneukirchen
2021-11-13 14:55 ` leahneukirchen
2021-11-13 14:58 ` leahneukirchen
2021-11-13 15:00 ` dkwo
2021-11-13 15:07 ` leahneukirchen
2021-11-13 15:11 ` leahneukirchen
2021-11-13 15:28 ` dkwo
2021-11-13 15:34 ` leahneukirchen
2021-11-14  4:42 ` ericonr
2021-11-14  4:43 ` ericonr
2021-11-14 14:27 ` leahneukirchen
2021-11-14 15:20 ` tornaria
2021-11-14 16:31 ` leahneukirchen
2021-11-14 21:28 ` [PR PATCH] [Updated] " tornaria
2021-11-14 21:47 ` tornaria
2021-11-15 15:58 ` leahneukirchen
2021-11-15 16:16 ` tornaria
2021-11-17  9:20 ` dkwo
2021-11-20 22:12 ` [PR PATCH] [Updated] " tornaria
2021-11-21  9:37 ` dkwo
2021-11-21 14:00 ` tornaria
2021-11-21 19:44 ` dkwo
2021-11-22 12:51 ` tornaria
2021-11-22 13:17 ` [WIP] New package: sagemath-9.5.beta7 dkwo
2021-11-22 14:30 ` [PR PATCH] [Updated] " tornaria
2021-11-22 14:35 ` tornaria
2021-11-22 14:55 ` tornaria
2021-11-22 15:22 ` tornaria
2021-11-22 15:30 ` dkwo
2021-11-22 15:30 ` dkwo
2021-11-22 15:41 ` dkwo
2021-11-22 16:30 ` dkwo
2021-11-22 16:35 ` tornaria
2021-11-22 17:09 ` dkwo
2021-11-22 17:28 ` tornaria
2021-11-22 17:52 ` dkwo
2021-11-22 23:41 ` tornaria
2021-11-23  3:22 ` [PR PATCH] [Updated] " tornaria
2021-11-23  3:25 ` tornaria
2021-11-23  9:22 ` dkwo
2021-11-23 12:16 ` tornaria
2021-11-24 19:28 ` tornaria
2021-11-25 22:41 ` tornaria
2021-11-26  3:04 ` [PR PATCH] [Updated] " tornaria
2021-11-26  3:12 ` tornaria
2021-11-26  9:30 ` dkwo
2021-11-26  9:31 ` dkwo
2021-11-26  9:33 ` dkwo
2021-11-26 13:10 ` tornaria
2021-11-27 14:08 ` dkwo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).