Skip to content

Commit 3d9973f

Browse files
authored
[AutoBuild] Support compression formats different from GZip (#1395)
1 parent 5b864a6 commit 3d9973f

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
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.6.4"
4+
version = "0.6.5"
55

66
[deps]
77
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
@@ -36,7 +36,7 @@ ghr_jll = "07c12ed4-43bc-5495-8a2a-d5838ef8d533"
3636
[compat]
3737
ArgParse = "1.1"
3838
Binutils_jll = "2"
39-
BinaryBuilderBase = "1.38"
39+
BinaryBuilderBase = "1.39"
4040
Downloads = "1"
4141
GitHub = "5.1"
4242
HTTP = "0.8, 0.9, 1"

src/AutoBuild.jl

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ supported ones. A few additional keyword arguments are accept:
178178
Since the generated JLL package is named according to `src_name`, this should
179179
only be set to `false` if you _really_ know what you're doing.
180180
181+
* `compression_format`: the compression format used for the generated tarballs.
182+
181183
!!! note
182184
183185
The `init_block` and `augment_platform_block` keyword arguments are experimental
@@ -187,7 +189,9 @@ supported ones. A few additional keyword arguments are accept:
187189
function build_tarballs(ARGS, src_name, src_version, sources, script,
188190
platforms, products, dependencies;
189191
julia_compat::String = DEFAULT_JULIA_VERSION_SPEC,
190-
validate_name::Bool=true, kwargs...)
192+
validate_name::Bool=true,
193+
compression_format::String="gzip",
194+
kwargs...)
191195
@nospecialize
192196
# See if someone has passed in `--help`, and if so, give them the
193197
# assistance they so clearly long for
@@ -196,6 +200,10 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
196200
return nothing
197201
end
198202

203+
if compression_format != "gzip" && minimum_compat(julia_compat) < v"1.6"
204+
error("Compression formats different from gzip are supported only from Julia v1.6, increase the Julia compat if you want to use a non-default format")
205+
end
206+
199207
if validate_name && !Base.isidentifier(src_name)
200208
error("Package name \"$(src_name)\" is not a valid identifier")
201209
end
@@ -379,6 +387,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
379387
verbose,
380388
debug,
381389
skip_audit,
390+
compression_format,
382391
kwargs...,
383392
)
384393
end
@@ -733,7 +742,9 @@ end
733742
skip_audit = false, ignore_audit_errors = true,
734743
autofix = true, code_dir = nothing,
735744
meta_json_file = nothing, require_license = true,
736-
dont_dlopen = false, kwargs...)
745+
dont_dlopen = false,
746+
compression_format = "gzip",
747+
kwargs...)
737748
738749
Runs the boiler plate code to download, build, and package a source package
739750
for a list of platforms. This method takes a veritable truckload of arguments,
@@ -781,6 +792,8 @@ here are the relevant actors, broken down in brief:
781792
the generated JLL loading the library at run time, and only prevents
782793
BinaryBuilder from doing so during JLL generation.
783794
795+
* `compression_format`: the compression format used for the generated tarballs.
796+
784797
"""
785798
function autobuild(dir::AbstractString,
786799
src_name::AbstractString,
@@ -798,6 +811,7 @@ function autobuild(dir::AbstractString,
798811
code_dir::Union{String,Nothing} = nothing,
799812
require_license::Bool = true,
800813
dont_dlopen::Bool = false,
814+
compression_format::String = "gzip",
801815
kwargs...)
802816
@nospecialize
803817

@@ -1020,6 +1034,7 @@ function autobuild(dir::AbstractString,
10201034
platform=platform,
10211035
verbose=verbose,
10221036
force=true,
1037+
compression_format,
10231038
# Do not include logs into the main tarball
10241039
filter=exclude_logs,
10251040
)
@@ -1031,6 +1046,7 @@ function autobuild(dir::AbstractString,
10311046
platform=platform,
10321047
verbose=verbose,
10331048
force=true,
1049+
compression_format,
10341050
filter=only_logs,
10351051
)
10361052
timer.end_package = time()
@@ -1062,7 +1078,7 @@ end
10621078

10631079
function download_github_release(download_dir, repo, tag; gh_auth=Wizard.github_auth(), verbose::Bool=false)
10641080
release = gh_get_json(DEFAULT_API, "/repos/$(repo)/releases/tags/$(tag)", auth=gh_auth)
1065-
assets = [a for a in release["assets"] if endswith(a["name"], ".tar.gz")]
1081+
assets = [a for a in release["assets"] if endswith(a["name"], r"\.tar\.(gz|xz|bz2)")]
10661082

10671083
for asset in assets
10681084
if verbose

test/building.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ shards_to_test = expand_cxxstring_abis(expand_gfortran_versions(shards_to_test))
195195
[Dependency("CompilerSupportLibraries_jll")];
196196
# We need to be able to build go and rust and whatnot
197197
compilers,
198+
compression_format="xz",
198199
)
199200

200201
# Test that we built everything (I'm not entirely sure how I expect

0 commit comments

Comments
 (0)