julia: init julia_16-bin at 1.6.1

Relevant patches lifted from the `release-1.6` branch of my Julia fork:

    https://git.sr.ht/~ninjin/julia-nix/tree/release-1.6
This commit is contained in:
Pontus Stenetorp 2021-04-24 15:42:14 +00:00
parent c58b97674b
commit 351f9114b0
No known key found for this signature in database
GPG key ID: D430287500E6483C
5 changed files with 162 additions and 0 deletions

View file

@ -0,0 +1,73 @@
{ autoPatchelfHook, fetchurl, lib, stdenv }:
stdenv.mkDerivation rec {
pname = "julia-bin";
version = "1.6.1";
src = {
x86_64-linux = fetchurl {
url = "https://julialang-s3.julialang.org/bin/linux/x64/${lib.versions.majorMinor version}/julia-${version}-linux-x86_64.tar.gz";
sha256 = "01i5sm4vqb0y5qznql571zap19b42775drrcxnzsyhpaqgg8m23w";
};
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
# Julias source files are in different locations for source and binary
# releases. Thus we temporarily create a symlink to allow us to share patches
# with source releases.
prePatch = ''
ln -s share/julia/test
'';
patches = [
# Source release Nix patch(es) relevant for binary releases as well.
./patches/1.6-bin/0002-nix-Skip-tempname-test-broken-in-sandbox.patch
./patches/1.6-bin/0003-nix-Skip-chown-tests-broken-in-sandbox.patch
./patches/1.6-bin/0005-nix-Enable-parallel-unit-tests-for-sandbox.patch
];
postPatch = ''
# Revert symlink hack.
rm test
# Julia fails to pick up our Certification Authority root certificates, but
# it provides its own so we can simply disable the test. Patching in the
# dynamic path to ours require us to rebuild the Julia system image.
substituteInPlace share/julia/stdlib/v${lib.versions.majorMinor version}/NetworkOptions/test/runtests.jl \
--replace '@test ca_roots_path() != bundled_ca_roots()' \
'@test_skip ca_roots_path() != bundled_ca_roots()'
'';
nativeBuildInputs = [ autoPatchelfHook ];
installPhase = ''
runHook preInstall
cp -r . $out
runHook postInstall
'';
# Breaks backtraces, etc.
dontStrip = true;
doInstallCheck = true;
preInstallCheck = ''
# Some tests require read/write access to $HOME.
export HOME="$TMPDIR"
'';
installCheckPhase = ''
runHook preInstallCheck
# Command lifted from `test/Makefile`.
$out/bin/julia \
--check-bounds=yes \
--startup-file=no \
--depwarn=error \
$out/share/julia/test/runtests.jl
runHook postInstallCheck
'';
meta = {
description = "High-level, high-performance dynamic language for technical computing.";
homepage = "https://julialang.org";
# Bundled and linked with various GPL code, although Julia itself is MIT.
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ ninjin raskin ];
platforms = [ "x86_64-linux" ];
};
}

View file

@ -0,0 +1,28 @@
From ffe227676352a910754d96d92e9b06e475f28ff1 Mon Sep 17 00:00:00 2001
From: Pontus Stenetorp <pontus@stenetorp.se>
Date: Thu, 8 Apr 2021 04:25:19 +0000
Subject: [PATCH 2/6] nix: Skip `tempname` test broken in sandbox
Reported upstream:
https://github.com/JuliaLang/julia/issues/38873
---
test/file.jl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/file.jl b/test/file.jl
index 0f39bc7c14..bd4dd78f62 100644
--- a/test/file.jl
+++ b/test/file.jl
@@ -95,7 +95,7 @@ end
@test dirname(t) == tempdir()
mktempdir() do d
t = tempname(d)
- @test dirname(t) == d
+ @test_skip dirname(t) == d
end
@test_throws ArgumentError tempname(randstring())
end
--
2.29.3

View file

@ -0,0 +1,27 @@
From b20357fb1044d2c100172b1d5cbdf6c6d9bd3590 Mon Sep 17 00:00:00 2001
From: Pontus Stenetorp <pontus@stenetorp.se>
Date: Thu, 8 Apr 2021 05:10:39 +0000
Subject: [PATCH 3/6] nix: Skip `chown` tests broken in sandbox
---
test/file.jl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/file.jl b/test/file.jl
index bd4dd78f62..06fd4e49da 100644
--- a/test/file.jl
+++ b/test/file.jl
@@ -503,8 +503,8 @@ if !Sys.iswindows()
@test stat(file).gid == 0
@test stat(file).uid == 0
else
- @test_throws Base._UVError("chown($(repr(file)), -2, -1)", Base.UV_EPERM) chown(file, -2, -1) # Non-root user cannot change ownership to another user
- @test_throws Base._UVError("chown($(repr(file)), -1, -2)", Base.UV_EPERM) chown(file, -1, -2) # Non-root user cannot change group to a group they are not a member of (eg: nogroup)
+ @test_skip @test_throws Base._UVError("chown($(repr(file)), -2, -1)", Base.UV_EPERM) chown(file, -2, -1) # Non-root user cannot change ownership to another user
+ @test_skip @test_throws Base._UVError("chown($(repr(file)), -1, -2)", Base.UV_EPERM) chown(file, -1, -2) # Non-root user cannot change group to a group they are not a member of (eg: nogroup)
end
else
# test that chown doesn't cause any errors for Windows
--
2.29.3

View file

@ -0,0 +1,30 @@
From 44c2c979c4f2222567ce65f506cf47fb87482348 Mon Sep 17 00:00:00 2001
From: Pontus Stenetorp <pontus@stenetorp.se>
Date: Thu, 8 Apr 2021 04:37:44 +0000
Subject: [PATCH 5/6] nix: Enable parallel unit tests for sandbox
Disabled by default due to lack of networking in the Nix sandbox. This
greatly speeds up the build process on a multi-core system.
---
test/runtests.jl | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/runtests.jl b/test/runtests.jl
index 2f9cd058bb..2f8c19fa32 100644
--- a/test/runtests.jl
+++ b/test/runtests.jl
@@ -83,8 +83,9 @@ prepend!(tests, linalg_tests)
import LinearAlgebra
cd(@__DIR__) do
n = 1
- if net_on
- n = min(Sys.CPU_THREADS, length(tests))
+ if net_on || haskey(ENV, "NIX_BUILD_CORES")
+ x = haskey(ENV, "NIX_BUILD_CORES") ? parse(Int, ENV["NIX_BUILD_CORES"]) : Sys.CPU_THREADS
+ n = min(x, Sys.CPU_THREADS, length(tests))
n > 1 && addprocs_with_testenv(n)
LinearAlgebra.BLAS.set_num_threads(1)
end
--
2.29.3

View file

@ -11113,6 +11113,10 @@ in
julia-stable = julia_15;
julia = julia-lts;
julia_16-bin = callPackage ../development/compilers/julia/1.6-bin.nix { };
julia-stable-bin = julia_16-bin;
jwasm = callPackage ../development/compilers/jwasm { };
knightos-genkfs = callPackage ../development/tools/knightos/genkfs { };