Skip to content

Commit

Permalink
Allow disabling the isidentifier check in build_tarballs (#1282)
Browse files Browse the repository at this point in the history
Validation of the field that will determine the name of the generated
JLL package is what you want 99.9% of the time. But that other 0.1% of
the time is `Yggdrasil/0_RootFS/PlatformSupport/build_tarballs.jl`: each
invocation of the script specifies a separate platform, the triplet of
which gets embedded in the name. Unfortunately e.g.
`PlatformSupport-x86_64-unknown-freebsd13.2` is not a valid identifier,
so building PlatformSupport with recent BinaryBuilder fails.
  • Loading branch information
ararslan authored Aug 10, 2024
1 parent 24a227b commit 5354bfe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "BinaryBuilder"
uuid = "12aac903-9f7c-5d81-afc2-d9565ea332ae"
authors = ["Elliot Saba <[email protected]>"]
version = "0.5.8"
version = "0.5.9"

[deps]
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
Expand Down
8 changes: 6 additions & 2 deletions src/AutoBuild.jl
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ supported ones. A few additional keyword arguments are accept:
JLL wrapper to select the artifact. Note that this option requires the Julia
compatibility `julia_compat` to be 1.6 or higher.
* `validate_name` ensures that `src_name` constitutes a valid Julia identifier.
Since the generated JLL package is named according to `src_name`, this should
only be set to `false` if you _really_ know what you're doing.
!!! note
The `init_block` and `augment_platform_block` keyword arguments are experimental
Expand All @@ -178,7 +182,7 @@ supported ones. A few additional keyword arguments are accept:
function build_tarballs(ARGS, src_name, src_version, sources, script,
platforms, products, dependencies;
julia_compat::String = DEFAULT_JULIA_VERSION_SPEC,
kwargs...)
validate_name::Bool=true, kwargs...)
@nospecialize
# See if someone has passed in `--help`, and if so, give them the
# assistance they so clearly long for
Expand All @@ -187,7 +191,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
return nothing
end

if !Base.isidentifier(src_name)
if validate_name && !Base.isidentifier(src_name)
error("Package name \"$(src_name)\" is not a valid identifier")
end

Expand Down
4 changes: 4 additions & 0 deletions test/building.jl
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,10 @@ end
end

@test_throws ErrorException build_tarballs(String[], "", v"1.0", GitSource[], "", supported_platforms(; experimental=true), LibraryProduct[], Dependency[])

@test_throws ErrorException build_tarballs(String[], "1nvalid-name :(", v"4.20.69",
GitSource[], "", supported_platforms(),
LibraryProduct[], Dependency[])
end

@testset "AnyPlatform" begin
Expand Down

0 comments on commit 5354bfe

Please sign in to comment.