From 544281f5a02a74a97bdbd65355dd7e4f15bd82f7 Mon Sep 17 00:00:00 2001 From: Stefan Krastanov Date: Sun, 25 Jun 2023 12:32:54 -0400 Subject: [PATCH 01/11] do not silently accept broken `julia` compat Pkg now raises an error if the julia compat is not met for a package. `ENV["JULIA_PKG_CHECK_JULIA_COMPAT"]` can be used to override this check. This change was made due to new developers getting confused why their julia 1.8 does not work with a dev-ed package that has a julia compat set to 1.9. --- src/Operations.jl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Operations.jl b/src/Operations.jl index 680e16953a..8e62eaa653 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 Base.get_bool_env("JULIA_PKG_CHECK_JULIA_COMPAT", true) && !isnothing(julia_compat) && !(VERSION in julia_compat) + pkgerror("julia version requirement for package $(err_rep(pkg)) not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_CHECK_JULIA_COMPAT\"]=0`") end - =# for (name, uuid) in project.deps vspec = get_compat(project, name) push!(deps, PackageSpec(name, uuid, vspec)) From 714bbfca284ebb63bbf629f9fad07bf59a087eaf Mon Sep 17 00:00:00 2001 From: Stefan Krastanov Date: Tue, 8 Aug 2023 23:14:35 -0400 Subject: [PATCH 02/11] attempt to add tests --- test/api.jl | 9 +++++++++ test/test_packages/FarFuture/Project.toml | 7 +++++++ test/test_packages/FarFuture/src/FarFuture.jl | 5 +++++ 3 files changed, 21 insertions(+) create mode 100644 test/test_packages/FarFuture/Project.toml create mode 100644 test/test_packages/FarFuture/src/FarFuture.jl diff --git a/test/api.jl b/test/api.jl index e4bdbe1bac..10ee2e10f6 100644 --- a/test/api.jl +++ b/test/api.jl @@ -392,4 +392,13 @@ end end end +@testset "julia compat" begin + isolate(loaded_depot=true) do; mktempdir() do tempdir + path = git_init_package(tempdir, joinpath(@__DIR__, "test_packages", "FarFuture")) + @test_throws "not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_CHECK_JULIA_COMPAT\"]=0`" Pkg.add(path=path) + ENV["JULIA_PKG_CHECK_JULIA_COMPAT"]=0 + Pkg.add(path=path) + 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..1963a0cbed --- /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" \ No newline at end of file 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 From 57f0eee55eb5439e2cd88043735fb3aa6a7006b1 Mon Sep 17 00:00:00 2001 From: Stefan Krastanov Date: Tue, 8 Aug 2023 23:31:40 -0400 Subject: [PATCH 03/11] try to fix and expand tests --- test/api.jl | 11 +++++++---- test/test_packages/FarPast/Project.toml | 7 +++++++ test/test_packages/FarPast/src/FarPast.jl | 5 +++++ 3 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 test/test_packages/FarPast/Project.toml create mode 100644 test/test_packages/FarPast/src/FarPast.jl diff --git a/test/api.jl b/test/api.jl index 10ee2e10f6..4e14fb8488 100644 --- a/test/api.jl +++ b/test/api.jl @@ -394,11 +394,14 @@ end @testset "julia compat" begin isolate(loaded_depot=true) do; mktempdir() do tempdir - path = git_init_package(tempdir, joinpath(@__DIR__, "test_packages", "FarFuture")) - @test_throws "not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_CHECK_JULIA_COMPAT\"]=0`" Pkg.add(path=path) + pathf = git_init_package(tempdir, joinpath(@__DIR__, "test_packages", "FarFuture")) + pathp = git_init_package(tempdir, joinpath(@__DIR__, "test_packages", "FarPast")) + @test_throws "not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_CHECK_JULIA_COMPAT\"]=0`" Pkg.add(path=pathf) + @test_throws "not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_CHECK_JULIA_COMPAT\"]=0`" Pkg.add(path=pathp) ENV["JULIA_PKG_CHECK_JULIA_COMPAT"]=0 - Pkg.add(path=path) - end + Pkg.add(path=pathf) + Pkg.add(path=pathp) + end end end end # module APITests diff --git a/test/test_packages/FarPast/Project.toml b/test/test_packages/FarPast/Project.toml new file mode 100644 index 0000000000..dc26310381 --- /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" \ No newline at end of file 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 From 6c599aab77871d32fb35cf294681654ef54a80ec Mon Sep 17 00:00:00 2001 From: Stefan Krastanov Date: Fri, 11 Aug 2023 12:23:17 -0400 Subject: [PATCH 04/11] changelog and env var rename --- CHANGELOG.md | 7 +++++++ src/Operations.jl | 4 ++-- test/api.jl | 6 +++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14b3f11bd9..b4e86eb966 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +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`. + The old behavior of disregarging Julia `compat` bounds can be restored by setting the `JULIA_PKG_JULIA_COMPAT_IGNORE` environmental variable. + Pkg has always obeyed this compat when working with Registry packages. This change is affects mostly local packages. + Pkg v1.9 Release Notes ======================= diff --git a/src/Operations.jl b/src/Operations.jl index b595dda61d..42ebdbbeba 100644 --- a/src/Operations.jl +++ b/src/Operations.jl @@ -243,8 +243,8 @@ function collect_project(pkg::PackageSpec, path::String) end project = read_package(project_file) julia_compat = get_compat(project, "julia") - if Base.get_bool_env("JULIA_PKG_CHECK_JULIA_COMPAT", true) && !isnothing(julia_compat) && !(VERSION in julia_compat) - pkgerror("julia version requirement for package $(err_rep(pkg)) not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_CHECK_JULIA_COMPAT\"]=0`") + if !Base.get_bool_env("JULIA_PKG_JULIA_COMPAT_IGNORE", false) && !isnothing(julia_compat) && !(VERSION in julia_compat) + pkgerror("julia version requirement for package $(err_rep(pkg)) not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_JULIA_COMPAT_IGNORE\"]`") end for (name, uuid) in project.deps vspec = get_compat(project, name) diff --git a/test/api.jl b/test/api.jl index 4e14fb8488..cb0bd05591 100644 --- a/test/api.jl +++ b/test/api.jl @@ -396,9 +396,9 @@ end 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 "not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_CHECK_JULIA_COMPAT\"]=0`" Pkg.add(path=pathf) - @test_throws "not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_CHECK_JULIA_COMPAT\"]=0`" Pkg.add(path=pathp) - ENV["JULIA_PKG_CHECK_JULIA_COMPAT"]=0 + @test_throws "not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_JULIA_COMPAT_IGNORE\"]=1`" Pkg.add(path=pathf) + @test_throws "not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_JULIA_COMPAT_IGNORE\"]=1`" Pkg.add(path=pathp) + ENV["JULIA_PKG_JULIA_COMPAT_IGNORE"]=1 Pkg.add(path=pathf) Pkg.add(path=pathp) end end From d23fb3491e987ce8c286bd8e350f57547c419624 Mon Sep 17 00:00:00 2001 From: Stefan Krastanov Date: Fri, 11 Aug 2023 12:58:15 -0400 Subject: [PATCH 05/11] typo --- test/api.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/api.jl b/test/api.jl index cb0bd05591..9db48352da 100644 --- a/test/api.jl +++ b/test/api.jl @@ -396,8 +396,8 @@ end 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 "not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_JULIA_COMPAT_IGNORE\"]=1`" Pkg.add(path=pathf) - @test_throws "not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_JULIA_COMPAT_IGNORE\"]=1`" Pkg.add(path=pathp) + @test_throws "not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_JULIA_COMPAT_IGNORE\"]`" Pkg.add(path=pathf) + @test_throws "not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_JULIA_COMPAT_IGNORE\"]`" Pkg.add(path=pathp) ENV["JULIA_PKG_JULIA_COMPAT_IGNORE"]=1 Pkg.add(path=pathf) Pkg.add(path=pathp) From 50b00b73c5329c534a32416844e5bd2f516d7223 Mon Sep 17 00:00:00 2001 From: Stefan Krastanov Date: Sun, 13 Aug 2023 20:32:41 -0400 Subject: [PATCH 06/11] Update CHANGELOG.md Co-authored-by: Dilum Aluthge --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4e86eb966..9fb7613902 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ 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`. - The old behavior of disregarging Julia `compat` bounds can be restored by setting the `JULIA_PKG_JULIA_COMPAT_IGNORE` environmental variable. + The old behavior of disregarding Julia `compat` bounds can be restored by setting the `JULIA_PKG_JULIA_COMPAT_IGNORE` environmental variable. Pkg has always obeyed this compat when working with Registry packages. This change is affects mostly local packages. Pkg v1.9 Release Notes From 6884f0cc3c38f2515c7cd2224de8ec366cc4aab6 Mon Sep 17 00:00:00 2001 From: Stefan Krastanov Date: Sun, 13 Aug 2023 20:39:36 -0400 Subject: [PATCH 07/11] respond to minor review suggestions. --- CHANGELOG.md | 3 +++ test/test_packages/FarFuture/Project.toml | 2 +- test/test_packages/FarPast/Project.toml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fb7613902..67d939a293 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ Pkg v1.11 Release Notes The old behavior of disregarding Julia `compat` bounds can be restored by setting the `JULIA_PKG_JULIA_COMPAT_IGNORE` environmental variable. Pkg has always obeyed this compat when working with Registry packages. This change is affects mostly local packages. +Pkg v1.10 Release Notes +======================= + Pkg v1.9 Release Notes ======================= diff --git a/test/test_packages/FarFuture/Project.toml b/test/test_packages/FarFuture/Project.toml index 1963a0cbed..aff16bebb1 100644 --- a/test/test_packages/FarFuture/Project.toml +++ b/test/test_packages/FarFuture/Project.toml @@ -4,4 +4,4 @@ authors = ["The Jetsons"] version = "0.1.0" [compat] -julia = "1.999.0" \ No newline at end of file +julia = "1.999.0" diff --git a/test/test_packages/FarPast/Project.toml b/test/test_packages/FarPast/Project.toml index dc26310381..2ea0d7bb27 100644 --- a/test/test_packages/FarPast/Project.toml +++ b/test/test_packages/FarPast/Project.toml @@ -4,4 +4,4 @@ authors = ["The Flintstones"] version = "0.1.0" [compat] -julia = "<1.1.0" \ No newline at end of file +julia = "<1.1.0" From dea8482b1b97e4ac9e2aa1f3beda36304f26d5cd Mon Sep 17 00:00:00 2001 From: Stefan Krastanov Date: Mon, 14 Aug 2023 10:07:11 -0400 Subject: [PATCH 08/11] remove ENV variable override --- CHANGELOG.md | 3 +-- src/Operations.jl | 4 ++-- test/api.jl | 7 ++----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67d939a293..a8eb2a63f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,7 @@ 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`. - The old behavior of disregarding Julia `compat` bounds can be restored by setting the `JULIA_PKG_JULIA_COMPAT_IGNORE` environmental variable. - Pkg has always obeyed this compat when working with Registry packages. This change is affects mostly local packages. + Pkg has always obeyed this compat when working with Registry packages. This change affects mostly local packages. Pkg v1.10 Release Notes ======================= diff --git a/src/Operations.jl b/src/Operations.jl index 42ebdbbeba..67402372fa 100644 --- a/src/Operations.jl +++ b/src/Operations.jl @@ -243,8 +243,8 @@ function collect_project(pkg::PackageSpec, path::String) end project = read_package(project_file) julia_compat = get_compat(project, "julia") - if !Base.get_bool_env("JULIA_PKG_JULIA_COMPAT_IGNORE", false) && !isnothing(julia_compat) && !(VERSION in julia_compat) - pkgerror("julia version requirement for package $(err_rep(pkg)) not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_JULIA_COMPAT_IGNORE\"]`") + 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) diff --git a/test/api.jl b/test/api.jl index aaffd001e8..fa58c2fb90 100644 --- a/test/api.jl +++ b/test/api.jl @@ -396,11 +396,8 @@ end 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 "not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_JULIA_COMPAT_IGNORE\"]`" Pkg.add(path=pathf) - @test_throws "not satisfied; you can override and ignore this check by setting `ENV[\"JULIA_PKG_JULIA_COMPAT_IGNORE\"]`" Pkg.add(path=pathp) - ENV["JULIA_PKG_JULIA_COMPAT_IGNORE"]=1 - Pkg.add(path=pathf) - Pkg.add(path=pathp) + @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 From 7f1ce9806a633f62cd3e749a25670ab9b2509bf9 Mon Sep 17 00:00:00 2001 From: Stefan Krastanov Date: Tue, 15 Aug 2023 08:11:53 -0400 Subject: [PATCH 09/11] Update CHANGELOG.md Co-authored-by: Dilum Aluthge --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8eb2a63f5..de81c90d2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ 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 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. Pkg v1.10 Release Notes From 24d815acc8ef0c202e286efef46fd54e268dbb3c Mon Sep 17 00:00:00 2001 From: Stefan Krastanov Date: Thu, 17 Aug 2023 00:46:07 -0400 Subject: [PATCH 10/11] Update CHANGELOG.md Co-authored-by: Ian Butterworth --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de81c90d2b..73c79a6e42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ 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. + Pkg has always obeyed this compat when working with Registry packages. This change affects mostly local packages. ([#3526]) Pkg v1.10 Release Notes ======================= From 689ff57edf11caedde540eade13aa831503ffc80 Mon Sep 17 00:00:00 2001 From: Stefan Krastanov Date: Mon, 21 Aug 2023 00:52:00 -0400 Subject: [PATCH 11/11] Update test/api.jl Co-authored-by: Dilum Aluthge --- test/api.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/api.jl b/test/api.jl index fa58c2fb90..b6d7571a30 100644 --- a/test/api.jl +++ b/test/api.jl @@ -392,7 +392,7 @@ end end end -@testset "julia compat" begin +@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"))