From b384d88ce2e2d156ea5f7861a1f68b139e4e410e Mon Sep 17 00:00:00 2001 From: Glenn Moynihan Date: Thu, 14 Sep 2023 14:12:04 +0100 Subject: [PATCH 1/6] Fix bind_artifact! when platform has compare_strategy --- src/Artifacts.jl | 2 +- test/artifacts.jl | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Artifacts.jl b/src/Artifacts.jl index 1ee4705fb9..da93350962 100644 --- a/src/Artifacts.jl +++ b/src/Artifacts.jl @@ -173,7 +173,7 @@ function bind_artifact!(artifacts_toml::String, name::String, hash::SHA1; meta = artifact_dict[name] if !isa(meta, Vector) error("Mapping for '$name' within $(artifacts_toml) already exists!") - elseif any(isequal(platform), unpack_platform(x, name, artifacts_toml) for x in meta) + elseif any(platforms_match(platform), unpack_platform(x, name, artifacts_toml) for x in meta) error("Mapping for '$name'/$(triplet(platform)) within $(artifacts_toml) already exists!") end end diff --git a/test/artifacts.jl b/test/artifacts.jl index cf80f17a01..607d93562f 100644 --- a/test/artifacts.jl +++ b/test/artifacts.jl @@ -255,6 +255,10 @@ end @test artifact_hash("foo_txt", artifacts_toml; platform=win32) == hash @test ensure_artifact_installed("foo_txt", artifacts_toml; platform=linux64) == artifact_path(hash2) @test ensure_artifact_installed("foo_txt", artifacts_toml; platform=win32) == artifact_path(hash) + bind_artifact!(artifacts_toml, "foo_txt", hash; download_info=download_info, platform=host) + + set_compare_strategy!(linux64, "libstdcxx_version", compare_version_cap) + @test_throws ErrorException bind_artifact!(artifacts_toml, "foo_txt", hash; download_info=download_info, platform=linux64) # Next, check that we can get the download_info properly: meta = artifact_meta("foo_txt", artifacts_toml; platform=win32) From 6ec585d7679217bff26c0e14857052bdd8a9afa8 Mon Sep 17 00:00:00 2001 From: Glenn Moynihan Date: Thu, 14 Sep 2023 14:54:35 +0100 Subject: [PATCH 2/6] remove errant LOC --- test/artifacts.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/test/artifacts.jl b/test/artifacts.jl index 607d93562f..13e813b5fc 100644 --- a/test/artifacts.jl +++ b/test/artifacts.jl @@ -255,7 +255,6 @@ end @test artifact_hash("foo_txt", artifacts_toml; platform=win32) == hash @test ensure_artifact_installed("foo_txt", artifacts_toml; platform=linux64) == artifact_path(hash2) @test ensure_artifact_installed("foo_txt", artifacts_toml; platform=win32) == artifact_path(hash) - bind_artifact!(artifacts_toml, "foo_txt", hash; download_info=download_info, platform=host) set_compare_strategy!(linux64, "libstdcxx_version", compare_version_cap) @test_throws ErrorException bind_artifact!(artifacts_toml, "foo_txt", hash; download_info=download_info, platform=linux64) From 2c203e7983ce732ccf1e7bda0bd67ea89bb7c6ee Mon Sep 17 00:00:00 2001 From: Glenn Moynihan Date: Thu, 14 Sep 2023 16:06:01 +0100 Subject: [PATCH 3/6] fix method call --- src/Artifacts.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Artifacts.jl b/src/Artifacts.jl index da93350962..3ff93a3dde 100644 --- a/src/Artifacts.jl +++ b/src/Artifacts.jl @@ -173,7 +173,7 @@ function bind_artifact!(artifacts_toml::String, name::String, hash::SHA1; meta = artifact_dict[name] if !isa(meta, Vector) error("Mapping for '$name' within $(artifacts_toml) already exists!") - elseif any(platforms_match(platform), unpack_platform(x, name, artifacts_toml) for x in meta) + elseif any(p -> platforms_match(platform, p), unpack_platform(x, name, artifacts_toml) for x in meta) error("Mapping for '$name'/$(triplet(platform)) within $(artifacts_toml) already exists!") end end From 79804561c423134136e467620196b480c7623a28 Mon Sep 17 00:00:00 2001 From: Glenn Moynihan Date: Thu, 14 Sep 2023 17:25:03 +0100 Subject: [PATCH 4/6] qualify call to set_compare_strategy! --- test/artifacts.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/artifacts.jl b/test/artifacts.jl index 13e813b5fc..56b667743b 100644 --- a/test/artifacts.jl +++ b/test/artifacts.jl @@ -256,7 +256,7 @@ end @test ensure_artifact_installed("foo_txt", artifacts_toml; platform=linux64) == artifact_path(hash2) @test ensure_artifact_installed("foo_txt", artifacts_toml; platform=win32) == artifact_path(hash) - set_compare_strategy!(linux64, "libstdcxx_version", compare_version_cap) + BinaryPlatforms.set_compare_strategy!(linux64, "libstdcxx_version", compare_version_cap) @test_throws ErrorException bind_artifact!(artifacts_toml, "foo_txt", hash; download_info=download_info, platform=linux64) # Next, check that we can get the download_info properly: From e99df461b1885b9203954a7e0918ca46236c9288 Mon Sep 17 00:00:00 2001 From: Glenn Moynihan Date: Thu, 14 Sep 2023 17:49:02 +0100 Subject: [PATCH 5/6] qualify call to compare_version_cap --- test/artifacts.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/artifacts.jl b/test/artifacts.jl index 56b667743b..205c24f316 100644 --- a/test/artifacts.jl +++ b/test/artifacts.jl @@ -256,7 +256,7 @@ end @test ensure_artifact_installed("foo_txt", artifacts_toml; platform=linux64) == artifact_path(hash2) @test ensure_artifact_installed("foo_txt", artifacts_toml; platform=win32) == artifact_path(hash) - BinaryPlatforms.set_compare_strategy!(linux64, "libstdcxx_version", compare_version_cap) + BinaryPlatforms.set_compare_strategy!(linux64, "libstdcxx_version", BinaryPlatforms.compare_version_cap) @test_throws ErrorException bind_artifact!(artifacts_toml, "foo_txt", hash; download_info=download_info, platform=linux64) # Next, check that we can get the download_info properly: From 5dfc1ea6c1cdc25eff2ac3f7ba7bfa9fd8907ab8 Mon Sep 17 00:00:00 2001 From: Glenn Moynihan Date: Thu, 14 Sep 2023 18:07:30 +0100 Subject: [PATCH 6/6] fix test --- test/artifacts.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/artifacts.jl b/test/artifacts.jl index 205c24f316..41f12636c4 100644 --- a/test/artifacts.jl +++ b/test/artifacts.jl @@ -256,8 +256,11 @@ end @test ensure_artifact_installed("foo_txt", artifacts_toml; platform=linux64) == artifact_path(hash2) @test ensure_artifact_installed("foo_txt", artifacts_toml; platform=win32) == artifact_path(hash) - BinaryPlatforms.set_compare_strategy!(linux64, "libstdcxx_version", BinaryPlatforms.compare_version_cap) - @test_throws ErrorException bind_artifact!(artifacts_toml, "foo_txt", hash; download_info=download_info, platform=linux64) + # Default HostPlatform() adds a compare_strategy key that doesn't get picked up from + # the Artifacts.toml + testhost = Platform("x86_64", "linux", Dict("libstdcxx_version" => "1.2.3")) + BinaryPlatforms.set_compare_strategy!(testhost, "libstdcxx_version", BinaryPlatforms.compare_version_cap) + @test_throws ErrorException bind_artifact!(artifacts_toml, "foo_txt", hash; download_info=download_info, platform=testhost) # Next, check that we can get the download_info properly: meta = artifact_meta("foo_txt", artifacts_toml; platform=win32)