Skip to content

Commit

Permalink
Align openssl version with OpenSSL_jll version
Browse files Browse the repository at this point in the history
  • Loading branch information
lassepe committed Jul 14, 2024
1 parent 2a90c67 commit 6e1dc86
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/resolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ function _compatible_libstdcxx_ng_version()
end
end

"""
Find the version that aligns with the installed `OpenSSL_jll` version, if any.
"""
function _compatible_openssl_version()
project = Pkg.project()
open_ssl_uuid = get(project.dependencies, "OpenSSL_jll", nothing)
if isnothing(open_ssl_uuid)
return
end
dependencies = Pkg.dependencies()
openssl_version = dependencies[open_ssl_uuid].version
bound = ">=$openssl_version,<=$(openssl_version.major).$(openssl_version.minor+1)"
bound
end

function _resolve_find_dependencies(io, load_path)
packages = Dict{String,Dict{String,PkgSpec}}() # name -> depsfile -> spec
channels = ChannelSpec[]
Expand Down Expand Up @@ -123,6 +138,11 @@ function _resolve_find_dependencies(io, load_path)
version === nothing && continue
pkg = PkgSpec(pkg; version)
end
if pkg.name == "openssl" && pkg.version == "<=julia"
version = _compatible_openssl_version()
version === nothing && continue
pkg = PkgSpec(pkg; version)
end
get!(Dict{String,PkgSpec}, packages, pkg.name)[fn] = pkg
end
if isempty(chans)
Expand Down
9 changes: 9 additions & 0 deletions test/main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,15 @@ end
@test true
end

@testitem "install/remove opensll" begin
include("setup.jl")
CondaPkg.add("openssl", version="<=julia", resolve=false)
CondaPkg.resolve(force=true)
CondaPkg.rm("openssl", resolve=false)
CondaPkg.resolve(force=true)
@test true
end

@testitem "external conda env" begin
include("setup.jl")
dn = string(tempname(), backend, Sys.KERNEL, VERSION)
Expand Down

0 comments on commit 6e1dc86

Please sign in to comment.