Skip to content

Commit 3bffdc8

Browse files
committed
Add support for keeping juliaup channel arch
E.g., for bundling for i686 on x86_64.
1 parent c0ac7d6 commit 3bffdc8

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

src/code_stripping.jl

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,20 @@ function _process_project_env(;
355355
packagebundler_toml =
356356
isfile(packagebundler_file) ? TOML.parsefile(packagebundler_file) :
357357
Dict{String,Any}()
358+
packagebundler_toml_juliaup = get(Dict{String,Any}, packagebundler_toml, "juliaup")
358359
julia_version = TOML.parsefile(manifest_toml)["julia_version"]
359360
julia_version =
360-
get(get(Dict{String,Any}, packagebundler_toml, "juliaup"), "channel", julia_version)
361+
get(packagebundler_toml_juliaup, "channel", julia_version)
362+
if haskey(packagebundler_toml_juliaup, "channel")
363+
packagebundler_toml = merge(packagebundler_toml, Dict(
364+
"juliaup" => Dict(
365+
"channel" => _juliaup_channel(packagebundler_toml_juliaup["channel"])
366+
)
367+
))
368+
open(joinpath(named_environment, "PackageBundler.toml"), "w") do io
369+
TOML.print(io, packagebundler_toml)
370+
end
371+
end
361372

362373
pkg_version_info = Dict()
363374
for (each_uuid, each_name) in stripped
@@ -749,7 +760,7 @@ function _process_multiplexers(
749760
exists = Sys.which(multiplexer)
750761
if !isnothing(exists)
751762
if multiplexer == "juliaup"
752-
return `julia +$(julia_version)`
763+
return `julia +$(_juliaup_channel(julia_version))`
753764
elseif multiplexer == "asdf"
754765
return withenv("ASDF_JULIA_VERSION" => "$(julia_version)") do
755766
path = readchomp(`asdf which julia`)
@@ -771,3 +782,11 @@ function _process_multiplexers(
771782
error("no multiplexers found: $(repr(multiplexers))")
772783
end
773784
end
785+
786+
function _juliaup_channel(julia_version::Union{String,VersionNumber})
787+
if Sys.ARCH != Symbol(readchomp(`uname -m`))
788+
arch = if Sys.ARCH == :i686; :x86; elseif Sys.ARCH == :x86_64; :x64; else Sys.ARCH; end
789+
return "$(julia_version)~$arch"
790+
end
791+
return julia_version
792+
end

src/utilities.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ function instantiate(environments::String)
3535
)
3636

3737
if !isnothing(Sys.which("juliaup"))
38-
@info "Checking whether Julia '$julia_version' is installed, if not, installing it."
39-
run(`juliaup add $julia_version`)
38+
juliaup_channel = _juliaup_channel(julia_version)
39+
@info "Checking whether Julia '$juliaup_channel' is installed, if not, installing it."
40+
run(`juliaup add $juliaup_channel`)
4041
withenv("JULIA_PKG_PRECOMPILE_AUTO" => 0) do
4142
run(
42-
`julia +$(julia_version) --project=$each -e 'import Pkg; Pkg.instantiate()'`,
43+
`julia +$juliaup_channel --project=$each -e 'import Pkg; Pkg.instantiate()'`,
4344
)
4445
end
4546
elseif !isnothing(Sys.which("asdf"))

0 commit comments

Comments
 (0)