From 05ae6fe4530e05fb743e9e6d11c49cf28d2ca3cd Mon Sep 17 00:00:00 2001 From: Jerry James Date: Thu, 26 Sep 2019 13:15:26 -0600 Subject: [PATCH] Rebuild for ntl 11.4.0. Add primecount support, including the -primecount patch. Add still more gap packages, nearly finishing the set shipped by upstream. --- sagemath-extensions.patch | 14 ++++- sagemath-primecount.patch | 110 ++++++++++++++++++++++++++++++++++++++ sagemath.spec | 28 ++++++++-- 3 files changed, 148 insertions(+), 4 deletions(-) create mode 100644 sagemath-primecount.patch diff --git a/sagemath-extensions.patch b/sagemath-extensions.patch index 4aa640e..7e28575 100644 --- a/sagemath-extensions.patch +++ b/sagemath-extensions.patch @@ -1,6 +1,6 @@ diff -up src/module_list.py.orig src/module_list.py --- src/module_list.py.orig 2019-06-26 14:41:04.000000000 -0600 -+++ src/module_list.py 2019-09-11 08:38:22.467995023 -0600 ++++ src/module_list.py 2019-09-17 16:06:38.678583204 -0600 @@ -357,16 +357,16 @@ ext_modules = [ Extension('sage.graphs.matchpoly', sources = ['sage/graphs/matchpoly.pyx']), @@ -38,6 +38,18 @@ diff -up src/module_list.py.orig src/module_list.py Extension('sage.graphs.spanning_tree', sources = ['sage/graphs/spanning_tree.pyx']), +@@ -440,9 +440,9 @@ ext_modules = [ + ## + ################################ + +- OptionalExtension("sage.interfaces.primecount", ++ Extension("sage.interfaces.primecount", + ["sage/interfaces/primecount.pyx"], +- package = "primecount"), ++ libraries = ["primecount"]), + + Extension('*', ['sage/interfaces/*.pyx']), + @@ -461,21 +461,19 @@ ext_modules = [ ## ################################ diff --git a/sagemath-primecount.patch b/sagemath-primecount.patch new file mode 100644 index 0000000..29434b8 --- /dev/null +++ b/sagemath-primecount.patch @@ -0,0 +1,110 @@ +diff -up src/sage/interfaces/primecount.pyx.orig src/sage/interfaces/primecount.pyx +--- src/sage/interfaces/primecount.pyx.orig 2019-06-26 14:41:04.000000000 -0600 ++++ src/sage/interfaces/primecount.pyx 2019-09-17 16:13:46.316032782 -0600 +@@ -22,7 +22,7 @@ cdef inline int _do_sig(int64_t n): + "threshold for sig_on/sig_off" + return n >> 26 + +-cpdef int64_t prime_pi(int64_t n, method=None) except -1: ++cpdef int64_t prime_pi(int64_t n) except -1: + r""" + Return the number of prime numbers smaller or equal than ``n``. + +@@ -30,76 +30,22 @@ cpdef int64_t prime_pi(int64_t n, method + + - ``n`` - an integer + +- - ``method`` - ``None`` or a string that determines the primecount +- function to be called +- +- - ``"deleglise_rivat"`` +- - ``"legendre"`` +- - ``"lehmer"`` +- - ``"lmo"`` +- - ``"meissel"`` +- - ``"primesieve"`` +- + EXAMPLES:: + + sage: from sage.interfaces.primecount import prime_pi # optional - primecount + + sage: prime_pi(1000) == 168 # optional - primecount + True +- sage: prime_pi(1000, "deleglise_rivat") == 168 # optional - primecount +- True +- sage: prime_pi(1000, "legendre") == 168 # optional - primecount +- True +- sage: prime_pi(1000, "lehmer") == 168 # optional - primecount +- True +- sage: prime_pi(1000, "lmo") == 168 # optional - primecount +- True +- sage: prime_pi(1000, "meissel") == 168 # optional - primecount +- True +- sage: prime_pi(1000, "primesieve") == 168 # optional - primecount +- True +- sage: prime_pi(1000, "youpi") # optional - primecount +- Traceback (most recent call last): +- ... +- ValueError: unknown method 'youpi' + """ + cdef int64_t ans +- if method is None: +- if _do_sig(n): sig_on() +- ans = primecount.pi(n) +- if _do_sig(n): sig_off() +- elif method == "deleglise_rivat": +- if _do_sig(n): sig_on() +- ans = primecount.pi_deleglise_rivat(n) +- if _do_sig(n): sig_off() +- elif method == "legendre": +- if _do_sig(n): sig_on() +- ans = primecount.pi_legendre(n) +- if _do_sig(n): sig_off() +- elif method == "lehmer": +- if _do_sig(n): sig_on() +- ans = primecount.pi_lehmer(n) +- if _do_sig(n): sig_off() +- elif method == "lmo": +- if _do_sig(n): sig_on() +- ans = primecount.pi_lmo(n) +- if _do_sig(n): sig_off() +- elif method == "meissel": +- if _do_sig(n): sig_on() +- ans = primecount.pi_meissel(n) +- if _do_sig(n): sig_off() +- elif method == "primesieve": +- if _do_sig(n): sig_on() +- ans = primecount.pi_primesieve(n) +- if _do_sig(n): sig_off() +- else: +- raise ValueError("unknown method {!r}".format(method)) +- ++ if _do_sig(n): sig_on() ++ ans = primecount.pi(n) ++ if _do_sig(n): sig_off() + return ans + + cpdef prime_pi_128(n): + r""" +- Return the number of prime number smaller than ``n``. ++ Return the number of prime numbers smaller than ``n``. + + EXAMPLES:: + +diff -up src/sage/libs/primecount.pxd.orig src/sage/libs/primecount.pxd +--- src/sage/libs/primecount.pxd.orig 2019-06-26 14:41:05.000000000 -0600 ++++ src/sage/libs/primecount.pxd 2019-09-17 16:11:06.678851358 -0600 +@@ -9,13 +9,6 @@ cdef extern from "primecount.hpp" namesp + + cppstring pi(const cppstring& x) + +- int64_t pi_deleglise_rivat(int64_t x) +- int64_t pi_legendre(int64_t x) +- int64_t pi_lehmer(int64_t x) +- int64_t pi_lmo(int64_t x) +- int64_t pi_meissel(int64_t x) +- int64_t pi_primesieve(int64_t x) +- + int64_t nth_prime(int64_t n) + + int64_t phi(int64_t x, int64_t a) diff --git a/sagemath.spec b/sagemath.spec index 6d31114..7037fc6 100644 --- a/sagemath.spec +++ b/sagemath.spec @@ -77,7 +77,7 @@ %endif # Spkg equivalents of required rpms; we pretend they are installed as spkgs. -%global SAGE_REQUIRED_PKGS 4ti2-1.6.9 bliss-0.73 cbc-2.10.3 CoCoALib-0.99601 coxeter3-1.1 cryptominisat-5.6.8 database_cremona_ellcurve-%{cremona_ver} gap_packages-4.10.2 gmp-6.1.2 libsirocco-2.0 lrslib-070 mcqd-1.0 qepcad-B.1.72 saclib-2.2.7 surf-1.0.6-gcc6 +%global SAGE_REQUIRED_PKGS 4ti2-1.6.9 bliss-0.73 cbc-2.10.3 CoCoALib-0.99601 coxeter3-1.1 cryptominisat-5.6.8 database_cremona_ellcurve-%{cremona_ver} gap_packages-4.10.2 gmp-6.1.2 libsirocco-2.0 lrslib-070 mcqd-1.0 primecount-5.1 qepcad-B.1.72 saclib-2.2.7 surf-1.0.6-gcc6 %ifarch %{ix86} x86_64 %global SAGE_REQUIRED_PKGS %{SAGE_REQUIRED_PKGS} fes-0.2 @@ -95,7 +95,7 @@ Name: sagemath Summary: A free open-source mathematics software system Version: 8.8 -Release: 5%{?dist} +Release: 6%{?dist} # The file ${SAGE_ROOT}/COPYING.txt is the upstream license breakdown file # Additionally, every $files section has a comment with the license name # before files with that license @@ -220,6 +220,9 @@ Patch32: %{name}-sagenb-python3.patch # https://git.sagemath.org/sage.git/commit/?id=bbd5b28fc8e451bea4f87c2f2b0c27586386262a Patch33: %{name}-formatargspec.patch +# Adapt to primecount 5.x +Patch34: %{name}-primecount.patch + BuildRequires: 4ti2 BuildRequires: arb-devel BuildRequires: bliss-devel @@ -242,6 +245,7 @@ BuildRequires: gap BuildRequires: GAPDoc BuildRequires: gap-libs BuildRequires: gap-pkg-atlasrep +BuildRequires: gap-pkg-corelg BuildRequires: gap-pkg-crime BuildRequires: gap-pkg-design BuildRequires: gap-pkg-forms @@ -250,6 +254,11 @@ BuildRequires: gap-pkg-guava BuildRequires: gap-pkg-hapcryst BuildRequires: gap-pkg-hecke BuildRequires: gap-pkg-jupyterviz +BuildRequires: gap-pkg-liealgdb +BuildRequires: gap-pkg-liepring +BuildRequires: gap-pkg-loops +BuildRequires: gap-pkg-mapclass +BuildRequires: gap-pkg-repsn BuildRequires: gap-pkg-singular BuildRequires: gap-pkg-sonata BuildRequires: gap-pkg-toric @@ -302,6 +311,7 @@ BuildRequires: pari-seadata BuildRequires: perl-generators BuildRequires: planarity-devel BuildRequires: ppl-devel +BuildRequires: primecount-devel BuildRequires: pynac-devel BuildRequires: python3-devel BuildRequires: python3-cypari2-devel @@ -419,6 +429,7 @@ Requires: 4ti2 Requires: cddlib-tools Requires: gap Requires: gap-pkg-atlasrep +Requires: gap-pkg-corelg Requires: gap-pkg-crime Requires: gap-pkg-design Requires: gap-pkg-forms @@ -427,6 +438,11 @@ Requires: gap-pkg-guava Requires: gap-pkg-hapcryst Requires: gap-pkg-hecke Requires: gap-pkg-jupyterviz +Requires: gap-pkg-liealgdb +Requires: gap-pkg-liepring +Requires: gap-pkg-loops +Requires: gap-pkg-mapclass +Requires: gap-pkg-repsn Requires: gap-pkg-sonata Requires: gap-pkg-toric Requires: gfan @@ -908,6 +924,7 @@ popd %patch31 %patch32 %patch33 +%patch34 sed -e 's|@@SAGE_ROOT@@|%{SAGE_ROOT}|' \ -e 's|@@SAGE_DOC@@|%{SAGE_DOC}|' \ @@ -1889,7 +1906,7 @@ rm -fr %{SAGE_LOCAL}/var/lib/sage/installed/database_cremona_ellcurve-%{cremona_ %lang(uk_UA) %{python3_sitearch}/sagenb/translations/uk_UA %if %{with bundled_widgetsnbextension} %config(noreplace) %{_sysconfdir}/jupyter/nbconfig/notebook.d/*.json -%{_datadir}/jupyter/nbextensions/ +%{_datadir}/jupyter/nbextensions/* %{python3_sitelib}/widgetsnbextension* %endif %{_datadir}/jupyter/kernels/sagemath/ @@ -1916,6 +1933,11 @@ rm -fr %{SAGE_LOCAL}/var/lib/sage/installed/database_cremona_ellcurve-%{cremona_ ######################################################################## %changelog +* Thu Sep 26 2019 Jerry James - 8.8-6 +- Rebuild for ntl 11.4.0 +- Add primecount support, including the -primecount patch +- Add still more gap packages, nearly finishing the set shipped by upstream + * Thu Sep 12 2019 Jerry James - 8.8-5 - Improve the -ecm patch - Add -formatargspec patch to silence doc-building warnings