JuliaLang / Pkg.jl

Pkg - Package manager for the Julia programming language
https://pkgdocs.julialang.org
Other
621 stars 268 forks source link

`Pkg.add` doesn't install the requested version of JLL stdlib #3113

Open giordano opened 2 years ago

giordano commented 2 years ago
julia> using Pkg

julia> Pkg.activate(; temp=true, io=devnull)

julia> ctx = Pkg.Types.Context(; julia_version=nothing);

julia> Pkg.add(ctx, [Pkg.Types.PackageSpec(; name = "LibCURL_jll", tree_hash = Base.SHA1("cab60d2381bf2a404bcccccb7b3f861aafcb3ad8"))])
   Resolving package versions...
    Updating `/tmp/jl_xnCKPo/Project.toml`
  [deac9b47] + LibCURL_jll v7.83.1+1

and

julia> using Pkg, UUIDs

julia> Pkg.activate(; temp=true, io=devnull)

julia> ctx = Pkg.Types.Context(; julia_version=nothing);

julia> spec = Pkg.PackageSpec(
           ;
           name = "LibCURL_jll",
           uuid = UUID("deac9b47-8bc7-5906-a0fe-35ac56dc84c0"),
           tree_hash = Base.SHA1("cab60d2381bf2a404bcccccb7b3f861aafcb3ad8"),
           version = Pkg.Types.VersionSpec("*"),
           repo=Pkg.Types.GitRepo(
               ;
               rev="4b758d9a039000f3344c8cbb38031b06f1e5148b",
               source="https://github.com/JuliaBinaryWrappers/LibCURL_jll.jl.git",
           ),
       );

julia> Pkg.add(ctx, [spec])
   Resolving package versions...
    Updating `/tmp/jl_KwyviO/Project.toml`
  [deac9b47] + LibCURL_jll v7.73.0+4 `https://github.com/JuliaBinaryWrappers/LibCURL_jll.jl.git#4b758d9`

Despite all our best efforts to ask Pkg to install a very specific version of LibCURL_jll (7.81.0+0, with tree hash cab60d2381bf2a404bcccccb7b3f861aafcb3ad8, from commit https://github.com/JuliaBinaryWrappers/LibCURL_jll.jl/commit/4b758d9a039000f3344c8cbb38031b06f1e5148b), Pkg installs completely different versions. Of course we rely on Pkg providing us precisely the requested version in BinaryBuilder.

KristofferC commented 2 years ago

AFAIK, the only input that Pkg uses from PackageSpec is: name, uuid, version, repo. The rest are "filler" fields to be filled in when the package has been downloaded. So specifying e.g tree_hash does nothing (there is no functionality in Pkg to add a package based on the tree hash directly).

Despite all our best efforts to ask Pkg to install a very specific version of LibCURL_jll (7.81.0+0, with tree hash cab60d2381bf2a404bcccccb7b3f861aafcb3ad8, from commit https://github.com/JuliaBinaryWrappers/LibCURL_jll.jl/commit/4b758d9a039000f3344c8cbb38031b06f1e5148b), Pkg installs completely different versions

Locally (on 1.8):

julia> Pkg.add(ctx, [spec])
...
    Updating `/tmp/jl_EJYGaC/Project.toml`
  [deac9b47] + LibCURL_jll v7.81.0+0 `https://github.com/JuliaBinaryWrappers/LibCURL_jll.jl.git#4b758d9`

On 1.7 it says it has the old version, I guess that is because it picks it up from the stdlib project version.

giordano commented 2 years ago

Yes, we want to install in Julia v1.7 (or any other versions) the version of the package for Julia v1.8. So using Julia v1.8 specifically isn't useful to see the issue