Skip to content

Commit 2955563

Browse files
glennmoyIanButterworth
authored andcommitted
Fix bind_artifact! when platform has compare_strategy (#3624)
Co-authored-by: Ian Butterworth <[email protected]> (cherry picked from commit 799f7de)
1 parent 874690d commit 2955563

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Artifacts.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ function bind_artifact!(artifacts_toml::String, name::String, hash::SHA1;
211211
meta = artifact_dict[name]
212212
if !isa(meta, Vector)
213213
error("Mapping for '$name' within $(artifacts_toml) already exists!")
214-
elseif any(isequal(platform), unpack_platform(x, name, artifacts_toml) for x in meta)
214+
elseif any(p -> platforms_match(platform, p), unpack_platform(x, name, artifacts_toml) for x in meta)
215215
error("Mapping for '$name'/$(triplet(platform)) within $(artifacts_toml) already exists!")
216216
end
217217
end

test/artifacts.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,12 @@ end
256256
@test ensure_artifact_installed("foo_txt", artifacts_toml; platform=linux64) == artifact_path(hash2)
257257
@test ensure_artifact_installed("foo_txt", artifacts_toml; platform=win32) == artifact_path(hash)
258258

259+
# Default HostPlatform() adds a compare_strategy key that doesn't get picked up from
260+
# the Artifacts.toml
261+
testhost = Platform("x86_64", "linux", Dict("libstdcxx_version" => "1.2.3"))
262+
BinaryPlatforms.set_compare_strategy!(testhost, "libstdcxx_version", BinaryPlatforms.compare_version_cap)
263+
@test_throws ErrorException bind_artifact!(artifacts_toml, "foo_txt", hash; download_info=download_info, platform=testhost)
264+
259265
# Next, check that we can get the download_info properly:
260266
meta = artifact_meta("foo_txt", artifacts_toml; platform=win32)
261267
@test meta["download"][1]["url"] == "http://google.com/hello_world"

0 commit comments

Comments
 (0)