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

hex package broken #251

Closed
tsloughter opened this issue Sep 20, 2016 · 8 comments
Closed

hex package broken #251

tsloughter opened this issue Sep 20, 2016 · 8 comments

Comments

@tsloughter
Copy link

The hex package https://hex.pm/packages/erlydtl 0.12.0 is broken and fails to build but without error. I believe the issue is related to having a erlydtl.app.src.script with a git vsn tag in it... maybe. It is confusing, there seem to be a number of unnecessary files. Like erlydtl.app.src-e and erlydtl.app.src.script~ and erlydtl_time_compat.erl~.

@kaos
Copy link
Member

kaos commented Sep 21, 2016

Uhu.. thanks for the heads up, I'll take a look..

@kaos
Copy link
Member

kaos commented Sep 21, 2016

I've pushed a new release, 0.12.1, with the extraneous files removed.
However, the build still fails, unless you get mix to use rebar3..
With the older rebar, I get this error:

ERROR: Failed to extract name from /.../deps/erlydtl/src/erlydtl.app.src: {unexpected_terms,
                                                                                                        {ok,
                                                                                                         {application,
                                                                                                          erlydtl,
                                                                                                          [{description,
                                                                                                            "Django Template Language for Erlang"},
                                                                                                           {vsn,
                                                                                                            git},
                                                                                                           {modules,
                                                                                                            []},
                                                                                                           {applications,
                                                                                                            [kernel,
                                                                                                             stdlib,
                                                                                                             compiler,
                                                                                                             syntax_tools]},
                                                                                                           {registered,
                                                                                                            []}]}}}
** (Mix) Could not compile dependency :erlydtl, "/.../bin/rebar compile skip_deps=true deps_dir="/.../_build/dev/lib"" command failed. You can recompile this dependency with "mix deps.compile erlydtl", update it with "mix deps.update erlydtl" or clean it with "mix deps.clean erlydtl"

Whereas it with rebar3 works as expected:

$ cd deps/erlydtl/
$ rebar3 compile skip_deps=true deps_dir="/.../_build/dev/lib"
===> Verifying dependencies...
===> Compiling erlydtl
===> Getting log of git dependency failed in /.../deps/erlydtl. Falling back to version 0.0.0
$ echo $?
0

@tsloughter
Copy link
Author

An issue that still exists is {vsn, git}, in the .script, this won't work for a hex package . This is likely what causes rebar3 to keep thinking it needs a new version.

Note that skip_deps and deps_dir are not available arguments to rebar3.

Also, the issue I see is when using erlydtl as a hex dep of a project built with rebar3. When building a checkout of erlydtl itself with rebar3 it works fine.

@kaos
Copy link
Member

kaos commented Sep 23, 2016

Ok, I'm not that familiar with rebar3, nor hex. Any patches to address whatever issues there are, are most welcome ;)

@fxmy
Copy link

fxmy commented Jan 12, 2017

Well for me the situation is bit ..weird.
The first time you rum rebar3 compile, it succeeds. But if you run rebar3 compile for the second time, compilation fails silently. Run rebar3 compile for the third time, it succeeds again. Run for the forth time, you get another silent failure.
It cycles so on and so forth.... weird =(

cat rebar.config:

{erl_opts, [debug_info]}.
{deps, [{erlydtl, "0.12.1"}
        ]}.

{plugins, [
           {rebar3_erlydtl_plugin, ".*", {git, "https://github.com/tsloughter/rebar3_erlydtl_plugin.git", {branch, "master"}}}
]}.

{erlydtl_opts, [{source_ext, ".html"},
                {module_ext, "_view"},
                {auto_escape, false},
                {compiler_options, [report, return, debug_info, verbose]},
                {force_recompile, true}
                ]
}.

{provider_hooks, [{pre, [{compile, {erlydtl, compile}}]}
                  ]
}.
 fxmy@fxmy-N55SF  /tmp/huh  rebar3 compile                                            
===> Fetching rebar3_erlydtl_plugin ({git,
                                             "https://github.com/tsloughter/rebar3_erlydtl_plugin.git",
                                             {branch,"master"}})
===> Fetching erlydtl ({git,"https://github.com/erlydtl/erlydtl.git",
                                   {branch,"master"}})
===> Compiling erlydtl
===> Compiling rebar3_erlydtl_plugin
===> Verifying dependencies...
===> Fetching erlydtl ({pkg,<<"erlydtl">>,<<"0.12.1">>})
===> Downloaded package, caching at /home/fxmy/.cache/rebar3/hex/default/packages/erlydtl-0.12.1.tar
===> Compiling erlydtl
===> Getting log of git dependency failed in /tmp/huh. Falling back to version 0.0.0
===> Compiling huh
===> Running erlydtl...
 fxmy@fxmy-N55SF  /tmp/huh  ls _build/default/lib/erlydtl/ebin 
erlydtl.app                 erlydtl_compiler_utils.beam    erlydtl_filters.beam  erlydtl_scanner.beam      i18n_manager.beam
erlydtl.beam                erlydtl_contrib_humanize.beam  erlydtl_library.beam  erlydtl_slice.beam        po_generator.beam
erlydtl_beam_compiler.beam  erlydtl_dateformat.beam        erlydtl_parser.beam   erlydtl_time_compat.beam  po_scanner.beam
erlydtl_compiler.beam       erlydtl_deps.beam              erlydtl_runtime.beam  erlydtl_unparser.beam     sources_parser.beam
 fxmy@fxmy-N55SF  /tmp/huh  
 fxmy@fxmy-N55SF  /tmp/huh  rebar3 compile                    
===> Verifying dependencies...
===> Upgrading erlydtl ({pkg,<<"erlydtl">>,<<"0.12.1">>,
                                    <<"3FDE3190D30340B10CFCFDB4135A828761D468DB4E4B34817C6B91D295F3142D">>})
===> Downloaded package, caching at /home/fxmy/.cache/rebar3/hex/default/packages/erlydtl-0.12.1.tar
===> Compiling huh
===> Running erlydtl...
 fxmy@fxmy-N55SF  /tmp/huh  ls _build/default/lib/erlydtl/ebin
ls: cannot access '_build/default/lib/erlydtl/ebin': No such file or directory
 ✘ fxmy@fxmy-N55SF  /tmp/huh 

@elvanja
Copy link

elvanja commented Jan 17, 2017

Having the same issue for an Elixir project (via mix).

Creating a new project via mix new erlydtl_test and adding this to mix.exs deps:

  defp deps do
    [{:erlydtl, "~> 0.12"}]
  end

After mix deps.get && mix deps.compile && mix deps, this is the result:

* erlydtl (Hex package) (rebar3)
  locked at 0.12.1 (erlydtl) 3fde3190
  the dependency does not match the requirement "~> 0.12", got "0.0.0"

Funny enough, on another project, under same Elixir (v1.3.4) and Erlang (v18.1), the same thing reports with:

* erlydtl (Hex package) (rebar3)
  locked at 0.12.1 (erlydtl) 3fde3190
  the dependency does not match the requirement "~> 0.12", got "1.0.0+build.377.refe9e3e66"

I also tried declaring the dependency with override: true or using an older version, result is the same.

One thing I noticed is that after mix deps.compile, this is the content of erlydtl/ebin/erlydtl.app:

{application,erlydtl,
             [{description,"Django Template Language for Erlang"},
              {vsn,"1.0.0+build.377.refe9e3e66"},
              {modules,[erlydtl,erlydtl_beam_compiler,erlydtl_compiler,
                        erlydtl_compiler_utils,erlydtl_contrib_humanize,
                        erlydtl_dateformat,erlydtl_deps,erlydtl_filters,
                        erlydtl_library,erlydtl_parser,erlydtl_runtime,
                        erlydtl_scanner,erlydtl_slice,erlydtl_time_compat,
                        erlydtl_unparser,i18n_manager,po_generator,po_scanner,
                        sources_parser]},
              {applications,[kernel,stdlib,compiler,syntax_tools]},
              {registered,[]}]}.

Note the vsn info. For other dependencies this matches the version picked up by mix.

When referenced via git, e.g. {:erlydtl, github: "erlydtl/erlydtl"}, then the compiled app vsn is correct.

Apologies for not making this a PR but my lack of knowledge about rebar and hex releases kind of prevents it :-)
Anyway, hope this helps!

@kaos
Copy link
Member

kaos commented Jan 18, 2017

Thanks. I'll try to find some time to address this issue.

@tsloughter
Copy link
Author

@kaos the change for erlydtl.app.src depends on what you want. Simplest is to just replace git with the version number and publish the package. Then it will work properly from hex.

I see Heinz has rights to the package on hex, I can ask him to do it if you want? But it'll need to be a new version, so 0.12.2.

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

4 participants