@@ -9,6 +9,20 @@
99# This is done because multiple derivations rely on these sources and they should
1010# all get the same sources with the same patches applied.
1111
12+let
13+ # Fetch a diff between `base` and `rev` on sage's git server.
14+ # Used to fetch trac tickets by setting the `base` to the last release and the
15+ # `rev` to the last commit of the ticket.
16+ fetchSageDiff = { base, name, rev, sha256, ...}@args: (
17+ fetchpatch ({
18+ inherit name sha256;
19+ url = "https://git.sagemath.org/sage.git/patch?id2=${base}&id=${rev}";
20+ # We don't care about sage's own build system (which builds all its dependencies).
21+ # Exclude build system changes to avoid conflicts.
22+ excludes = [ "build/*" ];
23+ } // builtins.removeAttrs args [ "rev" "base" "sha256" ])
24+ );
25+in
1226stdenv.mkDerivation rec {
1327 version = "9.2";
1428 pname = "sage-src";
@@ -40,17 +54,13 @@ stdenv.mkDerivation rec {
4054 # https://groups.google.com/forum/#!topic/sage-packaging/YGOm8tkADrE
4155 ./patches/sphinx-docbuild-subprocesses.patch
4256
43− # Sage's workaround to pretty print dicts (in
44− # src/sage/doctest/forker.py:init_sage) runs too late (after
45− # controller.load_environment(), which imports sage.all.*) to to
46− # affect sage.sandpiles.Sandpile{Config,Divisor}'s pretty printer.
47− # Due to the sandpiles module being lazily loaded, this only
48− # affects the first run (subsequent runs read from an import cache
49− # at ~/.sage/cache and are not affected), which is probably why
50− # other distributions don't hit this bug. This breaks two sandpile
51− # tests, so do the workaround a little bit earlier.
52− # https://trac.sagemath.org/ticket/31053
53− ./patches/register-pretty-printer-earlier.patch
57+ # Register sorted dict pprinter earlier (https://trac.sagemath.org/ticket/31053)
58+ (fetchSageDiff {
59+ base = "9.3.beta4";
60+ name = "register-pretty-printer-earlier.patch";
61+ rev = "d658230ce06ca19f4a3b3a4576297ee82f2d2151";
62+ sha256 = "sha256-9mPUV7K5PoLDH2vVaYaOfvDLDpmxU0Aj7m/eaXYotDs=";
63+ })
5464 ];
5565
5666 # Since sage unfortunately does not release bugfix releases, packagers must
@@ -63,17 +73,20 @@ stdenv.mkDerivation rec {
6373
6474 # fix intermittent errors in Sage 9.2's psage.py (this patch is
6575 # already included in Sage 9.3): https://trac.sagemath.org/ticket/30730
66− (fetchpatch {
76+ (fetchSageDiff {
77+ base = "9.2.rc2";
6778 name = "fix-psage-is-locked.patch";
68− url = "https://git.sagemath.org/sage.git/patch/?id=75df605f216ddc7b6ca719be942d666b241520e9";
79+ rev = "75df605f216ddc7b6ca719be942d666b241520e9";
6980 sha256 = "0g9pl1wbb3sgs26d3bvv70cpa77sfskylv4kd255y1794f1fgk4q";
7081 })
7182
7283 # fix intermittent errors in sagespawn.pyx: https://trac.sagemath.org/ticket/31052
73− ./patches/sagespawn-implicit-casting.patch
74−
75− # disable pexpect interrupt test (see https://trac.sagemath.org/ticket/30945)
76− ./patches/disable-pexpect-intermittent-failure.patch
84+ (fetchSageDiff {
85+ base = "9.2";
86+ name = "sagespawn-implicit-casting.patch";
87+ rev = "2959ac792ebd6107fe87c9af1541083de5ba02d6";
88+ sha256 = "sha256-bWIpEGir9Kawak5CJegBMNcHm/CqhWmdru+emeSsvO0=";
89+ })
7790 ];
7891
7992 # Patches needed because of package updates. We could just pin the versions of
@@ -82,20 +95,7 @@ stdenv.mkDerivation rec {
8295 # compatible with never dependency versions when possible. All these changes
8396 # should come from or be proposed to upstream. This list will probably never
8497 # be empty since dependencies update all the time.
85− packageUpgradePatches = let
86− # Fetch a diff between `base` and `rev` on sage's git server.
87− # Used to fetch trac tickets by setting the `base` to the last release and the
88− # `rev` to the last commit of the ticket.
89− fetchSageDiff = { base, rev, name ? "sage-diff-${base}-${rev}.patch", ...}@args: (
90− fetchpatch ({
91− inherit name;
92− url = "https://git.sagemath.org/sage.git/patch?id2=${base}&id=${rev}";
93− # We don't care about sage's own build system (which builds all its dependencies).
94− # Exclude build system changes to avoid conflicts.
95− excludes = [ "build/*" ];
96− } // builtins.removeAttrs args [ "rev" "base" ])
97− );
98− in [
98+ packageUpgradePatches = [
9999 # After updating smypow to (https://trac.sagemath.org/ticket/3360) we can
100100 # now set the cache dir to be withing the .sage directory. This is not
101101 # strictly necessary, but keeps us from littering in the user's HOME.
@@ -105,7 +105,20 @@ stdenv.mkDerivation rec {
105105 ./patches/ignore-cmp-deprecation.patch
106106
107107 # adapt sage's Image class to pillow 8.0.1 (https://trac.sagemath.org/ticket/30971)
108− ./patches/pillow-update.patch
108+ (fetchSageDiff {
109+ base = "9.3.beta2";
110+ name = "pillow-8.0.1-update.patch";
111+ rev = "f05f2d0aac9c4b5abe68105cee2cc7f2c8461847";
112+ sha256 = "sha256-uY2UlgSd5hhOUUukB4Xc3Gjy0/e7p/qyq9jdvz10IOs=";
113+ })
114+
115+ # don't use deprecated numpy type aliases (https://trac.sagemath.org/ticket/31364)
116+ (fetchSageDiff {
117+ base = "9.3.beta7";
118+ name = "dont-use-deprecated-numpy-type-aliases.patch";
119+ rev = "dfdef60515d4a4269e82d91280f76a7fdf10bf97";
120+ sha256 = "sha256-77/3LkT5J7DQN8IPlGJKB6ZcJPaF7xwje06JNns+0AE=";
121+ })
109122
110123 # fix test output with sympy 1.7 (https://trac.sagemath.org/ticket/30985)
111124 ./patches/sympy-1.7-update.patch
@@ -115,6 +128,31 @@ stdenv.mkDerivation rec {
115128
116129 # updated eclib output has punctuation changes and tidier whitespace
117130 ./patches/eclib-20210223-test-formatting.patch
131+
132+ # upgrade arb to 2.18.1 (https://trac.sagemath.org/ticket/28623)
133+ (fetchSageDiff {
134+ base = "9.3.beta3";
135+ name = "arb-2.18.1-update.patch";
136+ rev = "0c9c4ed35c2eaf34ae0d19387c07b7f460e4abce";
137+ sha256 = "sha256-CjOJIsyyVCziAfvE6pWSihPO35IZMcY2/taXAsqhPLY=";
138+ })
139+
140+ # giac 1.6.0-47 update (https://trac.sagemath.org/ticket/30537)
141+ (fetchSageDiff {
142+ base = "9.3.beta7";
143+ name = "giac-1.6.0-47-update.patch";
144+ rev = "f05720bf63dfaf33a4e3b6d3ed2c2c0ec46b5d31";
145+ sha256 = "sha256-gDUq+84eXd5GxLBWUSI61GMJpBF2KX4LBVOt3mS1NF8=";
146+ })
147+
148+ # Make gcd/lcm interact better with pari and gmpy2 (https://trac.sagemath.org/ticket/30849)
149+ # needed for pari 2.13.1 update, which we will do in the future
150+ (fetchSageDiff {
151+ base = "9.3.beta0";
152+ name = "make-gcd-lcm-interact-better-with-pari-and-gmpy2.patch";
153+ rev = "75c1516f0abb9e6f8c335e38e4031f6ef674ed30";
154+ sha256 = "sha256-RukkieIZcXNrju904H2oyGKdtpdE+9vNzvyjN2IBNg0=";
155+ })
118156 ];
119157
120158 patches = nixPatches ++ bugfixPatches ++ packageUpgradePatches;