From 3dfb4d3adbd4092f12426e24bc8c66aaf127ba64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Fri, 21 Jan 2022 15:35:47 +0100 Subject: [PATCH 1/2] Add a test for `get_addable_spec` This makes sure we can reliably work around an issue in Pkg. --- test/dependencies.jl | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/test/dependencies.jl b/test/dependencies.jl index bc4bfa5f..a483e94b 100644 --- a/test/dependencies.jl +++ b/test/dependencies.jl @@ -105,7 +105,7 @@ end end @testset "Setup" begin - @test BinaryBuilderBase.get_addable_spec("LLVM_jll", v"13.0.0+2") == + @test get_addable_spec("LLVM_jll", v"13.0.0+2") == PackageSpec( name="LLVM_jll", uuid="86de99a1-58d6-5da7-8064-bd56ce2e322c", @@ -134,6 +134,20 @@ end @test readdir(joinpath(destdir(dir, platform), "logs")) == [] end + # Make sure we can use `get_addable_spec` to work around + # https://github.com/JuliaLang/Pkg.jl/issues/2942 + with_temp_project() do dir + prefix = Prefix(dir) + spec = get_addable_spec("LibOSXUnwind_jll", v"0.0.6+1") + dependencies = [BuildDependency(spec)] + platform = Platform("x86_64", "macos"; julia_version="1.6.0") + @test setup_dependencies(prefix, getpkg.(dependencies), platform) isa Vector{String} broken=VERSION Date: Sun, 23 Jan 2022 17:59:41 +0000 Subject: [PATCH 2/2] [Prefix] Always pass `io=outs` to `Pkg.add` --- src/Prefix.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Prefix.jl b/src/Prefix.jl index 35ebe065..17859ff0 100644 --- a/src/Prefix.jl +++ b/src/Prefix.jl @@ -609,8 +609,7 @@ function setup_dependencies(prefix::Prefix, # Re-install stdlib dependencies, but this time with `julia_version = nothing` if !isempty(stdlib_pkgspecs) - #ctx = Pkg.Types.Context!(ctx; julia_version=nothing) - Pkg.add(ctx, stdlib_pkgspecs; julia_version=nothing) + Pkg.add(ctx, stdlib_pkgspecs; io=outs, julia_version=nothing) end # Load their Artifacts.toml files