Skip to content

Commit

Permalink
Use 7zz if available
Browse files Browse the repository at this point in the history
Seems like package managers are distributing this package as 7zz instead
of 7z.
  • Loading branch information
mhanberg committed Oct 26, 2024
1 parent 4a6a7e2 commit 64192f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/burrito.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ defmodule Burrito do
exit(1)
end

if Enum.any?(~w(7z), &(System.find_executable(&1) == nil)) do
if Enum.any?(~w(7z 7zz), &(System.find_executable(&1) == nil)) do
Log.warning(
:build,
"We couldn't find 7z in your PATH, 7z is required to build Windows releases. They will fail if you don't fix this!"
"We couldn't find 7z/7zz in your PATH, 7z/7zz is required to build Windows releases. They will fail if you don't fix this!"
)
end

Expand Down
8 changes: 7 additions & 1 deletion lib/util/default_erts_resolver.ex
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,16 @@ defmodule Burrito.Util.DefaultERTSResolver do
extraction_path = System.tmp_dir!() |> Path.join(["unpacked_erts_#{random_id}"])
File.mkdir_p!(extraction_path)

seven_z =
with nil <- System.find_executable("7zz"),
nil <- System.find_executable("7z") do
raise "Couldn't find 7z/7zz"
end

# we use 7z to unpack windows setup files, otherwise we use tar
command =
case target.os do
:windows -> ~c"7z x #{tar_dest_path} -o#{extraction_path}/otp-windows/"
:windows -> ~c"#{seven_z} x #{tar_dest_path} -o#{extraction_path}/otp-windows/"
_ -> ~c"tar xzf #{tar_dest_path} -C #{extraction_path}"
end

Expand Down

0 comments on commit 64192f0

Please sign in to comment.