diff --git a/erlang.mk b/erlang.mk index 49c4519b82..0f57cdc265 100644 --- a/erlang.mk +++ b/erlang.mk @@ -3695,11 +3695,17 @@ define hex_tarball_create.erl $(if $(DEPS),dummy => dummy) }, Requirements = maps:remove(dummy, Requirements0), + StripAllRelative = fun StripAll(S) -> + case string:prefix(S, "../") of + nomatch -> S; + S1 -> StripAll(S1) + end + end, Metadata0 = #{ app => <<"$(strip $(PROJECT))">>, build_tools => [<<"make">>, <<"rebar3">>], description => <<"$(strip $(PROJECT_DESCRIPTION))">>, - files => [unicode:characters_to_binary(F) || F <- Files0], + files => [unicode:characters_to_binary(StripAllRelative(F)) || F <- Files0], name => <<"$(strip $(PROJECT))">>, requirements => Requirements, version => <<"$(strip $(PROJECT_VERSION))">> @@ -3707,9 +3713,9 @@ define hex_tarball_create.erl Metadata = Metadata0$(HEX_TARBALL_EXTRA_METADATA), Files = [case file:read_file(F) of {ok, Bin} -> - {F, Bin}; + {StripAllRelative(F), Bin}; {error, Reason} -> - io:format("Error trying to open file ~0p: ~0p~n", [F, Reason]), + io:format(standard_error, "Error trying to open file ~0p: ~0p~n", [F, Reason]), halt(82) end || F <- Files0], case hex_tarball:create(Metadata, Files) of @@ -3717,7 +3723,7 @@ define hex_tarball_create.erl ok = file:write_file("$(strip $(HEX_TARBALL_OUTPUT_FILE))", Tarball), halt(0); {error, Reason} -> - io:format("Error ~0p~n", [Reason]), + io:format(standard_error, "Error ~0p~n", [Reason]), halt(83) end endef