Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: jj1bdx/rebar
base: afffb4895a
...
head fork: jj1bdx/rebar
compare: 635d1a9456
  • 9 commits
  • 11 files changed
  • 0 commit comments
  • 3 contributors
View
2  README.md
@@ -125,7 +125,7 @@ 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.
-make: [xref_warnings] Error 1 (ignored)
+==> rebar (xref)
make: [dialyzer_warnings] Error 2 (ignored)
```
View
1  THANKS
@@ -90,3 +90,4 @@ Ali Yakout
Adam Schepis
Amit Kapoor
Ulf Wiger
+Nick Vatamaniuc
View
3  priv/shell-completion/bash/rebar
@@ -12,8 +12,7 @@ _rebar()
ct doc delete-deps eunit get-deps generate generate-upgrade \
help list-deps list-templates update-deps version xref overlay \
apps= case= force=1 jobs= suites= verbose=1 appid= previous_release= \
- nodeid= root_dir= skip_deps=true skip_apps= template= template_dir= \
- alt_urls=true"
+ nodeid= root_dir= skip_deps=true skip_apps= template= template_dir="
if [[ ${cur} == --* ]] ; then
COMPREPLY=( $(compgen -W "${lopts}" -- ${cur}) )
View
26 priv/templates/simplenode.runner
@@ -50,6 +50,14 @@ if [ -z "$NAME_ARG" ]; then
exit 1
fi
+# Extract the name type and name from the NAME_ARG for REMSH
+REMSH_TYPE=`echo $NAME_ARG | awk '{print $1}'`
+REMSH_NAME=`echo $NAME_ARG | awk '{print $2}'`
+
+# Note the `date +%s`, used to allow multiple remsh to the same node transparently
+REMSH_NAME_ARG="$REMSH_TYPE remsh`date +%s`@`echo $REMSH_NAME | awk -F@ '{print $2}'`"
+REMSH_REMSH_ARG="-remsh $REMSH_NAME"
+
# Extract the target cookie
COOKIE_ARG=`grep '^-setcookie' $VMARGS_PATH`
if [ -z "$COOKIE_ARG" ]; then
@@ -63,6 +71,9 @@ ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin
# Setup command to control the node
NODETOOL="$ERTS_PATH/escript $ERTS_PATH/nodetool $NAME_ARG $COOKIE_ARG"
+# Setup remote shell command to control node
+REMSH="$ERTS_PATH/erl $REMSH_NAME_ARG $REMSH_REMSH_ARG $COOKIE_ARG"
+
# Check the first argument for instructions
case "$1" in
start)
@@ -149,6 +160,19 @@ case "$1" in
exec $ERTS_PATH/to_erl $PIPE_DIR
;;
+ remote_console)
+ # Make sure a node IS running
+ RES=`$NODETOOL ping`
+ ES=$?
+ if [ "$ES" -ne 0 ]; then
+ echo "Node is not running!"
+ exit $ES
+ fi
+
+ shift
+ exec $REMSH
+ ;;
+
upgrade)
if [ -z "$2" ]; then
echo "Missing upgrade package argument"
@@ -226,7 +250,7 @@ case "$1" in
exec $CMD -- ${1+"$@"}
;;
*)
- echo "Usage: $SCRIPT {start|foreground|stop|restart|reboot|ping|console|console_clean|attach|upgrade}"
+ echo "Usage: $SCRIPT {start|foreground|stop|restart|reboot|ping|console|console_clean|attach|remote_console|upgrade}"
exit 1
;;
esac
View
5 rebar.config.sample
@@ -115,10 +115,7 @@
{deps, [application_name,
{application_name, "1.0.*"},
{application_name, "1.0.*",
- {git, "git://github.com/basho/rebar.git", {branch, "master"}}},
- {application_name, "1.0.*",
- {git, "git://github.com/basho/rebar.git", {branch, "master"}},
- [{alt_url, "https://github.com/basho/rebar.git"}]}]}.
+ {git, "git://github.com/basho/rebar.git", {branch, "master"}}}]}.
%% == Subdirectories ==
View
15 src/rebar_config.erl
@@ -38,10 +38,7 @@
-record(config, { dir :: file:filename(),
opts = [] :: list(),
- envs = [] :: list({module(), env()}) }).
-
--type env() :: [env_var()].
--type env_var() :: {string(), string()}.
+ envs = new_env() :: dict() }).
%% Types that can be used from other modules -- alphabetically ordered.
-export_type([config/0]).
@@ -149,14 +146,11 @@ consult_file(File) ->
set_env(Config, Mod, Env) ->
OldEnvs = Config#config.envs,
- NewEnvs = case lists:keymember(Mod, 1, OldEnvs) of
- true -> lists:keyreplace(Mod, 1, OldEnvs, {Mod, Env});
- false -> [{Mod,Env}|OldEnvs]
- end,
+ NewEnvs = dict:store(Mod, Env, OldEnvs),
Config#config{envs=NewEnvs}.
get_env(Config, Mod) ->
- proplists:get_value(Mod, Config#config.envs, []).
+ dict:fetch(Mod, Config#config.envs).
%% ===================================================================
%% Internal functions
@@ -193,3 +187,6 @@ local_opts([local | _Rest], Acc) ->
lists:reverse(Acc);
local_opts([Item | Rest], Acc) ->
local_opts(Rest, [Item | Acc]).
+
+new_env() ->
+ dict:new().
View
45 src/rebar_deps.erl
@@ -229,30 +229,15 @@ find_deps(Mode, [App | Rest], Acc) when is_atom(App) ->
find_deps(Mode, [{App, VsnRegex} | Rest], Acc) when is_atom(App) ->
find_deps(Mode, [{App, VsnRegex, undefined} | Rest], Acc);
find_deps(Mode, [{App, VsnRegex, Source} | Rest], Acc) ->
- find_deps(Mode, [{App, VsnRegex, Source, []} | Rest], Acc);
-find_deps(Mode, [{App, VsnRegex, Source, Opts} | Rest], Acc) ->
Dep = #dep { app = App,
vsn_regex = VsnRegex,
- source = get_source(Source, Opts) },
+ source = Source },
{Availability, FoundDir} = find_dep(Dep),
find_deps(Mode, Rest, acc_deps(Mode, Availability, Dep, FoundDir, Acc));
find_deps(_Mode, [Other | _Rest], _Acc) ->
?ABORT("Invalid dependency specification ~p in ~s\n",
[Other, rebar_utils:get_cwd()]).
-get_source(undefined, _Opts) ->
- undefined;
-get_source(Source, Opts) ->
- setelement(2, Source, dep_url(element(2, Source), Opts)).
-
-dep_url(Url, Opts) ->
- case rebar_config:get_global(alt_urls, "false") of
- "true" ->
- proplists:get_value(alt_url, Opts, Url);
- "false" ->
- Url
- end.
-
find_dep(Dep) ->
%% Find a dep based on its source,
%% e.g. {git, "https://github.com/mochi/mochiweb.git", "HEAD"}
@@ -400,7 +385,10 @@ download_source(AppDir, {svn, Url, Rev}) ->
ok = filelib:ensure_dir(AppDir),
rebar_utils:sh(?FMT("svn checkout -r ~s ~s ~s",
[Rev, Url, filename:basename(AppDir)]),
- [{cd, filename:dirname(AppDir)}]).
+ [{cd, filename:dirname(AppDir)}]);
+download_source(AppDir, {rsync, Url}) ->
+ ok = filelib:ensure_dir(AppDir),
+ rebar_utils:sh(?FMT("rsync -az --delete ~s/ ~s", [Url, AppDir]), []).
update_source(Dep) ->
%% It's possible when updating a source, that a given dep does not have a
@@ -441,7 +429,10 @@ update_source(AppDir, {svn, _Url, Rev}) ->
update_source(AppDir, {hg, _Url, Rev}) ->
rebar_utils:sh(?FMT("hg pull -u -r ~s", [Rev]), [{cd, AppDir}]);
update_source(AppDir, {bzr, _Url, Rev}) ->
- rebar_utils:sh(?FMT("bzr update -r ~s", [Rev]), [{cd, AppDir}]).
+ rebar_utils:sh(?FMT("bzr update -r ~s", [Rev]), [{cd, AppDir}]);
+update_source(AppDir, {rsync, Url}) ->
+ rebar_utils:sh(?FMT("rsync -az --delete ~s/ ~s",[Url,AppDir]),[]).
+
@@ -454,7 +445,7 @@ source_engine_avail(Source) ->
source_engine_avail(Name, Source).
source_engine_avail(Name, Source)
- when Name == hg; Name == git; Name == svn; Name == bzr ->
+ when Name == hg; Name == git; Name == svn; Name == bzr; Name == rsync ->
case vcs_client_vsn(Name) >= required_vcs_client_vsn(Name) of
true ->
true;
@@ -475,10 +466,11 @@ vcs_client_vsn(Path, VsnArg, VsnRegex) ->
false
end.
-required_vcs_client_vsn(hg) -> {1, 1};
-required_vcs_client_vsn(git) -> {1, 5};
-required_vcs_client_vsn(bzr) -> {2, 0};
-required_vcs_client_vsn(svn) -> {1, 6}.
+required_vcs_client_vsn(hg) -> {1, 1};
+required_vcs_client_vsn(git) -> {1, 5};
+required_vcs_client_vsn(bzr) -> {2, 0};
+required_vcs_client_vsn(svn) -> {1, 6};
+required_vcs_client_vsn(rsync) -> {2, 0}.
vcs_client_vsn(hg) ->
vcs_client_vsn(rebar_utils:find_executable("hg"), " --version",
@@ -491,7 +483,10 @@ vcs_client_vsn(bzr) ->
"Bazaar \\(bzr\\) (\\d+).(\\d+)");
vcs_client_vsn(svn) ->
vcs_client_vsn(rebar_utils:find_executable("svn"), " --version",
- "svn, version (\\d+).(\\d+)").
+ "svn, version (\\d+).(\\d+)");
+vcs_client_vsn(rsync) ->
+ vcs_client_vsn(rebar_utils:find_executable("rsync"), " --version",
+ "rsync version (\\d+).(\\d+)").
has_vcs_dir(git, Dir) ->
filelib:is_dir(filename:join(Dir, ".git"));
@@ -502,6 +497,8 @@ has_vcs_dir(bzr, Dir) ->
has_vcs_dir(svn, Dir) ->
filelib:is_dir(filename:join(Dir, ".svn"))
orelse filelib:is_dir(filename:join(Dir, "_svn"));
+has_vcs_dir(rsync, _) ->
+ true;
has_vcs_dir(_, _) ->
true.
View
39 src/rebar_port_compiler.erl
@@ -247,7 +247,7 @@ needs_link(SoName, NewBins) ->
%%
get_specs(Config, AppFile) ->
- case rebar_config:get(Config, port_specs, undefined) of
+ case rebar_config:get_local(Config, port_specs, undefined) of
undefined ->
%% TODO: DEPRECATED: remove support for non-port_specs syntax
{old, old_get_specs(Config, AppFile)};
@@ -304,9 +304,9 @@ maybe_switch_extension(_OsType, Target) ->
switch_to_dll_or_exe(Target) ->
case filename:extension(Target) of
- ".so" -> filename:rootname(Target, ".so") ++ ".dll";
- [] -> Target ++ ".exe";
- Other -> Other
+ ".so" -> filename:rootname(Target, ".so") ++ ".dll";
+ [] -> Target ++ ".exe";
+ _Other -> Target
end.
%% TODO: DEPRECATED: remove support for non-port_specs syntax [old_*()]
@@ -314,24 +314,25 @@ old_get_specs(Config, AppFile) ->
OsType = os:type(),
SourceFiles = old_get_sources(Config),
Specs =
- case rebar_config:get(Config, so_specs, undefined) of
+ case rebar_config:get_local(Config, so_specs, undefined) of
undefined ->
Objects = port_objects(SourceFiles),
%% New form of so_specs is not provided. See if the old form
%% of {so_name} is available instead
Dir = "priv",
- SoName = case rebar_config:get(Config, so_name, undefined) of
- undefined ->
- %% Ok, neither old nor new form is
- %% available. Use the app name and
- %% generate a sensible default.
- AppName = rebar_app_utils:app_name(AppFile),
- DrvName = ?FMT("~s_drv.so", [AppName]),
- filename:join([Dir, DrvName]);
- AName ->
- %% Old form is available -- use it
- filename:join(Dir, AName)
- end,
+ SoName =
+ case rebar_config:get_local(Config, so_name, undefined) of
+ undefined ->
+ %% Ok, neither old nor new form is
+ %% available. Use the app name and
+ %% generate a sensible default.
+ AppName = rebar_app_utils:app_name(AppFile),
+ DrvName = ?FMT("~s_drv.so", [AppName]),
+ filename:join([Dir, DrvName]);
+ AName ->
+ %% Old form is available -- use it
+ filename:join(Dir, AName)
+ end,
[old_get_so_spec({SoName, Objects}, OsType)];
SoSpecs ->
[old_get_so_spec(S, OsType) || S <- SoSpecs]
@@ -339,8 +340,8 @@ old_get_specs(Config, AppFile) ->
{SourceFiles, Specs}.
old_get_sources(Config) ->
- RawSources = rebar_config:get_list(Config, port_sources,
- ["c_src/*.c"]),
+ RawSources = rebar_config:get_local(Config, port_sources,
+ ["c_src/*.c"]),
FilteredSources = old_filter_port_sources(RawSources),
old_expand_sources(FilteredSources).
View
5 src/rebar_utils.erl
@@ -423,9 +423,8 @@ emulate_escript_foldl(Fun, Acc, File) ->
end.
vcs_vsn_cmd(git) ->
- %% Explicitly git-describe a committish to accommodate for projects
- %% in subdirs which don't have a GIT_DIR. In that case we will
- %% get a description of the last commit that touched the subdir.
+ %% git describe the last commit that touched CWD
+ %% required for correct versioning of apps in subdirs, such as apps/app1
case os:type() of
{win32,nt} ->
"FOR /F \"usebackq tokens=* delims=\" %i in "
View
86 test/upgrade_project/rel/files/dummy
@@ -50,6 +50,14 @@ if [ -z "$NAME_ARG" ]; then
exit 1
fi
+# Extract the name type and name from the NAME_ARG for REMSH
+REMSH_TYPE=`echo $NAME_ARG | awk '{print $1}'`
+REMSH_NAME=`echo $NAME_ARG | awk '{print $2}'`
+
+# Note the `date +%s`, used to allow multiple remsh to the same node transparently
+REMSH_NAME_ARG="$REMSH_TYPE attach`date +%s`@`echo $REMSH_NAME | awk -F@ '{print $2}'`"
+REMSH_REMSH_ARG="-remsh $REMSH_NAME"
+
# Extract the target cookie
COOKIE_ARG=`grep '^-setcookie' $VMARGS_PATH`
if [ -z "$COOKIE_ARG" ]; then
@@ -63,6 +71,9 @@ ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin
# Setup command to control the node
NODETOOL="$ERTS_PATH/escript $ERTS_PATH/nodetool $NAME_ARG $COOKIE_ARG"
+# Setup remote shell command to control node
+REMSH="$ERTS_PATH/erl $REMSH_NAME_ARG $REMSH_REMSH_ARG $COOKIE_ARG"
+
# Check the first argument for instructions
case "$1" in
start)
@@ -72,11 +83,12 @@ case "$1" in
echo "Node is already running!"
exit 1
fi
- HEART_COMMAND="$RUNNER_BASE_DIR/bin/$SCRIPT start"
+ shift # remove $1
+ RUN_PARAM=$(printf "\'%s\' " "$@")
+ HEART_COMMAND="$RUNNER_BASE_DIR/bin/$SCRIPT start $RUN_PARAM"
export HEART_COMMAND
mkdir -p $PIPE_DIR
- shift # remove $1
- $ERTS_PATH/run_erl -daemon $PIPE_DIR $RUNNER_LOG_DIR "exec $RUNNER_BASE_DIR/bin/$SCRIPT console $@" 2>&1
+ $ERTS_PATH/run_erl -daemon $PIPE_DIR $RUNNER_LOG_DIR "exec $RUNNER_BASE_DIR/bin/$SCRIPT console $RUN_PARAM" 2>&1
;;
stop)
@@ -148,6 +160,41 @@ case "$1" in
exec $ERTS_PATH/to_erl $PIPE_DIR
;;
+ remote_console)
+ # Make sure a node IS running
+ RES=`$NODETOOL ping`
+ ES=$?
+ if [ "$ES" -ne 0 ]; then
+ echo "Node is not running!"
+ exit $ES
+ fi
+
+ shift
+ exec $REMSH
+ ;;
+
+ upgrade)
+ if [ -z "$2" ]; then
+ echo "Missing upgrade package argument"
+ echo "Usage: $SCRIPT upgrade {package base name}"
+ echo "NOTE {package base name} MUST NOT include the .tar.gz suffix"
+ exit 1
+ fi
+
+ # Make sure a node IS running
+ RES=`$NODETOOL ping`
+ ES=$?
+ if [ "$ES" -ne 0 ]; then
+ echo "Node is not running!"
+ exit $ES
+ fi
+
+ node_name=`echo $NAME_ARG | awk '{print $2}'`
+ erlang_cookie=`echo $COOKIE_ARG | awk '{print $2}'`
+
+ $ERTS_PATH/escript $RUNNER_BASE_DIR/bin/install_upgrade.escript $node_name $erlang_cookie $2
+ ;;
+
console|console_clean)
# .boot file typically just $SCRIPT (ie, the app name)
# however, for debugging, sometimes start_clean.boot is useful:
@@ -160,25 +207,50 @@ case "$1" in
BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin
EMU=beam
PROGNAME=`echo $0 | sed 's/.*\\///'`
- CMD="$BINDIR/erlexec -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -mode embedded -config $CONFIG_PATH -args_file $VMARGS_PATH -- ${1+"$@"}"
+ CMD="$BINDIR/erlexec -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -mode embedded -config $CONFIG_PATH -args_file $VMARGS_PATH"
export EMU
export ROOTDIR
export BINDIR
export PROGNAME
# Dump environment info for logging purposes
- echo "Exec: $CMD"
+ echo "Exec: $CMD" -- ${1+"$@"}
echo "Root: $ROOTDIR"
# Log the startup
logger -t "$SCRIPT[$$]" "Starting up"
# Start the VM
- exec $CMD
+ exec $CMD -- ${1+"$@"}
;;
+ foreground)
+ # start up the release in the foreground for use by runit
+ # or other supervision services
+
+ BOOTFILE=$SCRIPT
+ FOREGROUNDOPTIONS="-noinput +Bd"
+
+ # Setup beam-required vars
+ ROOTDIR=$RUNNER_BASE_DIR
+ BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin
+ EMU=beam
+ PROGNAME=`echo $0 | sed 's/.*\///'`
+ CMD="$BINDIR/erlexec $FOREGROUNDOPTIONS -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -config $CONFIG_PATH -args_file $VMARGS_PATH"
+ export EMU
+ export ROOTDIR
+ export BINDIR
+ export PROGNAME
+
+ # Dump environment info for logging purposes
+ echo "Exec: $CMD" -- ${1+"$@"}
+ echo "Root: $ROOTDIR"
+
+ # Start the VM
+ exec $CMD -- ${1+"$@"}
+ ;;
*)
- echo "Usage: $SCRIPT {start|stop|restart|reboot|ping|console|console_clean|attach}"
+ echo "Usage: $SCRIPT {start|foreground|stop|restart|reboot|ping|console|console_clean|attach|remote_console|upgrade}"
exit 1
;;
esac
View
2  test/upgrade_project/rel/reltool.config
@@ -12,6 +12,8 @@
{excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)"]},
{excl_archive_filters, [".*"]},
+ {app, hipe, [{incl_cond, exclude}]},
+
{app, dummy, [{incl_cond, include}]}
]}.

No commit comments for this range

Something went wrong with that request. Please try again.