For 4.1.4: Changes required to use zip
instead of 7z
(backport #14301)
#14303
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
erlang.mk
docs state that you can drop-inzip
on systems that don't have, or can't install, thep7zip
package. Unfortunately, this doesn't quite work with the RabbitMQ build due to a difference in howzip
adds a directory passed to it as an argument vs how7z
does.When
7z
is passed a directory as an argument, it uses the basename of the directory when adding it to the archive. This is important during the CLI tools build, because several Elixir applications are added to the final archive. Here is the command and relevant output lines showing this behavior:Notice that absolute paths to Elixir app dirs are passed to
7z
, yet the basename of those paths are added to the archive:Here is what is archived in
.erlang.mk/escript.zip
:zip file contents
When
zip
is passed a directory as an argument, the full path to that directory is re-created within the archive, which breaks the expectation ofescript
and the BEAM when it runs. Here is the command and relevant output lines showing this behavior. Note that you must use the-r
argument orzip
won't descend into directories passed to it.verbose output when zip is non-recursive
From the
/tmp/make-zip-bad.txt
output file:From the
.erlang.mk/escript.zip
archive itself:With this patch, everything works correctly. Here's the command I used to test this patch and capture output. Since we're directly globbing the
ebin
dirs for Elixir libraries, as well as other Elixir deps, the-r
argument is no longer necessary to use withzip
:Relevant lines from the
make-zip-with-patch.txt
file. Notice that the existing code inerlang.mk
to add Elixir deps does add them in anAPP/ebin/*
format, which works with both7z
andzip
. This is why I structured this patch in the same manner:Finally, here's the full output of
unzip -t
on.erlang.mk/escript.zip
, using this patch:escript.zip-content.txt
This is an automatic backport of pull request #14301 done by [Mergify](https://mergify.com).