erlyaws / yaws

Yaws webserver
https://erlyaws.github.io
BSD 3-Clause "New" or "Revised" License
1.28k stars 268 forks source link

rebar generate crashes when yaws built as a dep #77

Closed efine closed 12 years ago

efine commented 12 years ago

When running rebar generate on a parent project, I get a crash:

{"init terminating in do_boot","Illegal library /tmp/test_yaws_as_dep/deps/yaws/rel/../fake_lib_dir: no such file or directory"}

Environment

CentOS 5.7 x86_64, Erlang R15B, latest rebar and yaws master as of today.

To reproduce

I wrote a little script to reproduce the issue. It creates a dummy project that includes yaws as a dep to show the issue.

create_yaws_deps_test_case.sh

#!/bin/bash
TMP_DIR=$(mktemp -t -d rebar_build_XXXXXXXX)
APP=test_yaws_as_dep
APP_DIR="${TMP_DIR}/${APP}"

die() {
    echo $* >&2; exit 1;
}

mkdir -p ${APP_DIR} || die "Cannot make ${APP_DIR}"
cd ${APP_DIR} && rebar create-app appid=${APP} && mkdir rel
[[ $(pwd) == ${APP_DIR} ]] || die "$(pwd) /= ${APP_DIR}!"
cat > rebar.config <<"END"
{lib_dirs, ["deps"]}.
{sub_dirs, ["rel"]}.

{deps, [
  {'yaws', ".*", {git, "git://github.com/klacke/yaws.git", {branch, "master"}}}
]}.
END

rebar --version
rebar get-deps
cd deps/yaws > /dev/null && git describe && cd - > /dev/null
rebar compile generate

Script output

[build@vsfcctpavd12 tmp]$ ./create_yaws_deps_test_case.sh 
==> test_yaws_as_dep (create-app)
Writing src/test_yaws_as_dep.app.src
Writing src/test_yaws_as_dep_app.erl
Writing src/test_yaws_as_dep_sup.erl
rebar version: 2 date: 20120107_204935 vcs: git 7b95bc4
==> rel (get-deps)
==> test_yaws_as_dep (get-deps)
Pulling yaws from {git,"git://github.com/klacke/yaws.git",{branch,"master"}}
Cloning into yaws...
==> rel (get-deps)
==> yaws (get-deps)
yaws-1.92-7-g990bf47
==> rel (compile)
==> yaws (compile)
--- Installing local config file at /tmp/rebar_build_drUU8534/test_yaws_as_dep/deps/yaws/etc/yaws/yaws.conf
Compiled src/yaws_logger.erl
... snip ...
Compiling c_src/yaws_sendfile_drv.c
==> rel (compile)
==> test_yaws_as_dep (compile)
Compiled src/test_yaws_as_dep_app.erl
Compiled src/test_yaws_as_dep_sup.erl
==> rel (generate)
{"init terminating in do_boot","Illegal library /tmp/rebar_build_drUU8534/test_yaws_as_dep/deps/yaws/rel/../fake_lib_dir: no such file or directory"}

Crash dump was written to: erl_crash.dump
init terminating in do_boot (Illegal library /tmp/rebar_build_drUU8534/test_yaws_as_dep/deps/yaws/rel/../fake_lib_dir: no such file or directory)
efine commented 12 years ago

It looks as if the Yaws rebar plugin, rebar_reltool_link, is not being found (I ran rebar -v generate on the test base project):

DEBUG: Entering /tmp/rebar_build_cKnl9191/test_yaws_as_dep/deps/yaws
DEBUG: Consult config file "/tmp/rebar_build_cKnl9191/test_yaws_as_dep/deps/yaws/rebar.config"
DEBUG: Available deps: []
DEBUG: Missing deps  : []
WARN:  Missing plugins: [rebar_reltool_link]
DEBUG: Predirs: ["/tmp/rebar_build_cKnl9191/test_yaws_as_dep/deps/yaws/rel"]
DEBUG: Entering /tmp/rebar_build_cKnl9191/test_yaws_as_dep/deps/yaws/rel
DEBUG: Consult config file "/tmp/rebar_build_cKnl9191/test_yaws_as_dep/deps/yaws/rel/rebar.config"
DEBUG: Available deps: []
DEBUG: Missing deps  : []
WARN:  Missing plugins: [rebar_reltool_link]
DEBUG: Predirs: []
==> rel (generate)
INFO:  sh info:
    cwd: "/tmp/rebar_build_cKnl9191/test_yaws_as_dep/deps/yaws/rel"
    cmd: sed -ne '1,/^YAWS_VSN=/s/^YAWS_VSN=//p' ../vsn.mk 2>/dev/null
    opts: [{cd,"/tmp/rebar_build_cKnl9191/test_yaws_as_dep/deps/yaws/rel"},
               {use_stdout,false}]
DEBUG: vcs_vsn: Unknown VCS atom in vsn field: []
efine commented 12 years ago

Here is a solution to this issue, but I am not sure if it has other side-effects:

mkdir plugins
mv rebar_reltool_link.erl plugins/