diff --git a/CHANGELOG.md b/CHANGELOG.md index 14b3f11bd9..73c79a6e42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +Pkg v1.11 Release Notes +======================= + +- Pkg now obeys `[compat]` bounds for `julia` and raises an error if the version of the running Julia binary is incompatible with the bounds in `Project.toml`. + Pkg has always obeyed this compat when working with Registry packages. This change affects mostly local packages. ([#3526]) + +Pkg v1.10 Release Notes +======================= + Pkg v1.9 Release Notes ======================= diff --git a/src/Operations.jl b/src/Operations.jl index 1543701bbe..4e9af286ef 100644 --- a/src/Operations.jl +++ b/src/Operations.jl @@ -242,13 +242,10 @@ function collect_project(pkg::PackageSpec, path::String) pkgerror("could not find project file for package $(err_rep(pkg)) at `$path`") end project = read_package(project_file) - #= - # TODO, this should either error or be quiet julia_compat = get_compat(project, "julia") - if julia_compat !== nothing && !(VERSION in julia_compat) - println(io, "julia version requirement for package $(err_rep(pkg)) not satisfied") + if !isnothing(julia_compat) && !(VERSION in julia_compat) + pkgerror("julia version requirement from Project.toml's compat section not satisfied for package $(err_rep(pkg)) at `$path`") end - =# for (name, uuid) in project.deps vspec = get_compat(project, name) push!(deps, PackageSpec(name, uuid, vspec)) diff --git a/test/api.jl b/test/api.jl index 5c4caee4b8..b6d7571a30 100644 --- a/test/api.jl +++ b/test/api.jl @@ -392,4 +392,13 @@ end end end +@testset "`[compat]` entries for `julia`" begin + isolate(loaded_depot=true) do; mktempdir() do tempdir + pathf = git_init_package(tempdir, joinpath(@__DIR__, "test_packages", "FarFuture")) + pathp = git_init_package(tempdir, joinpath(@__DIR__, "test_packages", "FarPast")) + @test_throws "julia version requirement from Project.toml's compat section not satisfied for package" Pkg.add(path=pathf) + @test_throws "julia version requirement from Project.toml's compat section not satisfied for package" Pkg.add(path=pathp) + end end +end + end # module APITests diff --git a/test/test_packages/FarFuture/Project.toml b/test/test_packages/FarFuture/Project.toml new file mode 100644 index 0000000000..aff16bebb1 --- /dev/null +++ b/test/test_packages/FarFuture/Project.toml @@ -0,0 +1,7 @@ +name = "FarFuture" +uuid = "501ba3b0-7baa-46f4-8e2b-5f7988aeacaf" +authors = ["The Jetsons"] +version = "0.1.0" + +[compat] +julia = "1.999.0" diff --git a/test/test_packages/FarFuture/src/FarFuture.jl b/test/test_packages/FarFuture/src/FarFuture.jl new file mode 100644 index 0000000000..6107721642 --- /dev/null +++ b/test/test_packages/FarFuture/src/FarFuture.jl @@ -0,0 +1,5 @@ +module FarFuture + +greet() = print("Hello World!") + +end # module diff --git a/test/test_packages/FarPast/Project.toml b/test/test_packages/FarPast/Project.toml new file mode 100644 index 0000000000..2ea0d7bb27 --- /dev/null +++ b/test/test_packages/FarPast/Project.toml @@ -0,0 +1,7 @@ +name = "FarPast" +uuid = "501ba3b0-7baa-46f4-8e2b-5f7988aeaca0" +authors = ["The Flintstones"] +version = "0.1.0" + +[compat] +julia = "<1.1.0" diff --git a/test/test_packages/FarPast/src/FarPast.jl b/test/test_packages/FarPast/src/FarPast.jl new file mode 100644 index 0000000000..760796b932 --- /dev/null +++ b/test/test_packages/FarPast/src/FarPast.jl @@ -0,0 +1,5 @@ +module FarPast + +greet() = print("Hello World!") + +end # module