Skip to content

Commit

Permalink
Drop build info from julia version stored in manifest (#2995)
Browse files Browse the repository at this point in the history
(cherry picked from commit 487fdd1, PR#2995)
  • Loading branch information
IanButterworth authored and fredrikekre committed Mar 18, 2022
1 parent d053635 commit d6b2dc5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ function collect_fixed!(ctx::Context, pkgs::Vector{PackageSpec}, names::Dict{UUI
return fixed
end

# drops build detail in version but keeps the main prerelease context
# i.e. dropbuild(v"2.0.1-rc1.21321") == v"2.0.1-rc1"
dropbuild(v::VersionNumber) = VersionNumber(v.major, v.minor, v.patch, isempty(v.prerelease) ? () : (v.prerelease[1],))

function project_compatibility(ctx::Context, name::String)
return VersionSpec(Types.semver_spec(get(ctx.env.project.compat, name, ">= 0")))
Expand All @@ -357,11 +360,12 @@ end
# looks at uuid, version, repo/path,
# sets version to a VersionNumber
# adds any other packages which may be in the dependency graph
# all versioned packges should have a `tree_hash`
# all versioned packages should have a `tree_hash`
function resolve_versions!(ctx::Context, pkgs::Vector{PackageSpec})
# compatibility
if ctx.julia_version !== nothing
ctx.env.manifest.julia_version = ctx.julia_version
# only set the manifest julia_version if ctx.julia_version is not nothing
env.manifest.julia_version = dropbuild(VERSION)
v = intersect(ctx.julia_version, project_compatibility(ctx, "julia"))
if isempty(v)
@warn "julia version requirement for project not satisfied" _module=nothing _file=nothing
Expand Down
2 changes: 1 addition & 1 deletion test/manifest/formats/v2.0/Manifest.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is machine-generated - editing it directly is not advised

julia_version = "1.7.0-DEV.1199"
julia_version = "1.7.0-DEV"
manifest_format = "2.0"
some_other_data = [1, 2, 3, 4]
some_other_field = "other"
Expand Down
2 changes: 1 addition & 1 deletion test/manifest/formats/v3.0_unknown/Manifest.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is machine-generated - editing it directly is not advised

julia_version = "1.7.0-DEV.1199"
julia_version = "1.7.0-DEV"
manifest_format = "3.0" # NOT ACTUALLY v3.0 format. Just here to test a warning!

[[deps.Logging]]
Expand Down

0 comments on commit d6b2dc5

Please sign in to comment.