erlware / relx

Sane, simple release creation for Erlang

Home Page:http://erlware.github.io/relx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

exclude_apps fails if the app isn't present

dlesl opened this issue · comments

Repro:

  • rebar3 new release test
  • add hackney as dependency in apps/test/src/test.app.src
    Change rebar.config to:
{deps, [hackney]}.

{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)

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

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)

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.

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

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.

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?