From 9847e84d55497cb5e577a5cbc65407d9c731dff1 Mon Sep 17 00:00:00 2001 From: Mauricio Collares Date: Wed, 5 May 2021 08:59:56 -0300 Subject: [PATCH] pari: 2.11.4 -> 2.13.1, update sage test expectations --- .../science/math/pari/default.nix | 17 +++++-- .../science/math/pari/rnfdisc.patch | 51 +++++++++++++++++++ .../science/math/sage/sage-src.nix | 12 +++++ 3 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 pkgs/applications/science/math/pari/rnfdisc.patch diff --git a/pkgs/applications/science/math/pari/default.nix b/pkgs/applications/science/math/pari/default.nix index a99cbbbe0df..fc1a2e0abf8 100644 --- a/pkgs/applications/science/math/pari/default.nix +++ b/pkgs/applications/science/math/pari/default.nix @@ -12,14 +12,23 @@ assert withThread -> libpthreadstubs != null; stdenv.mkDerivation rec { pname = "pari"; - version = "2.11.4"; + version = "2.13.1"; src = fetchurl { - # Versions with current majorMinor values are at http://pari.math.u-bordeaux.fr/pub/pari/unix/${pname}-${version}.tar.gz - url = "https://pari.math.u-bordeaux.fr/pub/pari/OLD/${lib.versions.majorMinor version}/${pname}-${version}.tar.gz"; - sha256 = "sha256-v8iPxPc1L0hA5uNSxy8DacvqikVAOxg0piafNwmXCxw="; + urls = [ + "https://pari.math.u-bordeaux.fr/pub/pari/unix/${pname}-${version}.tar.gz" + # old versions are at the url below + "https://pari.math.u-bordeaux.fr/pub/pari/OLD/${lib.versions.majorMinor version}/${pname}-${version}.tar.gz" + ]; + sha256 = "sha256-gez31wzNquIwFlz/Ynyc4uwpe48i+fQHQiedhfht/LE="; }; + patches = [ + # rebased version of 3edb98db78, see + # https://pari.math.u-bordeaux.fr/cgi-bin/bugreport.cgi?bug=2284 + ./rnfdisc.patch + ]; + buildInputs = [ gmp readline diff --git a/pkgs/applications/science/math/pari/rnfdisc.patch b/pkgs/applications/science/math/pari/rnfdisc.patch new file mode 100644 index 00000000000..6acac96481d --- /dev/null +++ b/pkgs/applications/science/math/pari/rnfdisc.patch @@ -0,0 +1,51 @@ +commit 0d8a3ac970291c62b56104172418b3f2ca30927c +Author: Bill Allombert +Date: Sun Mar 28 13:27:24 2021 +0200 + + rnfdisc_factored: remove spurious Q_primpart [#2284] + +diff --git a/src/basemath/base2.c b/src/basemath/base2.c +index 7e7d0db9d..c461826f4 100644 +--- a/src/basemath/base2.c ++++ b/src/basemath/base2.c +@@ -3582,7 +3582,7 @@ rnfdisc_factored(GEN nf, GEN pol, GEN *pd) + + nf = checknf(nf); + pol = rnfdisc_get_T(nf, pol, &lim); +- disc = nf_to_scalar_or_basis(nf, nfX_disc(nf, Q_primpart(pol))); ++ disc = nf_to_scalar_or_basis(nf, nfX_disc(nf, pol)); + pol = nfX_to_monic(nf, pol, NULL); + fa = idealfactor_partial(nf, disc, lim); + P = gel(fa,1); l = lg(P); +diff --git a/src/test/32/rnf b/src/test/32/rnf +index 1e743f415..c016dce00 100644 +--- a/src/test/32/rnf ++++ b/src/test/32/rnf +@@ -853,9 +853,10 @@ error("inconsistent dimensions in idealtwoelt.") + 0 + 0 + 1 +-[[7361, 3786, 318, 5823; 0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1], [-3, 6, -2, 0] +-~] +-[2, -1] ++[[433, 322, 318, 1318/17; 0, 1, 0, 12/17; 0, 0, 1, 5/17; 0, 0, 0, 1/17], [25 ++/17, -12/17, 12/17, 16/17]~] ++[1, -1] ++[[12, 0, 0, 0; 0, 12, 4, 0; 0, 0, 4, 0; 0, 0, 0, 4], [6, 5, -1, 2]~] + *** at top-level: rnfdedekind(nf,P,pr2,1) + *** ^----------------------- + *** rnfdedekind: sorry, Dedekind in the difficult case is not yet implemented. +diff --git a/src/test/in/rnf b/src/test/in/rnf +index 7851ae291..318d5349e 100644 +--- a/src/test/in/rnf ++++ b/src/test/in/rnf +@@ -212,6 +212,9 @@ k = nfinit(y^4 + 10*y^2 + 17); + rnfdisc(k, x^2 - x + 1/Mod(y,k.pol)) + rnfdisc(k, x^2 - x + 1/2) + ++k = nfinit(y^4 - 10*y^2 + 1); ++rnfdisc(k,x^2-(y^3/2+y^2-5*y/2+1)) ++ + \\ ERRORS, keep at end of file + rnfdedekind(nf, P, pr2, 1) + rnfdedekind(nf, P) diff --git a/pkgs/applications/science/math/sage/sage-src.nix b/pkgs/applications/science/math/sage/sage-src.nix index 91e855777f0..53df7c65d52 100644 --- a/pkgs/applications/science/math/sage/sage-src.nix +++ b/pkgs/applications/science/math/sage/sage-src.nix @@ -78,6 +78,18 @@ stdenv.mkDerivation rec { # ignore a deprecation warning for usage of `cmp` in the attrs library in the doctests ./patches/ignore-cmp-deprecation.patch + + # https://trac.sagemath.org/ticket/30801. this patch has + # positive_review but has not been merged upstream yet, so we + # don't use fetchSageDiff because it returns a file that contains + # each commit as a separate patch instead of a single diff, and + # some commits from the pari update branch are already in 9.3.rc5 + # (auto-resolvable merge conflicts). + (fetchpatch { + name = "pari-2.13.1.patch"; + url = "https://github.com/sagemath/sagetrac-mirror/compare/d6c5cd9be78cc448ee4c54bac93385b1244a234c...10a4531721d2700fd717e2b3a1364508ffd971c3.diff"; + sha256 = "sha256-zMjRMEReoiTvmt+vvV0Ij1jtyLSLwSXBEVXqgvmq1D4="; + }) ]; patches = nixPatches ++ bugfixPatches ++ packageUpgradePatches;