erlang / rebar3

Erlang build tool that makes it easy to compile and test Erlang applications and releases.
http://www.rebar3.org
Apache License 2.0
1.69k stars 516 forks source link

upgrade says " Dependency idna not found" #674

Closed goofansu closed 9 years ago

goofansu commented 9 years ago

version: rebar 3.0.0-beta-1 on Erlang/OTP 17 Erts 6.4

How to reproduce:

  1. delete _build folder
  2. rebar3 compile
  3. rebar3 upgrade

PS: rebar3 update was executed already.

ferd commented 9 years ago

What project are you using? This stuff does not work on an empty project:

λ /tmp → rebar3 new app
===> Writing mylib/src/mylib_app.erl
===> Writing mylib/src/mylib_sup.erl
===> Writing mylib/src/mylib.app.src
===> Writing mylib/rebar.config
===> Writing mylib/.gitignore
===> Writing mylib/LICENSE
===> Writing mylib/README.md
λ /tmp → cd mylib
λ mylib → rebar3 compile
===> Verifying dependencies...
===> Compiling mylib
λ mylib → rm -rf _build
λ mylib → rebar3 compile
===> Verifying dependencies...
===> Compiling mylib
λ mylib → rebar3 upgrade
===> Verifying dependencies...
goofansu commented 9 years ago

I'm using hackney and it requires idna.

{erl_opts, [debug_info]}.
{deps, [
        {hackney, ".*",
         {git, "https://github.com/benoitc/hackney.git",
          {tag, "1.3.0"}}}
       ]}.
tsloughter commented 9 years ago

Is idna in the lock file? It should complain that it is a transitive dep. Have you tried on master branch of rebar3?

goofansu commented 9 years ago

@tsloughter Yes, it's in the lock file. I've tried master branch and it remains the same.

/t/mylib ❯❯❯ cat rebar.lock
[{<<"idna">>,{pkg,<<"idna">>,<<"1.0.2">>},0},
 {<<"ssl_verify_hostname">>,{pkg,<<"ssl_verify_hostname">>,<<"1.0.5">>},0},
 {<<"hackney">>,
  {git,"https://github.com/benoitc/hackney.git",
       {ref,"e8d3b09ac5e74c414b696639d8b966f621a89855"}},
  0}].

/t/mylib ❯❯❯ ./rebar3 deps
hackney (locked git source)
idna (locked package 1.0.2)
ssl_verify_hostname (locked package 1.0.5)

FYI, my project is https://github.com/goofansu/wechat-center

goofansu commented 9 years ago

If using package dependencies, there's no problem.

~/S/wechat-center git:master ❯❯❯ ./rebar3 compile                             ✱
===> Verifying dependencies...
===> Fetching hackney ({pkg,<<"hackney">>,<<"1.3.0">>})
===> Fetching jsx ({pkg,<<"jsx">>,<<"2.6.2">>})
===> Fetching ssl_verify_hostname ({pkg,<<"ssl_verify_hostname">>,
                                           <<"1.0.5">>})
===> Fetching eredis ({pkg,<<"eredis">>,<<"1.0.8">>})
===> Fetching idna ({pkg,<<"idna">>,<<"1.0.2">>})
===> Compiling jsx
===> Compiling ssl_verify_hostname
===> Compiling idna
===> Compiling hackney
===> Compiling eredis
===> Compiling wc
~/S/wechat-center git:master ❯❯❯ cat rebar.lock                               ✱
[{<<"idna">>,{pkg,<<"idna">>,<<"1.0.2">>},1},
 {<<"eredis">>,{pkg,<<"eredis">>,<<"1.0.8">>},0},
 {<<"ssl_verify_hostname">>,{pkg,<<"ssl_verify_hostname">>,<<"1.0.5">>},1},
 {<<"jsx">>,{pkg,<<"jsx">>,<<"2.6.2">>},0},
 {<<"hackney">>,{pkg,<<"hackney">>,<<"1.3.0">>},0}].
~/S/wechat-center git:master ❯❯❯ ./rebar3 upgrade                             ✱
===> Verifying dependencies...
===> No upgrade needed for hackney
===> No upgrade needed for jsx
===> No upgrade needed for ssl_verify_hostname
===> No upgrade needed for eredis
===> No upgrade needed for idna
~/S/wechat-center git:master ❯❯❯
tsloughter commented 9 years ago

@goofansu I see the issue. In the version that doesn't work for you it somehow has idna at level 0 even though it isn't a top level dep and in the version that works it correctly has idna at level 1.

We can do better with the error message but your config and lock file did not match.

tsloughter commented 9 years ago

Maybe we just need to subtract the top level deps from the level 0 locks... I'll try that.

tsloughter commented 9 years ago

Oh! I think I figured out the bug. Because hackney is used as a git repo and idna is a package dep of that dep it is getting a 0 instead of 1 level! Ok, will work on this bug.

goofansu commented 9 years ago

I tested #679 and it's ok now.

/t/mylib ❯❯❯ cat rebar.config
{erl_opts, [debug_info]}.
{deps, [
        {hackney,
        {git, "https://github.com/benoitc/hackney.git",
        {tag, "1.3.0"}}}
 ]}.
/t/mylib ❯❯❯ cat rebar.lock
[{<<"idna">>,{pkg,<<"idna">>,<<"1.0.2">>},1},
 {<<"ssl_verify_hostname">>,{pkg,<<"ssl_verify_hostname">>,<<"1.0.5">>},1},
 {<<"hackney">>,
  {git,"https://github.com/benoitc/hackney.git",
       {ref,"e8d3b09ac5e74c414b696639d8b966f621a89855"}},
  0}].
/t/mylib ❯❯❯ ./rebar3 upgrade
===> Verifying dependencies...
===> No upgrade needed for hackney
===> No upgrade needed for ssl_verify_hostname
===> No upgrade needed for idna
/t/mylib ❯❯❯
tsloughter commented 9 years ago

Thanks!