0

I aim to get all dependencies and run riak_ensemble on my local machine. However, When I run rebar get-deps, I always encounter:

Cloning into 'neotoma'... ERROR: Dependency dir /home/project/riak/riak_ensemble_demo/deps/cuttlefish/deps/neotoma failed application validation with reason: {version_mismatch,{"/home/agung/project/riak/riak_ensemble_demo/deps/cuttlefish/deps/neotoma/src/neotoma.app.src",
                   {expected,"1.7.3"},
                   {has,"1.7.2-9-g2f2b8e6"}}}.

The error is pointing a version of neotoma. The thing is that neotoma has that version on its repository. Here's the screenshoot of the repository:

enter image description here

here's my rebar.config file for cuttlefish

{require_otp_vsn, "R16|17|18"}.

{erl_opts, [warnings_as_errors, {parse_transform, lager_transform}, debug_info, warn_untyped_record]}.

{eunit_opts, [verbose]}.
{cover_enabled, true}.

{escript_emu_args, "%%! -escript main cuttlefish_escript -smp disable +A 0\n"}.
{escript_incl_apps, [goldrush, getopt, lager]}.

{xref_checks, []}.
{xref_queries, [{"(XC - UC) || (XU - X - B - \"(rebar.*|mustache)\" : Mod)", []}]}.

{deps, [
    {getopt, ".*", {git, "git://github.com/jcomellas/getopt.git", {tag, "v0.8.2"}}},
    {lager, "(2.0|2.1|2.2).*", {git, "git://github.com/basho/lager.git", {tag, "2.2.0"}}},
    {neotoma, "1.7.3", {git, "git://github.com/seancribbs/neotoma.git", {tag, "1.7.3"}}}
  ]}.

{post_hooks, [
    {"-win32", compile, "rebar escriptize"},
    {"^((?!-win32).)*$", compile, "./rebar escriptize"}
  ]}.

[UPDATED] This is my rebar.config for riak_ensemble_demo

{erl_opts, [debug_info,
            warnings_as_errors,
            {parse_transform, lager_transform}]}.

{deps, [{lager, "2.0.3", {git, "git://github.com/basho/lager.git", {tag, "2.0.3"}}},
        {riak_ensemble, ".*", {git, "git://github.com/basho/riak_ensemble", {branch,"develop"}}}]}.

And I run rebar get-deps to fulfill all the dependencies that needed.

How do I fulfill this dependency? Thanks!

indi60
  • 867
  • 4
  • 17
  • 34
  • As I can understand it's a rebar.config of 'cuttlefish'. Can you show us rebar.config from /home/project/riak/riak_ensemble_demo and tell us how do you build your app? – P_A Mar 23 '16 at 07:42
  • hi @P_A, I've updated the question. – indi60 Mar 24 '16 at 23:06

1 Answers1

1

So basically each project has it's own rebar.config file where it specifies its own dependencies. In this case looks like one application requires a different version of neotoma than the other. The simplest way of dealing with issues like these is to "fork" (Github feature) the repositories to your account and correct the dependencies are required. Then you would update your application to require the application from your copy of the repository rather than the owner's one. Once you fix the issue you can send a pull-request (another Github feature) to the owner of the original repository so that they can incorporate your changes to their code.

You probably don't want to "fork" all repositories, just those required to fix this issue. Go to the desp folder and check all rebar.config files:

cd ~/myproject/deps
find . -name rebar.config -exec grep -Hw neotoma \{\} \;

This gives you a list of applications that require neotoma and versions in which they are required. Those application probably will need to be "forked" and corrected.

Greg
  • 8,230
  • 5
  • 38
  • 53
  • how do I correct the dependencies if the expected version is already there? I add the screenshot the dependencies that it required. I notice that it already in tag 1.7.3. – indi60 Mar 25 '16 at 08:00
  • In this case the version is created automatically by git, see `{vsn, git}` in https://github.com/seancribbs/neotoma/blob/1.7.3/src/neotoma.app.src and git generates `1.7.2-9-g2f2b8e6` (that's pretty stupid, isn't? :) There are better tools, I am sure. But eh, anyway, correct the `vsn` to be the correct version, like in here: https://github.com/yoonka/builderl/blob/master/src/builderl.app.src And also, you are cloning from a tag, not a branch. Once you make this change the dependency will need to be cloned from a branch, or you will need to create a new tag for your change. – Greg Mar 25 '16 at 09:02
  • 1
    Or alternatively just include that dependency using the generated version `1.7.2-9-g2f2b8e6` instead of `1.7.3` in the appropriate `rebar.config` file. – Greg Mar 25 '16 at 09:05
  • change rebar.config is simpler for me and it works! anyway, I couldn't find `1.7.2-9-g2f2b8e6`. how to see git generates it? – indi60 Mar 25 '16 at 09:17
  • See my previous comment (there were two comments). It's in the `app.src` file, the `{vsn, git}` bit. It should be `{vsn, "1.7.3"}` to set a specific version rather than generate it automatically. – Greg Mar 25 '16 at 10:03