erlware / relx

Sane, simple release creation for Erlang
http://erlware.github.io/relx
Apache License 2.0
697 stars 232 forks source link

Building a tar doesn't override the erl script like building a release #877

Closed elbrujohalcon closed 3 years ago

elbrujohalcon commented 3 years ago

Using relx through rebar3

Theory

If you have a path for your erts (i.e. {include_erts, "path/to/erts"} ) in your Relx configuration, when building a release (i.e. rebar3 release), relx will correctly replace the erl script with dyn_erl, but… when it needs to put that release in a tar (i.e. rebar3 tar), it will not. You'll end up with the original erl script that’s in your erts folder.

Evidence

Questions

  1. Am I reading the code correctly?
  2. Should we change rlx_tar:maybe_include_erts/4 to just use filename:join([OutputDir, "erts-" ++ ErtsVersion]) if it exists, based on the fact that it should’ve been already generated by rebar3 release, even if just as a copy of the original path from include_erts?
tsloughter commented 3 years ago

Should we change rlx_tar:maybe_include_erts/4 to just use filename:join([OutputDir, "erts-" ++ ErtsVersion]) if it exists

Isn't that what the code you link to https://github.com/erlware/relx/blob/5a9f6ebbc30244d281d8e99aa3c9295b75efa975/src/rlx_tar.erl#L77-L94 already doing?

elbrujohalcon commented 3 years ago

No, it's not. It's missing this file replacement… https://github.com/erlware/relx/blob/5a9f6ebbc30244d281d8e99aa3c9295b75efa975/src/rlx_assemble.erl#L655-L657

Because the evaluation goes through the last case there… https://github.com/erlware/relx/blob/5a9f6ebbc30244d281d8e99aa3c9295b75efa975/src/rlx_tar.erl#L92-L93

tsloughter commented 3 years ago

Yes, I see now, sorry about that, you are right, if it is a string it needs to be still the dir in OutputDir just like if the value were true.