Permalink
Browse files

Merge remote-tracking branch 'upstream/master'

  • Loading branch information...
2 parents 6fb336d + 2e36109 commit 867a915ead4dde5e18ee6d5d4ecb256fe12faa99 @mdaguete mdaguete committed May 15, 2012
Showing with 1,831 additions and 768 deletions.
  1. +4 −0 .gitignore
  2. +14 −5 Makefile
  3. +29 −11 README.md
  4. +16 −0 THANKS
  5. +13 −1 bootstrap
  6. +2 −0 dialyzer_reference
  7. +0 −3 include/rebar.hrl
  8. +2 −1 inttest/ct1/ct1_rt.erl
  9. +2 −0 inttest/ct1/rebar.config
  10. +2 −2 priv/shell-completion/bash/rebar
  11. +3 −1 priv/templates/basicnif.c
  12. +0 −4 priv/templates/simplemod.erl
  13. +44 −0 priv/templates/simplenode.install_upgrade.escript
  14. +14 −11 priv/templates/simplenode.reltool.config
  15. +79 −7 priv/templates/simplenode.runner
  16. +1 −0 priv/templates/simplenode.template
  17. +4 −4 priv/templates/simplenode.vm.args
  18. +33 −5 priv/templates/simplenode.windows.runner.cmd
  19. +1 −1 priv/templates/simplesrv.erl
  20. +0 −4 rebar.bat
  21. +10 −1 rebar.config
  22. +27 −15 rebar.config.sample
  23. +206 −93 src/getopt.erl
  24. +5 −0 src/mustache.erl
  25. +28 −8 src/rebar.erl
  26. +8 −9 src/rebar_abnfc_compiler.erl
  27. +45 −54 src/rebar_app_utils.erl
  28. +1 −1 src/rebar_appups.erl
  29. +6 −2 src/rebar_asn1_compiler.erl
  30. +60 −11 src/rebar_config.erl
  31. +199 −98 src/rebar_core.erl
  32. +25 −32 src/rebar_ct.erl
  33. +32 −14 src/rebar_deps.erl
  34. +7 −1 src/rebar_erlc_compiler.erl
  35. +20 −16 src/rebar_erlydtl_compiler.erl
  36. +69 −41 src/rebar_eunit.erl
  37. +19 −0 src/rebar_file_utils.erl
  38. +9 −11 src/rebar_lfe_compiler.erl
  39. +14 −7 src/rebar_log.erl
  40. +18 −19 src/rebar_neotoma_compiler.erl
  41. +352 −192 src/rebar_port_compiler.erl
  42. +68 −14 src/rebar_rel_utils.erl
  43. +5 −3 src/rebar_reltool.erl
  44. +14 −5 src/rebar_subdirs.erl
  45. +2 −2 src/rebar_templater.erl
  46. +43 −19 src/rebar_upgrade.erl
  47. +175 −30 src/rebar_utils.erl
  48. +19 −3 src/rebar_xref.erl
  49. +1 −0 test/upgrade_project/README.md
  50. +79 −7 test/upgrade_project/rel/files/dummy
  51. +2 −0 test/upgrade_project/rel/reltool.config
View
@@ -6,3 +6,7 @@ rebar
rt.work
.hgignore
.eunit
+dialyzer_warnings
+xref_warnings
+rebar.cmd
+rebar.ps1
View
@@ -1,13 +1,22 @@
+.PHONY: dialyzer_warnings xref_warnings
+
all:
./bootstrap
clean:
@rm -rf rebar ebin/*.beam inttest/rt.work
debug:
- ./bootstrap debug
+ @./bootstrap debug
+
+check: debug xref dialyzer
+
+xref:
+ @./rebar xref
+
+dialyzer: dialyzer_warnings
+ @diff -U0 dialyzer_reference dialyzer_warnings
-check: debug
- -@./rebar xref
- -@dialyzer ebin --verbose -Wunmatched_returns -Werror_handling \
- -Wrace_conditions
+dialyzer_warnings:
+ -@dialyzer -q -n ebin -Wunmatched_returns -Werror_handling \
+ -Wrace_conditions > dialyzer_warnings
View
@@ -14,8 +14,9 @@ locations (git, hg, etc).
Building
--------
-Information on building and installing Erlang/OTP can be found
-in the `INSTALL.md` document.
+Information on building and installing [Erlang/OTP](http://www.erlang.org)
+can be found [here](https://github.com/erlang/otp/wiki/Installation)
+([more info](https://github.com/erlang/otp/blob/master/INSTALL.md)).
### Dependencies
@@ -28,7 +29,9 @@ Should you want to clone the rebar repository, you will also require git.
Clone the git repository:
- $ git clone git://github.com/basho/rebar.git
+```sh
+$ git clone git://github.com/basho/rebar.git
+```
#### Building rebar
@@ -69,7 +72,8 @@ Do not mix spaces and tabs.
Do not introduce lines longer than 80 characters.
[erlang-mode (emacs)](http://www.erlang.org/doc/man/erlang.el.html) indentation is preferred.
-vi-only users are encouraged to give [Vim emulation](http://emacswiki.org/emacs/Evil) ([more info](https://gitorious.org/evil/pages/Home)) a try.
+vi-only users are encouraged to give [Vim emulation](http://emacswiki.org/emacs/Evil)
+([more info](https://gitorious.org/evil/pages/Home)) a try.
Writing Commit Messages
-----------------------
@@ -106,18 +110,32 @@ Longer description (wrap at 72 characters)
Dialyzer and Tidier
-------------------
-Before you submit a patch check for discrepancies with
-[Dialyzer](http://www.erlang.org/doc/man/dialyzer.html):
+Before you submit a patch check for
+[xref](http://www.erlang.org/doc/man/xref.html) and
+[Dialyzer](http://www.erlang.org/doc/man/dialyzer.html)
+warnings.
+
+A successful run of ``make check`` looks like:
```sh
$ make check
+Recompile: src/rebar_core
+==> rebar (compile)
+Command 'debug' not understood or not applicable
+Congratulations! You now have a self-contained script called "rebar" in
+your current working directory. Place this script anywhere in your path
+and you can use rebar to build OTP-compliant apps.
+==> rebar (xref)
+make: [dialyzer_warnings] Error 2 (ignored)
```
-The following discrepancies are known and safe to ignore:
-
-```
-rebar_utils.erl:147: Call to missing or unexported function escript:foldl/3
-```
+[xref](http://www.erlang.org/doc/man/xref.html) and
+[Dialyzer](http://www.erlang.org/doc/man/dialyzer.html) warnings are compared
+against a set of safe-to-ignore warnings
+found in
+[dialyzer_reference](https://raw.github.com/tuncer/rebar/maint/dialyzer_reference)
+and
+[xref_reference](https://raw.github.com/tuncer/rebar/maint/xref_reference).
It is **strongly recommended** to check the code with
[Tidier](http://tidier.softlab.ntua.gr:20000/tidier/getstarted).
View
16 THANKS
@@ -75,3 +75,19 @@ Anton Lavrik
Jan Vincent Liwanag
Przemyslaw Dabek
Fabian Linzberger
+Smith Winston
+Jesse Gumm
+Torbjorn Tornkvist
+Ali Sabil
+Tomas Abrahamsson
+Francis Joanis
+fisher@yun.io
+Yurin Slava
+Phillip Toland
+Mike Lazar
+Loic Hoguin
+Ali Yakout
+Adam Schepis
+Amit Kapoor
+Ulf Wiger
+Nick Vatamaniuc
View
@@ -79,11 +79,15 @@ main(Args) ->
halt(1)
end,
- %% Finally, update executable perms for our script
+ %% Finally, update executable perms for our script on *nix,
+ %% or write out script files on win32.
case os:type() of
{unix,_} ->
[] = os:cmd("chmod u+x rebar"),
ok;
+ {win32,_} ->
+ write_windows_scripts(),
+ ok;
_ ->
ok
end,
@@ -126,3 +130,11 @@ vcs_info([{Id, Dir, Cmd} | Rest]) ->
false ->
vcs_info(Rest)
end.
+
+write_windows_scripts() ->
+ CmdScript=
+ "@echo off\r\n"
+ "setlocal\r\n"
+ "set rebarscript=%~f0\r\n"
+ "escript.exe \"%rebarscript:.cmd=%\" %*\r\n",
+ ok = file:write_file("rebar.cmd", CmdScript).
View
@@ -0,0 +1,2 @@
+
+rebar_utils.erl:154: Call to missing or unexported function escript:foldl/3
View
@@ -10,6 +10,3 @@
-define(ERROR(Str, Args), rebar_log:log(error, Str, Args)).
-define(FMT(Str, Args), lists:flatten(io_lib:format(Str, Args))).
-
--define(DEPRECATED(Key, Old, New, Opts, When),
- rebar_utils:deprecated(Key, Old, New, Opts, When)).
View
@@ -6,7 +6,8 @@
files() ->
[{create, "ebin/a1.app", app(a1)},
{copy, "../../rebar", "rebar"},
- {copy, "test_SUITE.erl", "test/test_SUITE.erl"}].
+ {copy, "rebar.config", "rebar.config"},
+ {copy, "test_SUITE.erl", "itest/test_SUITE.erl"}].
run(_Dir) ->
{ok, _} = retest:sh("./rebar compile ct"),
View
@@ -0,0 +1,2 @@
+
+{ct_dir, "itest"}.
@@ -11,8 +11,8 @@ _rebar()
cmdsnvars="check-deps clean compile create create-app create-node \
ct doc delete-deps eunit get-deps generate generate-upgrade \
help list-deps list-templates update-deps version xref overlay \
- case= force=1 jobs= suite= verbose=1 appid= previous_release= \
- skip_deps=true skip_app= template= template_dir="
+ apps= case= force=1 jobs= suites= verbose=1 appid= previous_release= \
+ nodeid= root_dir= skip_deps=true skip_apps= template= template_dir="
if [[ ${cur} == --* ]] ; then
COMPREPLY=( $(compgen -W "${lopts}" -- ${cur}) )
@@ -1,6 +1,6 @@
#include "erl_nif.h"
-static ErlNifResourceType* {{module}}_RESOURCE;
+static ErlNifResourceType* {{module}}_RESOURCE = NULL;
typedef struct
{
@@ -51,6 +51,8 @@ static int on_load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info)
if (rt == NULL)
return -1;
+ {{module}}_RESOURCE = rt;
+
return 0;
}
@@ -2,9 +2,5 @@
-export([my_func/0]).
--ifdef(TEST).
--compile(export_all).
--endif.
-
my_func() ->
ok.
@@ -0,0 +1,44 @@
+#!/usr/bin/env escript
+%%! -noshell -noinput
+%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
+%% ex: ft=erlang ts=4 sw=4 et
+
+-define(TIMEOUT, 60000).
+-define(INFO(Fmt,Args), io:format(Fmt,Args)).
+
+main([NodeName, Cookie, ReleasePackage]) ->
+ TargetNode = start_distribution(NodeName, Cookie),
+ {ok, Vsn} = rpc:call(TargetNode, release_handler, unpack_release,
+ [ReleasePackage], ?TIMEOUT),
+ ?INFO("Unpacked Release ~p~n", [Vsn]),
+ {ok, OtherVsn, Desc} = rpc:call(TargetNode, release_handler,
+ check_install_release, [Vsn], ?TIMEOUT),
+ {ok, OtherVsn, Desc} = rpc:call(TargetNode, release_handler,
+ install_release, [Vsn], ?TIMEOUT),
+ ?INFO("Installed Release ~p~n", [Vsn]),
+ ok = rpc:call(TargetNode, release_handler, make_permanent, [Vsn], ?TIMEOUT),
+ ?INFO("Made Release ~p Permanent~n", [Vsn]);
+main(_) ->
+ init:stop(1).
+
+start_distribution(NodeName, Cookie) ->
+ MyNode = make_script_node(NodeName),
+ {ok, _Pid} = net_kernel:start([MyNode, shortnames]),
+ erlang:set_cookie(node(), list_to_atom(Cookie)),
+ TargetNode = make_target_node(NodeName),
+ case {net_kernel:hidden_connect_node(TargetNode),
+ net_adm:ping(TargetNode)} of
+ {true, pong} ->
+ ok;
+ {_, pang} ->
+ io:format("Node ~p not responding to pings.\n", [TargetNode]),
+ init:stop(1)
+ end,
+ TargetNode.
+
+make_target_node(Node) ->
+ [_, Host] = string:tokens(atom_to_list(node()), "@"),
+ list_to_atom(lists:concat([Node, "@", Host])).
+
+make_script_node(Node) ->
+ list_to_atom(lists:concat([Node, "_upgrader_", os:getpid()])).
@@ -1,10 +1,13 @@
{sys, [
{lib_dirs, []},
+ {erts, [{mod_cond, derived}, {app_file, strip}]},
+ {app_file, strip},
{rel, "{{nodeid}}", "1",
[
kernel,
stdlib,
- sasl
+ sasl,
+ {{nodeid}}
]},
{rel, "start_clean", "",
[
@@ -13,16 +16,15 @@
]},
{boot_rel, "{{nodeid}}"},
{profile, embedded},
+ {incl_cond, exclude},
{excl_archive_filters, [".*"]}, %% Do not archive built libs
- {excl_sys_filters, ["^bin/.*",
- "^erts.*/bin/(dialyzer|typer)"]},
-
- %% Including HiPE can cause issues generating your first upgrade.
- %% If you plan to distribute HiPE in your release remove the
- %% following line.
- {app, hipe, [{incl_cond, exclude}]},
-
- {app, sasl, [{incl_cond, include}]}
+ {excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)",
+ "^erts.*/(doc|info|include|lib|man|src)"]},
+ {excl_app_filters, ["\.gitignore"]},
+ {app, sasl, [{incl_cond, include}]},
+ {app, stdlib, [{incl_cond, include}]},
+ {app, kernel, [{incl_cond, include}]},
+ {app, {{nodeid}}, [{incl_cond, include}]}
]}.
{target_dir, "{{nodeid}}"}.
@@ -32,8 +34,9 @@
{copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
{copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
{copy, "files/{{nodeid}}", "bin/{{nodeid}}"},
- {copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"},
{copy, "files/{{nodeid}}.cmd", "bin/{{nodeid}}.cmd"},
{copy, "files/start_erl.cmd", "bin/start_erl.cmd"},
+ {copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"},
+ {copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"},
{copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"}
]}.
Oops, something went wrong.

0 comments on commit 867a915

Please sign in to comment.