Pkg.jl
Pkg.jl copied to clipboard
Support parsing version 0.0.0 internally for package versions
As was agreed in https://github.com/JuliaLang/julia/pull/57520, we decided to introduce a special v"0.0.0" version for Compiler as a fallback to Base.Compiler.
The issue is that Pkg internals explicitly forbid to use this version number, which shows up as
(Pkg) pkg> add [email protected]
Resolving package versions...
ERROR: invalid version: "0.0.0"
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:44
[2] semver_interval(m::RegexMatch{String})
@ Pkg.Versions ~/.julia/dev/Pkg/src/Versions.jl:335
[3] semver_spec(s::String; throw::Bool)
@ Pkg.Versions ~/.julia/dev/Pkg/src/Versions.jl:310
[4] semver_spec
@ ~/.julia/dev/Pkg/src/Versions.jl:303 [inlined]
[5] set_compat
@ ~/.julia/dev/Pkg/src/Operations.jl:303 [inlined]
[6] add(ctx::Pkg.Types.Context, pkgs::Vector{PackageSpec}, new_git::Set{Base.UUID}; allow_autoprecomp::Bool, preserve::PreserveLevel, platform::Base.BinaryPlatforms.Platform, target::Symbol)
@ Pkg.Operations ~/.julia/dev/Pkg/src/Operations.jl:1725
[...]
However, it seems that semantic versioning actually allows such a version number (see this post). Furthermore, compat ranges generated by Pkg may in fact include v"0.0.0", and are documented as such in https://pkgdocs.julialang.org/v1/compatibility/#Caret-specifiers. I also suspect that most things should "just work" with it.
For these reasons, it seems reasonable to me to add support for it. I would not be surprised however that it requires some discussion before a consensus is reached as to whether this is desirable or not.
Regarding the changes proposed in this PR, I would appreciate any pointers toward areas that require further modification or that are suspected to break.
(cc @aviatesk)