From b60c8755502bcd2d010de068cf392b5f0c44c456 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Sat, 28 Oct 2023 03:53:49 -0400 Subject: [PATCH 1/7] Registry consistency tests: For every version, check that each compat entry has a corresponding deps entry --- src/registry_testing.jl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/registry_testing.jl b/src/registry_testing.jl index e5b4c9a3..59ba68be 100644 --- a/src/registry_testing.jl +++ b/src/registry_testing.jl @@ -206,6 +206,9 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[]) # Compat.toml testing compatfile = abspath(data["path"], "Compat.toml") if isfile(compatfile) + # If Compat.toml exists, Deps.toml must exist. + Test.@test isfile(depsfile) + compat = Pkg.TOML.parsefile(compatfile) # Test that all names with compat is a dependency compatnames = Set{String}(x for (_, d) in compat for (x, _) in d) @@ -238,6 +241,22 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[]) else @debug "Compat.toml file does not exist" compatfile end + + # https://github.com/JuliaRegistries/RegistryCI.jl/issues/522 + # For every version, each compat entry has a corresponding deps entry. + if isfile(compatfile) + compat_uncompressed = RegistryTools.Compress.load(compatfile) + deps_uncompressed = isfile(depsfile) ? RegistryTools.Compress.load(depsfile) : Dict() + for v in keys(vers) + compat_for_this_v = get(compat_uncompressed, v, Dict()) + deps_for_this_v = get(deps_uncompressed, v, Dict()) + Test.@test compat_for_this_v isa AbstractDict + Test.@test deps_for_this_v isa AbstractDict + for compat_pkgname in keys(compat_for_this_v) + @test haskey(deps_for_this_v, compat_pkgname) + end + end + end end # Make sure all paths are unique path_parts = [splitpath(data["path"]) for (_, data) in reg["packages"]] From 33ab32c84e3d8944db10233515ead77139e4ecd0 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Sat, 28 Oct 2023 03:59:56 -0400 Subject: [PATCH 2/7] Fix an error --- src/registry_testing.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registry_testing.jl b/src/registry_testing.jl index 59ba68be..14dd372a 100644 --- a/src/registry_testing.jl +++ b/src/registry_testing.jl @@ -253,7 +253,7 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[]) Test.@test compat_for_this_v isa AbstractDict Test.@test deps_for_this_v isa AbstractDict for compat_pkgname in keys(compat_for_this_v) - @test haskey(deps_for_this_v, compat_pkgname) + Test.@test haskey(deps_for_this_v, compat_pkgname) end end end From 943d927feeb5ac93e54647e233bb3ead33533276 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Sat, 28 Oct 2023 04:09:43 -0400 Subject: [PATCH 3/7] If the package has a compat entry for `julia`, there is no need to have `julia` listed in Deps.toml. --- src/registry_testing.jl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/registry_testing.jl b/src/registry_testing.jl index 14dd372a..e27409f6 100644 --- a/src/registry_testing.jl +++ b/src/registry_testing.jl @@ -206,9 +206,6 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[]) # Compat.toml testing compatfile = abspath(data["path"], "Compat.toml") if isfile(compatfile) - # If Compat.toml exists, Deps.toml must exist. - Test.@test isfile(depsfile) - compat = Pkg.TOML.parsefile(compatfile) # Test that all names with compat is a dependency compatnames = Set{String}(x for (_, d) in compat for (x, _) in d) @@ -244,6 +241,10 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[]) # https://github.com/JuliaRegistries/RegistryCI.jl/issues/522 # For every version, each compat entry has a corresponding deps entry. + # + # Note: it is legal for a package to have Compat.toml but not have + # Deps.toml. Specifically, this is legal if (and only if) the package + # does not have any dependencies, and does have a compat entry for `julia`. if isfile(compatfile) compat_uncompressed = RegistryTools.Compress.load(compatfile) deps_uncompressed = isfile(depsfile) ? RegistryTools.Compress.load(depsfile) : Dict() @@ -253,7 +254,13 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[]) Test.@test compat_for_this_v isa AbstractDict Test.@test deps_for_this_v isa AbstractDict for compat_pkgname in keys(compat_for_this_v) - Test.@test haskey(deps_for_this_v, compat_pkgname) + # If the package has a compat entry for `julia`, there + # is no need to have `julia` listed in Deps.toml. + # However, every other compat entry needs to be listed + # in Deps.toml. + if compat_pkgname != julia" + Test.@test haskey(deps_for_this_v, compat_pkgname) + end end end end From fcd704ec10c84b48edd226590d20047ace33ccc6 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Sat, 28 Oct 2023 04:16:30 -0400 Subject: [PATCH 4/7] Fix a syntax error --- src/registry_testing.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registry_testing.jl b/src/registry_testing.jl index e27409f6..8f4e457d 100644 --- a/src/registry_testing.jl +++ b/src/registry_testing.jl @@ -258,7 +258,7 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[]) # is no need to have `julia` listed in Deps.toml. # However, every other compat entry needs to be listed # in Deps.toml. - if compat_pkgname != julia" + if compat_pkgname != "julia" Test.@test haskey(deps_for_this_v, compat_pkgname) end end From 631ed08338e912a4e921e33a4bfbd03d942c9a1e Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Tue, 31 Oct 2023 06:23:14 -0400 Subject: [PATCH 5/7] Also check that every entry in WeakCompat.toml has a corresponding entry in WeakDeps.toml --- src/registry_testing.jl | 44 +++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/src/registry_testing.jl b/src/registry_testing.jl index 8f4e457d..e25b3cd9 100644 --- a/src/registry_testing.jl +++ b/src/registry_testing.jl @@ -245,21 +245,35 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[]) # Note: it is legal for a package to have Compat.toml but not have # Deps.toml. Specifically, this is legal if (and only if) the package # does not have any dependencies, and does have a compat entry for `julia`. - if isfile(compatfile) - compat_uncompressed = RegistryTools.Compress.load(compatfile) - deps_uncompressed = isfile(depsfile) ? RegistryTools.Compress.load(depsfile) : Dict() - for v in keys(vers) - compat_for_this_v = get(compat_uncompressed, v, Dict()) - deps_for_this_v = get(deps_uncompressed, v, Dict()) - Test.@test compat_for_this_v isa AbstractDict - Test.@test deps_for_this_v isa AbstractDict - for compat_pkgname in keys(compat_for_this_v) - # If the package has a compat entry for `julia`, there - # is no need to have `julia` listed in Deps.toml. - # However, every other compat entry needs to be listed - # in Deps.toml. - if compat_pkgname != "julia" - Test.@test haskey(deps_for_this_v, compat_pkgname) + for weak in ["", "Weak"] + compatfile = abspath(data["path"], "$(weak)Compat.toml") + depsfile = abspath(data["path"], "$(weak)Deps.toml") + if isfile(compatfile) + if weak == "Weak" + # It is NOT legal for a package to have WeakCompat.toml but not have + # WeakDeps.toml + @test isfile(depsfile) + end + compat_uncompressed = RegistryTools.Compress.load(compatfile) + deps_uncompressed = isfile(depsfile) ? RegistryTools.Compress.load(depsfile) : Dict() + for v in keys(vers) + compat_for_this_v = get(compat_uncompressed, v, Dict()) + deps_for_this_v = get(deps_uncompressed, v, Dict()) + Test.@test compat_for_this_v isa AbstractDict + Test.@test deps_for_this_v isa AbstractDict + for compat_pkgname in keys(compat_for_this_v) + if weak == "Weak" + # It is legal to have `julia` in Compat.toml. + # It is NOT legal to have `julia` in WeakCompat.toml + @test compat_pkgname != "julia" + end + # If the package has a compat entry for `julia`, there + # is no need to have `julia` listed in Deps.toml. + # However, every other (weak)compat entry needs to be listed + # in (Weak)Deps.toml. + if compat_pkgname != "julia" + Test.@test haskey(deps_for_this_v, compat_pkgname) + end end end end From 38b21d41e673be3a2b61a2d65c75f232669be172 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Tue, 31 Oct 2023 06:30:16 -0400 Subject: [PATCH 6/7] Correctly qualify a name --- src/registry_testing.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registry_testing.jl b/src/registry_testing.jl index e25b3cd9..91de42ce 100644 --- a/src/registry_testing.jl +++ b/src/registry_testing.jl @@ -252,7 +252,7 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[]) if weak == "Weak" # It is NOT legal for a package to have WeakCompat.toml but not have # WeakDeps.toml - @test isfile(depsfile) + Test.@test isfile(depsfile) end compat_uncompressed = RegistryTools.Compress.load(compatfile) deps_uncompressed = isfile(depsfile) ? RegistryTools.Compress.load(depsfile) : Dict() From 77ddbd226374371aee4082eda0ae81dd7754b7e2 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Tue, 31 Oct 2023 06:35:16 -0400 Subject: [PATCH 7/7] Correctly qualify a name --- src/registry_testing.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registry_testing.jl b/src/registry_testing.jl index 91de42ce..0a035535 100644 --- a/src/registry_testing.jl +++ b/src/registry_testing.jl @@ -265,7 +265,7 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[]) if weak == "Weak" # It is legal to have `julia` in Compat.toml. # It is NOT legal to have `julia` in WeakCompat.toml - @test compat_pkgname != "julia" + Test.@test compat_pkgname != "julia" end # If the package has a compat entry for `julia`, there # is no need to have `julia` listed in Deps.toml.