erlware / relx

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

exclude_apps fails if the app isn't present #860

Open dlesl opened 3 years ago

dlesl commented 3 years ago

Repro:

{relx, [{release, {test, "0.1.0"}, [test, sasl]}, {exclude_apps, [idna]}
]}.

{overrides, [{override, hackney, [{deps, [parse_trans]}]}]}.

$ rebar3 release ... ===> Application needed for release not found: idna


Without the `override`, everything works as expected.

(tested on rebar3 3.14.4)
ferd commented 3 years ago

I'm running Rebar3 3.14.4+build.4956.ref28f7ab85 on Erlang/OTP 24 Erts 11.1.5 , and cannot reproduce this.

dlesl commented 3 years ago

Thanks for looking at this, that's strange! Here's a Dockerfile which should do the trick

FROM erlang:24.0-rc2
RUN rebar3 --version && rebar3 new release test
WORKDIR test
RUN { \
        echo '{deps, [hackney]}.'; \
        echo '{relx, [{release, {test, "0.1.0"}, [test, sasl]},'; \
        echo '        {exclude_apps, [idna]}]}.'; \
        echo '{overrides, [{override, hackney, [{deps, [{mimerl, "~>1.1"}, {certifi, "~>2.6.1"},'; \
        echo '{metrics, "~>1.0.0"}, {parse_trans, "3.3.1"}, {ssl_verify_fun, "~>1.1.0"}, {unicode_util_compat, "~>0.7.0"}]}]}]}.'; \
    } > rebar.config \
    && sed -i 's/stdlib/stdlib, hackney/' apps/test/src/test.app.src \
    && rebar3 release

(edit: included the rest of hackney's deps in the override)

ferd commented 3 years ago

Oh if hackney has a direct dependency on idna and requires it to boot, the error is not from excluding the app, it's from not being able to fulfill the requirements for hackney when the app is excluded. This isn't a bug, it means you shouldn't be able to exclude the app because it won't boot without it.

I figure that was the problem with the .app.src file which I hadn't done.

tsloughter commented 3 years ago

exclude_apps should remove the app from the .app file of anything that depends on it as well.

dlesl commented 3 years ago

Yes, without the overrides clause in the rebar.config above this is exactly what happens, relx produces a release without idna and removes it from hackney's app file.

ferd commented 3 years ago

Relx isn't aware of overrides, so my guess is that the app needs to be found for another, earlier phase of relx, for relx to then be able to drop it as an exclude?