From bd5133e708542ffdfb3ae5131636d3db3c58f4fa Mon Sep 17 00:00:00 2001 From: ngam <67342040+ngam@users.noreply.github.com> Date: Wed, 29 Dec 2021 17:41:23 -0500 Subject: [PATCH] reorganize & cleanup (#157) * set JULIA_DEPOT_PATH when conda env activated * simplify recipe and add back up variables * don't run juliarc.jl * improve activate.d/deactivate.d file editing * Apply suggestions from code review by @mkitti * This uses the activate.sh and deactivate.sh scripts that backup the environment variable. * Create a new shared environment located in the site depot for the environment rather than continuing to use the default one in ~/.julia/environments/v#.#. * reorganize * increase bld no * try building osx with system mbedtls * only apply three new patches to linux for now * reorganize order of patches * Revert "try building osx with system mbedtls" This reverts commit 1b1d1708c486cdb9d92f9ea2199c3621e5f4963f. * comment out juliarc.jl * Update build.sh * try runtests math for osx * test "opaque_closure", "filesystem" * go all in on testing * revert previous; parallelize + add "math" to list - use all processors: ncores=ceil(Int, Sys.CPU_THREADS - move math up to regular tests (no longer necessary to stop it from running on osx) * Update build.sh * Update activate.sh * Revert "Update activate.sh" This reverts commit fe2b9c9e7c6ab9836fc34ccaadd6c97d13558fa6. * new patches * correct patches in meta * change of patches * Update meta.yaml * Modify patch to match upstream JuliaLang/julia#42358. Use addenv. * Re-add JULIA_PROJECT to be "@$CONDA_DEFAULT_ENV" * Revert "Re-add JULIA_PROJECT to be "@$CONDA_DEFAULT_ENV"" This reverts commit 1e312a12bc4722885fcd896488bca53b2cedc838. * Set JULIA_PROJECT and JULIA_LOAD_PATH according to conda environment * Test loading and cmdlineargs with default JULIA_PROJECT * Extract env name as last directory of CONDA_PREFIX * Remove JULIA_LOAD_PATH while testing loading * Update build.sh * Delete recipe/old_unused directory * reorganize patches and delete unnecessary files * remove DS_STORE * oops place back patches * Apply suggestions from code review, remove "unique" Co-authored-by: ngam <67342040+ngam@users.noreply.github.com> Co-authored-by: Matt Johnson Co-authored-by: Mark Kittisopikul Co-authored-by: Mark Kittisopikul --- recipe/build.sh | 11 +++++--- recipe/juliarc.jl | 6 ----- recipe/meta.yaml | 24 ++++++++++-------- ...-disable-testing-Vararg-Int-N-where.patch} | 8 +++--- .../0002-disable-testing-Baz.baz-1.patch} | 10 ++++---- ...03-correct-test-for-julia-depot-path.patch | 25 +++++++++++++++++++ .../{ => patches}/julia-hardcoded-libs.patch | 0 recipe/{ => patches}/libgit2-patch.diff | 0 recipe/pre-unlink.sh | 1 - recipe/scripts/activate.sh | 14 +++++++++++ recipe/scripts/deactivate.sh | 17 +++++++++++++ 11 files changed, 86 insertions(+), 30 deletions(-) delete mode 100644 recipe/juliarc.jl rename recipe/{0001-fixing-core.jl-tests.patch => patches/0001-disable-testing-Vararg-Int-N-where.patch} (79%) rename recipe/{0002-Baz.baz-temporary-deletion.patch => patches/0002-disable-testing-Baz.baz-1.patch} (71%) create mode 100644 recipe/patches/0003-correct-test-for-julia-depot-path.patch rename recipe/{ => patches}/julia-hardcoded-libs.patch (100%) rename recipe/{ => patches}/libgit2-patch.diff (100%) delete mode 100644 recipe/pre-unlink.sh create mode 100644 recipe/scripts/activate.sh create mode 100644 recipe/scripts/deactivate.sh diff --git a/recipe/build.sh b/recipe/build.sh index 6204b1dd..5a62a1a0 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -62,9 +62,14 @@ make -j${CPU_COUNT} prefix=${PREFIX} sysconfigdir=${PREFIX}/etc \ USE_SYSTEM_ZLIB=1 \ USE_SYSTEM_P7ZIP=1 \ ${EXTRA_MAKEFLAGS} \ - TAGGED_RELEASE_BANNER="conda-forge-julia release" \ + TAGGED_RELEASE_BANNER="A conda-forge release: https://github.com/conda-forge/julia-feedstock" \ CC=$CC CXX=$CXX FC=$FC \ install -# Configure juliarc to use conda environment -cat "${RECIPE_DIR}/juliarc.jl" >> "${PREFIX}/etc/julia/juliarc.jl" +# Copy the [de]activate scripts to $PREFIX/etc/conda/[de]activate.d. +# This will allow them to be run on environment activation. +for CHANGE in "activate" "deactivate" +do + mkdir -p "${PREFIX}/etc/conda/${CHANGE}.d" + cp "${RECIPE_DIR}/scripts/${CHANGE}.sh" "${PREFIX}/etc/conda/${CHANGE}.d/${PKG_NAME}_${CHANGE}.sh" +done diff --git a/recipe/juliarc.jl b/recipe/juliarc.jl deleted file mode 100644 index 544d7d45..00000000 --- a/recipe/juliarc.jl +++ /dev/null @@ -1,6 +0,0 @@ -JULIA_PREFIX = abspath(joinpath(Base.source_path(), "..", "..", "..")) - -if !("JULIA_PKGDIR" in keys(ENV)) - ENV["JULIA_PKGDIR"] = joinpath(JULIA_PREFIX, "share", "julia", "site") - Base.LOAD_CACHE_PATH[1] = joinpath(ENV["JULIA_PKGDIR"], "lib", string("v", join(split(string(VERSION), ".")[1:2], "."))) -end diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 68477954..3fe9b0aa 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -12,19 +12,21 @@ source: sha256: {{ sha256 }} patches: ## from https://github.com/archlinux/svntogit-community/tree/packages/julia/trunk - - julia-hardcoded-libs.patch - ## unreliable tests: - ## see: https://github.com/JuliaLang/julia/issues/43004 - - 0001-fixing-core.jl-tests.patch + - patches/julia-hardcoded-libs.patch ## see: https://github.com/JuliaLang/julia/issues/43249#issuecomment-981147025 ## and: https://github.com/archlinux/svntogit-community/blob/packages/julia/trunk/julia-libgit-1.2.patch - - libgit2-patch.diff + - patches/libgit2-patch.diff # [linux] + ## unreliable tests: + ## see: https://github.com/JuliaLang/julia/issues/43004 + - patches/0001-disable-testing-Vararg-Int-N-where.patch # [linux] ## issues with this precompile test, see https://github.com/JuliaLang/julia/issues/43535 - - 0002-Baz.baz-temporary-deletion.patch + - patches/0002-disable-testing-Baz.baz-1.patch # [linux] + ## see PR upstream: https://github.com/JuliaLang/julia/pull/42358 + - patches/0003-correct-test-for-julia-depot-path.patch build: skip: true # [win] - number: 0 + number: 1 features: requirements: @@ -79,10 +81,10 @@ requirements: test: commands: - julia -e 'Base.runtests(["subarray", "core", "compiler", "worlds", "keywordargs", "numbers", "subtype", "char", "strings", "triplequote", "unicode", "intrinsics", "dict", "hashing", "iobuffer", "staged", "offsetarray", "arrayops", "tuple", "reduce", "reducedim", "abstractarray", "intfuncs", "simdloop", "vecelement", - "rational", "bitarray", "copy", "fastmath", "functional", "iterators", "operators", "ordering", "path", "ccall", "parse", "loading", "gmp", "sorting", "spawn", "backtrace", "exceptions", "file", "read", "version", "namedtuple", "mpfr", "broadcast", "complex", "floatapprox", "reflection", "regex", "float16", "combinatorics", - "sysinfo", "env", "rounding", "ranges", "mod2pi", "euler", "show", "client", "errorshow", "sets", "goto", "llvmcall", "llvmcall2", "ryu", "some", "meta", "stacktraces", "docs", "misc", "threads", "stress", "binaryplatforms", "atexit", "enums", "cmdlineargs", "int", "interpreter", "checked", "bitset", "floatfuncs", - "precompile", "boundscheck", "error", "ambiguous", "cartesian", "osutils", "channels", "iostream", "secretbuffer", "specificity", "reinterpretarray", "syntax", "corelogging", "missing", "asyncmap", "smallarrayshrink", "download"])' # all except stdlib, add "opaque_closure", "filesystem" with 1.7 - - julia -e 'Base.runtests(["math"])' # [not osx] due to failure on math.jl:296, pre-haswell processor + "rational", "bitarray", "copy", "math", "fastmath", "functional", "iterators", "operators", "ordering", "path", "ccall", "parse", "gmp", "sorting", "spawn", "backtrace", "exceptions", "file", "read", "version", "namedtuple", "mpfr", "broadcast", "complex", "floatapprox", "reflection", "regex", "float16", "combinatorics", + "sysinfo", "env", "rounding", "ranges", "mod2pi", "euler", "show", "client", "errorshow", "sets", "goto", "llvmcall", "llvmcall2", "ryu", "some", "meta", "stacktraces", "docs", "misc", "threads", "stress", "binaryplatforms", "atexit", "enums", "int", "interpreter", "checked", "bitset", "floatfuncs", + "precompile", "boundscheck", "error", "ambiguous", "cartesian", "osutils", "channels", "iostream", "secretbuffer", "specificity", "reinterpretarray", "syntax", "corelogging", "missing", "asyncmap", "smallarrayshrink", "download", "opaque_closure", "filesystem"]; ncores=ceil(Int, Sys.CPU_THREADS))' # all except stdlib? + - julia --project -e 'delete!(ENV, "JULIA_PROJECT"); delete!(ENV, "JULIA_LOAD_PATH"); Base.runtests(["loading", "cmdlineargs"])' # Julia 1.7.1 tests error here when a project is defined - julia -e 'import Pkg;Pkg.add("LibSSH2_jll")' - julia -e 'import Pkg;Pkg.add("Sundials")' requires: diff --git a/recipe/0001-fixing-core.jl-tests.patch b/recipe/patches/0001-disable-testing-Vararg-Int-N-where.patch similarity index 79% rename from recipe/0001-fixing-core.jl-tests.patch rename to recipe/patches/0001-disable-testing-Vararg-Int-N-where.patch index c67f0c05..9978fd63 100644 --- a/recipe/0001-fixing-core.jl-tests.patch +++ b/recipe/patches/0001-disable-testing-Vararg-Int-N-where.patch @@ -1,7 +1,7 @@ -From f4a8c1310b8bb36d6669cb5f3c7f3c001835dceb Mon Sep 17 00:00:00 2001 -From: ngam <67342040+ngam@users.noreply.github.com> -Date: Thu, 23 Dec 2021 14:22:34 -0500 -Subject: [PATCH] fixing core.jl tests +From 7d9a74a0eb59e62d9d64dbbe274184549fbbc752 Mon Sep 17 00:00:00 2001 +From: ngam +Date: Mon, 27 Dec 2021 01:36:02 +0000 +Subject: [PATCH 1/3] disable testing Vararg{Int, N} where --- test/core.jl | 6 +++--- diff --git a/recipe/0002-Baz.baz-temporary-deletion.patch b/recipe/patches/0002-disable-testing-Baz.baz-1.patch similarity index 71% rename from recipe/0002-Baz.baz-temporary-deletion.patch rename to recipe/patches/0002-disable-testing-Baz.baz-1.patch index 129713e2..4c5fa2ee 100644 --- a/recipe/0002-Baz.baz-temporary-deletion.patch +++ b/recipe/patches/0002-disable-testing-Baz.baz-1.patch @@ -1,7 +1,7 @@ -From 023b3288cf3dfabab98eabca278e2c2d8634a23c Mon Sep 17 00:00:00 2001 -From: ngam <67342040+ngam@users.noreply.github.com> -Date: Thu, 23 Dec 2021 17:34:26 -0500 -Subject: [PATCH 2/2] Baz.baz temporary deletion +From 31e9de0137db669f1a41e933da701b0e2c7ea6f2 Mon Sep 17 00:00:00 2001 +From: ngam +Date: Mon, 27 Dec 2021 01:36:51 +0000 +Subject: [PATCH 2/3] disable testing Baz.baz == 1 --- test/precompile.jl | 2 +- @@ -21,5 +21,5 @@ index 51b25b8325..8abd491a63 100644 # Issue #12720 FooBar1_file = joinpath(dir, "FooBar1.jl") -- -2.32.0 (Apple Git-132) +2.34.1 diff --git a/recipe/patches/0003-correct-test-for-julia-depot-path.patch b/recipe/patches/0003-correct-test-for-julia-depot-path.patch new file mode 100644 index 00000000..cd20d6c3 --- /dev/null +++ b/recipe/patches/0003-correct-test-for-julia-depot-path.patch @@ -0,0 +1,25 @@ +From e4f0e7c7f750dc0f27fd59c1fe7cd8d70dbd2fc9 Mon Sep 17 00:00:00 2001 +From: ngam <67342040+ngam@users.noreply.github.com> +Date: Sun, 26 Dec 2021 21:45:50 -0500 +Subject: [PATCH 3/3] Correct test for JULIA_DEPOT_PATH, See JuliaLang/julia#42358 + +--- + test/cmdlineargs.jl | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/cmdlineargs.jl b/test/cmdlineargs.jl +index 3d1efdd0d2..7fb7e5ad9e 100644 +--- a/test/cmdlineargs.jl ++++ b/test/cmdlineargs.jl +@@ -119,7 +119,7 @@ let exename = `$(Base.julia_cmd()) --startup-file=no --color=no` + # handling of @projectname in --project and JULIA_PROJECT + let expanded = abspath(Base.load_path_expand("@foo")) + @test expanded == readchomp(`$exename --project='@foo' -e 'println(Base.active_project())'`) +- @test expanded == readchomp(setenv(`$exename -e 'println(Base.active_project())'`, "JULIA_PROJECT" => "@foo", "HOME" => homedir())) ++ @test expanded == readchomp(addenv(`$exename -e 'println(Base.active_project())'`, "JULIA_PROJECT" => "@foo", "HOME" => homedir())) + end + + # --quiet, --banner +-- +2.34.1 + diff --git a/recipe/julia-hardcoded-libs.patch b/recipe/patches/julia-hardcoded-libs.patch similarity index 100% rename from recipe/julia-hardcoded-libs.patch rename to recipe/patches/julia-hardcoded-libs.patch diff --git a/recipe/libgit2-patch.diff b/recipe/patches/libgit2-patch.diff similarity index 100% rename from recipe/libgit2-patch.diff rename to recipe/patches/libgit2-patch.diff diff --git a/recipe/pre-unlink.sh b/recipe/pre-unlink.sh deleted file mode 100644 index 6363aff5..00000000 --- a/recipe/pre-unlink.sh +++ /dev/null @@ -1 +0,0 @@ -"${PREFIX}/bin/julia" -e 'rm(ENV["JULIA_PKGDIR"], recursive=true)' >> "${PREFIX}/.messages.txt" 2>&1 diff --git a/recipe/scripts/activate.sh b/recipe/scripts/activate.sh new file mode 100644 index 00000000..a90fa90a --- /dev/null +++ b/recipe/scripts/activate.sh @@ -0,0 +1,14 @@ +export JULIA_DEPOT_PATH_BACKUP=${JULIA_DEPOT_PATH:-} +export JULIA_PROJECT_BACKUP=${JULIA_PROJECT:-} +export JULIA_LOAD_PATH_BACKUP=${JULIA_LOAD_PATH:-} + +# Move ~/.julia to a conda environment specific location +export JULIA_DEPOT_PATH="$CONDA_PREFIX/share/julia:$JULIA_DEPOT_PATH" + +# Create a named environment for each conda environment +# Use of @ to specify a shared named environment is new as of Julia 1.7 +# https://github.com/JuliaLang/julia/pull/40025 +# The name of the environment is the last directory of the CONDA_PREFIX +export JULIA_PROJECT="@${CONDA_PREFIX##*/}" +# Modify load path so that projects stack on the conda-named environment +export JULIA_LOAD_PATH="@:$JULIA_PROJECT:@stdlib" diff --git a/recipe/scripts/deactivate.sh b/recipe/scripts/deactivate.sh new file mode 100644 index 00000000..bd578e4f --- /dev/null +++ b/recipe/scripts/deactivate.sh @@ -0,0 +1,17 @@ +export JULIA_DEPOT_PATH=$JULIA_DEPOT_PATH_BACKUP +export JULIA_PROJECT=$JULIA_PROJECT_BACKUP +export JULIA_LOAD_PATH=$JULIA_LOAD_PATH_BACKUP + +unset JULIA_DEPOT_PATH_BACKUP +unset JULIA_PROJECT_BACKUP +unset JULIA_LOAD_PATH_BACKUP + +if [ -z $JULIA_DEPOT_PATH ]; then + unset JULIA_DEPOT_PATH +fi +if [ -z $JULIA_PROJECT ]; then + unset JULIA_PROJECT +fi +if [ -z $JULIA_LOAD_PATH ]; then + unset JULIA_LOAD_PATH +fi