Skip to content

Commit 5354bfe

Browse files
authored
Allow disabling the isidentifier check in build_tarballs (#1282)
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.
1 parent 24a227b commit 5354bfe

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "BinaryBuilder"
22
uuid = "12aac903-9f7c-5d81-afc2-d9565ea332ae"
33
authors = ["Elliot Saba <[email protected]>"]
4-
version = "0.5.8"
4+
version = "0.5.9"
55

66
[deps]
77
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"

src/AutoBuild.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ supported ones. A few additional keyword arguments are accept:
169169
JLL wrapper to select the artifact. Note that this option requires the Julia
170170
compatibility `julia_compat` to be 1.6 or higher.
171171
172+
* `validate_name` ensures that `src_name` constitutes a valid Julia identifier.
173+
Since the generated JLL package is named according to `src_name`, this should
174+
only be set to `false` if you _really_ know what you're doing.
175+
172176
!!! note
173177
174178
The `init_block` and `augment_platform_block` keyword arguments are experimental
@@ -178,7 +182,7 @@ supported ones. A few additional keyword arguments are accept:
178182
function build_tarballs(ARGS, src_name, src_version, sources, script,
179183
platforms, products, dependencies;
180184
julia_compat::String = DEFAULT_JULIA_VERSION_SPEC,
181-
kwargs...)
185+
validate_name::Bool=true, kwargs...)
182186
@nospecialize
183187
# See if someone has passed in `--help`, and if so, give them the
184188
# assistance they so clearly long for
@@ -187,7 +191,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
187191
return nothing
188192
end
189193

190-
if !Base.isidentifier(src_name)
194+
if validate_name && !Base.isidentifier(src_name)
191195
error("Package name \"$(src_name)\" is not a valid identifier")
192196
end
193197

test/building.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,10 @@ end
360360
end
361361

362362
@test_throws ErrorException build_tarballs(String[], "", v"1.0", GitSource[], "", supported_platforms(; experimental=true), LibraryProduct[], Dependency[])
363+
364+
@test_throws ErrorException build_tarballs(String[], "1nvalid-name :(", v"4.20.69",
365+
GitSource[], "", supported_platforms(),
366+
LibraryProduct[], Dependency[])
363367
end
364368

365369
@testset "AnyPlatform" begin

0 commit comments

Comments
 (0)