Skip to content

Commit 4538e89

Browse files
authored
[AutoBuild] Replaced platform triplet string comparison with platform comparison in rebuild_jll_package (#1363)
* [AutoBuild] Replaced platform triplet string comparison with platform comparison in rebuild_jll_package * Re-structured "JLLs - utils" test set * Added tests for filter_main_tarball * Added a few more tests
1 parent e8ae613 commit 4538e89

File tree

2 files changed

+74
-41
lines changed

2 files changed

+74
-41
lines changed

src/AutoBuild.jl

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,27 @@ function rebuild_jll_package(obj::Dict;
11611161
)
11621162
end
11631163

1164+
# For each platform, we have two tarballs: the main with the full product,
1165+
# and the logs-only one. This function filters out the logs one, and
1166+
# finds the tarball matching `platform`.
1167+
function filter_main_tarball(tarball_filename, platform)
1168+
if occursin("-logs.", tarball_filename)
1169+
return false
1170+
end
1171+
tarball_filename_match = match(r"^(?<name>[\w_]+)\.v(?<version>\d+\.\d+\.\d+)\.(?<platform_triplet>([^-]+-?)+).tar", tarball_filename)
1172+
if isnothing(tarball_filename_match)
1173+
@warn "Tarball filename does not match expected pattern: $(tarball_filename)"
1174+
return false
1175+
end
1176+
try
1177+
tarball_filename_platform = parse(Platform, tarball_filename_match[:platform_triplet])
1178+
return tarball_filename_platform == platform
1179+
catch
1180+
@warn "Failed to parse tarball filename: $(tarball_filename)"
1181+
return false
1182+
end
1183+
end
1184+
11641185
function rebuild_jll_package(name::String, build_version::VersionNumber, sources::Vector,
11651186
platforms::Vector, products::Vector, dependencies::Vector,
11661187
download_dir::String, upload_prefix::String;
@@ -1170,10 +1191,6 @@ function rebuild_jll_package(name::String, build_version::VersionNumber, sources
11701191
# We're going to recreate "build_output_meta"
11711192
build_output_meta = Dict()
11721193

1173-
# For each platform, we have two tarballs: the main with the full product,
1174-
# and the logs-only one. This function filters out the logs one.
1175-
filter_main_tarball(f, platform) = occursin(".$(triplet(platform)).tar", f) && !occursin("-logs.", f)
1176-
11771194
# Then generate a JLL package for each platform
11781195
downloaded_files = readdir(download_dir)
11791196
for platform in sort(collect(platforms), by = triplet)

test/jll.jl

Lines changed: 53 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,59 @@ using BinaryBuilder: jll_uuid, build_project_dict, get_github_author_login, Wiza
77
module TestJLL end
88

99
@testset "JLLs - utils" begin
10-
@test jll_uuid("Zlib_jll") == UUID("83775a58-1f1d-513f-b197-d71354ab007a")
11-
@test jll_uuid("FFMPEG_jll") == UUID("b22a6f82-2f65-5046-a5b2-351ab43fb4e5")
12-
13-
project = build_project_dict("LibFoo", v"1.3.5",
14-
[Dependency("Zlib_jll"),
15-
Dependency(PackageSpec(name = "XZ_jll"), compat = "=2.4.6"),
16-
Dependency(PackageSpec(name = "Preferences", uuid = parse(UUID, "21216c6a-2e73-6563-6e65-726566657250"))),
17-
Dependency("Scratch"),])
18-
@test project["deps"] == Dict("JLLWrappers" => "692b3bcd-3c85-4b1f-b108-f13ce0eb3210",
19-
"Artifacts" => "56f22d72-fd6d-98f1-02f0-08ddc0907c33",
20-
"Pkg" => "44cfe95a-1eb2-52ea-b672-e2afdf69b78f",
21-
"Zlib_jll" => "83775a58-1f1d-513f-b197-d71354ab007a",
22-
"Libdl" => "8f399da3-3557-5675-b5ff-fb832c97cbdb",
23-
"XZ_jll" => "ffd25f8a-64ca-5728-b0f7-c24cf3aae800",
24-
"Preferences" => "21216c6a-2e73-6563-6e65-726566657250",
25-
"Scratch" => "6c6a2e73-6563-6170-7368-637461726353")
26-
@test project["name"] == "LibFoo_jll"
27-
@test project["uuid"] == "b250f842-3251-58d3-8ee4-9a24ab2bab3f"
28-
@test project["compat"] == Dict(
29-
"julia" => "1.0",
30-
"XZ_jll" => "=2.4.6",
31-
"JLLWrappers" => "1.7.0",
32-
"Libdl" => "< 0.0.1, 1",
33-
"Artifacts" => "< 0.0.1, 1",
34-
"Pkg" => "< 0.0.1, 1",
35-
)
36-
@test project["version"] == "1.3.5"
37-
# Make sure BuildDependency's don't find their way to the project
38-
@test_throws AssertionError build_project_dict("LibFoo", v"1.3.5", [Dependency("Zlib_jll"), BuildDependency("Xorg_util_macros_jll")])
39-
# `Pkg` should not be a dependency if we require Julia v1.6.
40-
@test !haskey(BinaryBuilder.build_project_dict("foo", v"1.2", Dependency[], "1.6")["deps"], "Pkg")
41-
42-
gh_auth = Wizard.github_auth(;allow_anonymous=true)
43-
@test get_github_author_login("JuliaPackaging/Yggdrasil", "invalid_hash"; gh_auth) === nothing
44-
@test get_github_author_login("JuliaPackaging/Yggdrasil", "815de56a4440f4e05333c5295d74f1dc9b73ebe3"; gh_auth) === nothing
45-
if gh_auth != GitHub.AnonymousAuth()
46-
@test get_github_author_login("JuliaPackaging/Yggdrasil", "dea7c3fadad16281ead2427f7ab9b32f1c8cb664"; gh_auth) === "Pangoraw"
10+
@testset "jll_uuid" begin
11+
@test jll_uuid("Zlib_jll") == UUID("83775a58-1f1d-513f-b197-d71354ab007a")
12+
@test jll_uuid("FFMPEG_jll") == UUID("b22a6f82-2f65-5046-a5b2-351ab43fb4e5")
13+
end
14+
15+
@testset "build_project_dict" begin
16+
project = build_project_dict("LibFoo", v"1.3.5",
17+
[Dependency("Zlib_jll"),
18+
Dependency(PackageSpec(name = "XZ_jll"), compat = "=2.4.6"),
19+
Dependency(PackageSpec(name = "Preferences", uuid = parse(UUID, "21216c6a-2e73-6563-6e65-726566657250"))),
20+
Dependency("Scratch"),])
21+
@test project["deps"] == Dict("JLLWrappers" => "692b3bcd-3c85-4b1f-b108-f13ce0eb3210",
22+
"Artifacts" => "56f22d72-fd6d-98f1-02f0-08ddc0907c33",
23+
"Pkg" => "44cfe95a-1eb2-52ea-b672-e2afdf69b78f",
24+
"Zlib_jll" => "83775a58-1f1d-513f-b197-d71354ab007a",
25+
"Libdl" => "8f399da3-3557-5675-b5ff-fb832c97cbdb",
26+
"XZ_jll" => "ffd25f8a-64ca-5728-b0f7-c24cf3aae800",
27+
"Preferences" => "21216c6a-2e73-6563-6e65-726566657250",
28+
"Scratch" => "6c6a2e73-6563-6170-7368-637461726353")
29+
@test project["name"] == "LibFoo_jll"
30+
@test project["uuid"] == "b250f842-3251-58d3-8ee4-9a24ab2bab3f"
31+
@test project["compat"] == Dict(
32+
"julia" => "1.0",
33+
"XZ_jll" => "=2.4.6",
34+
"JLLWrappers" => "1.7.0",
35+
"Libdl" => "< 0.0.1, 1",
36+
"Artifacts" => "< 0.0.1, 1",
37+
"Pkg" => "< 0.0.1, 1",
38+
)
39+
@test project["version"] == "1.3.5"
40+
# Make sure BuildDependency's don't find their way to the project
41+
@test_throws AssertionError build_project_dict("LibFoo", v"1.3.5", [Dependency("Zlib_jll"), BuildDependency("Xorg_util_macros_jll")])
42+
# `Pkg` should not be a dependency if we require Julia v1.6.
43+
@test !haskey(BinaryBuilder.build_project_dict("foo", v"1.2", Dependency[], "1.6")["deps"], "Pkg")
44+
end
45+
46+
@testset "filter_main_tarball" begin
47+
@test !BinaryBuilder.filter_main_tarball("", AnyPlatform())
48+
@test BinaryBuilder.filter_main_tarball("Foo.v1.2.3.x86_64-linux-gnu.tar.gz", Platform("x86_64", "linux"))
49+
@test !BinaryBuilder.filter_main_tarball("Foo-logs.v1.2.3.x86_64-linux-gnu.tar.gz", Platform("x86_64", "linux"))
50+
@test !BinaryBuilder.filter_main_tarball("Foo.v1.2.3.x86_64-linux-gnu-cxx11.tar.gz", Platform("x86_64", "linux"))
51+
@test !BinaryBuilder.filter_main_tarball("Foo.v1.2.3.x86_64-linux-gnu.tar.gz", Platform("x86_64", "linux"; cxxstring_abi="cxx11"))
52+
@test BinaryBuilder.filter_main_tarball("Foo_Bar.v1.2.3.aarch64-linux-gnu-cuda+12.0-cuda_platform+jetson.tar.gz", Platform("aarch64", "linux"; cuda="12.0", cuda_platform="jetson"))
53+
@test BinaryBuilder.filter_main_tarball("Foo_Bar.v1.2.3.aarch64-linux-gnu-cuda_platform+jetson-cuda+12.0.tar.gz", Platform("aarch64", "linux"; cuda="12.0", cuda_platform="jetson"))
54+
end
55+
56+
@testset "get_github_author_login" begin
57+
gh_auth = Wizard.github_auth(;allow_anonymous=true)
58+
@test get_github_author_login("JuliaPackaging/Yggdrasil", "invalid_hash"; gh_auth) === nothing
59+
@test get_github_author_login("JuliaPackaging/Yggdrasil", "815de56a4440f4e05333c5295d74f1dc9b73ebe3"; gh_auth) === nothing
60+
if gh_auth != GitHub.AnonymousAuth()
61+
@test get_github_author_login("JuliaPackaging/Yggdrasil", "dea7c3fadad16281ead2427f7ab9b32f1c8cb664"; gh_auth) === "Pangoraw"
62+
end
4763
end
4864
end
4965

0 commit comments

Comments
 (0)