Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exclude_apps fails if the app isn't present #860

Open
dlesl opened this issue Apr 8, 2021 · 6 comments
Open

exclude_apps fails if the app isn't present #860

dlesl opened this issue Apr 8, 2021 · 6 comments

Comments

@dlesl
Copy link

dlesl commented Apr 8, 2021

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)

@ferd
Copy link
Collaborator

ferd commented Apr 10, 2021

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

@dlesl
Copy link
Author

dlesl commented Apr 10, 2021

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
Copy link
Collaborator

ferd commented Apr 10, 2021

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
Copy link
Member

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

@dlesl
Copy link
Author

dlesl commented Apr 11, 2021

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
Copy link
Collaborator

ferd commented Apr 11, 2021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants