From 2ff81e5058ddbf75959169ab7be3c19eea6ff190 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Mon, 6 Dec 2010 21:40:54 +0100 Subject: [PATCH 01/12] Fix portability of ps invocation --- priv/templates/simplenode.runner | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/priv/templates/simplenode.runner b/priv/templates/simplenode.runner index 72d951c..023f7a4 100755 --- a/priv/templates/simplenode.runner +++ b/priv/templates/simplenode.runner @@ -66,7 +66,23 @@ case "$1" in stop) # Wait for the node to completely stop... - PID=`ps -ef|grep "$RUNNER_BASE_DIR/.*/[b]eam.smp|awk '{print $2}'"` + case `uname -s` in + Linux|Darwin|FreeBSD|DragonFly|NetBSD|OpenBSD) + # PID COMMAND + PID=`ps ax -o pid -o command|\ + grep "$RUNNER_BASE_DIR/.*/[b]eam.smp"|awk '{print $1}'` + ;; + SunOS) + # PID COMMAND + PID=`ps -ef -o pid -o args|\ + grep "$RUNNER_BASE_DIR/.*/[b]eam.smp"|awk '{print $1}'` + ;; + CYGWIN*) + # UID PID PPID TTY STIME COMMAND + PID=`ps -efW|grep "$RUNNER_BASE_DIR/.*/[b]eam.smp"|\ + awk '{print $2}'` + ;; + esac $NODETOOL stop while `kill -0 $PID 2>/dev/null`; do From 3e12630f2342fee628afd3112cc77fd769983ce3 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Tue, 7 Dec 2010 10:37:29 -0700 Subject: [PATCH 02/12] Check for VCS directory before attempting source update. --- src/rebar_deps.erl | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl index 317814f..794e423 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl @@ -297,11 +297,21 @@ download_source(AppDir, {svn, Url, Rev}) -> filename:dirname(AppDir)). update_source(Dep) -> - ?CONSOLE("Updating ~p from ~p\n", [Dep#dep.app, Dep#dep.source]), - require_source_engine(Dep#dep.source), - update_source(filename:join(get_deps_dir(), Dep#dep.app), - Dep#dep.source), - Dep. + %% It's possible when updating a source, that a given dep does not have a + %% VCS directory, such as when a source archive is built of a project, with + %% all deps already downloaded/included. So, verify that the necessary VCS + %% directory exists before attempting to do the update. + AppDir = filename:join(get_deps_dir(), Dep#dep.app), + case has_vcs_dir(element(1, Dep#dep.source), AppDir) of + true -> + ?CONSOLE("Updating ~p from ~p\n", [Dep#dep.app, Dep#dep.source]), + require_source_engine(Dep#dep.source), + update_source(AppDir, Dep#dep.source), + Dep; + false -> + ?WARN("Skipping update for ~p: no VCS directory available!\n", [Dep]), + Dep + end. update_source(AppDir, {git, _Url, {branch, Branch}}) -> rebar_utils:sh(?FMT("git fetch origin", []), [], AppDir), @@ -358,3 +368,10 @@ scm_client_vsn(bzr) -> scm_client_vsn(rebar_utils:find_executable("bzr"), " --version", "Bazaar \\(bzr\\) (\\d+).(\\d+)"); scm_client_vsn(svn) -> scm_client_vsn(rebar_utils:find_executable("svn"), " --version", "svn, version (\\d+).(\\d+)"). + +has_vcs_dir(git, Dir) -> + filelib:is_dir(filename:join(Dir, ".git")); +has_vcs_dir(hg, Dir) -> + filelib:is_dir(filename:join(Dir, ".hg")); +has_vcs_dir(_, _) -> + true. From 07269ebdb9bf814e454c1bf8333215c3d0282add Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Tue, 7 Dec 2010 19:32:58 +0100 Subject: [PATCH 03/12] Add VCS dir check for bzr and svn --- src/rebar_deps.erl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl index 794e423..0852b01 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl @@ -373,5 +373,10 @@ has_vcs_dir(git, Dir) -> filelib:is_dir(filename:join(Dir, ".git")); has_vcs_dir(hg, Dir) -> filelib:is_dir(filename:join(Dir, ".hg")); +has_vcs_dir(bzr, Dir) -> + filelib:is_dir(filename:join(Dir, ".bzr")); +has_vcs_dir(svn, Dir) -> + filelib:is_dir(filename:join(Dir, ".svn")) + orelse filelib:is_dir(filename:join(Dir, "_svn")); has_vcs_dir(_, _) -> true. From 6e9cec31ef5bb59f1651007b4af43fa0a5ac9451 Mon Sep 17 00:00:00 2001 From: Alexey Romanov Date: Tue, 7 Dec 2010 12:21:54 +0300 Subject: [PATCH 04/12] Ignore .eunit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 98df095..acf3c11 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ rebar .*.swp rt.work .hgignore +.eunit From ab4e0a32ab33d43520ab2a04cc60606252404d05 Mon Sep 17 00:00:00 2001 From: Benjamin Nortier Date: Wed, 8 Dec 2010 18:12:46 +0000 Subject: [PATCH 05/12] Add rebar code path to common test code path --- src/rebar_ct.erl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/rebar_ct.erl b/src/rebar_ct.erl index fc87dd3..316998f 100644 --- a/src/rebar_ct.erl +++ b/src/rebar_ct.erl @@ -130,13 +130,22 @@ make_cmd(TestDir, Config) -> Include = "" end, + %% Add the code path of the rebar process to the code path. This + %% includes the dependencies in the code path. The directories + %% that are part of the root Erlang install are filtered out to + %% avoid duplication + R = code:root_dir(), + NonLibCodeDirs = [P || P <- code:get_path(), lists:prefix(R, P) == false], + CodeDirs = [io_lib:format("\"~s\"", [Dir]) || + Dir <- [EbinDir|NonLibCodeDirs]], + CodePathString = string:join(CodeDirs, " "), Cmd = ?FMT("erl " % should we expand ERL_PATH? - " -noshell -pa \"~s\" ~s" + " -noshell -pa ~s ~s" " -s ct_run script_start -s erlang halt" " -name test@~s" " -logdir \"~s\"" " -env TEST_DIR \"~s\"", - [EbinDir, + [CodePathString, Include, net_adm:localhost(), LogDir, From 1aef693a72a3289ab4653362f5dc276dfdb7edd7 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Thu, 9 Dec 2010 00:21:46 +0100 Subject: [PATCH 06/12] Update THANKS file --- THANKS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/THANKS b/THANKS index 03a847e..45ea6ed 100644 --- a/THANKS +++ b/THANKS @@ -30,3 +30,6 @@ Misha Gorodnitzky Adam Kocoloski Joseph Wayne Norton Mihai Balea +Matthew Batema +Alexey Romanov +Benjamin Nortier From 6a7e26e12a46997fc3fb8c2a6fc9f009aafeeab4 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Thu, 9 Dec 2010 17:35:54 +0100 Subject: [PATCH 07/12] Disable printing of column headers in ps calls --- priv/templates/simplenode.runner | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/priv/templates/simplenode.runner b/priv/templates/simplenode.runner index 023f7a4..36db59e 100755 --- a/priv/templates/simplenode.runner +++ b/priv/templates/simplenode.runner @@ -69,12 +69,12 @@ case "$1" in case `uname -s` in Linux|Darwin|FreeBSD|DragonFly|NetBSD|OpenBSD) # PID COMMAND - PID=`ps ax -o pid -o command|\ + PID=`ps ax -o pid= -o command=|\ grep "$RUNNER_BASE_DIR/.*/[b]eam.smp"|awk '{print $1}'` ;; SunOS) # PID COMMAND - PID=`ps -ef -o pid -o args|\ + PID=`ps -ef -o pid= -o args=|\ grep "$RUNNER_BASE_DIR/.*/[b]eam.smp"|awk '{print $1}'` ;; CYGWIN*) From 48ee15c7e7806b85ac16055c2719daf3297cfd9b Mon Sep 17 00:00:00 2001 From: klaar Date: Thu, 9 Dec 2010 22:41:11 +0100 Subject: [PATCH 08/12] Fix conversion of boolean atom to string mustache:render("{{banan}}", dict:from_list([{banan, true}])). ** exception error: no function clause matching mustache:escape(true,[]) in function erl_eval:do_apply/5 in call from erl_eval:expr/5 in call from erl_eval:expr/5 in call from mustache:render/3 --- src/mustache.erl | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mustache.erl b/src/mustache.erl index df81aed..86ef53c 100644 --- a/src/mustache.erl +++ b/src/mustache.erl @@ -190,8 +190,6 @@ to_s(Val) when is_integer(Val) -> integer_to_list(Val); to_s(Val) when is_float(Val) -> io_lib:format("~.2f", [Val]); -to_s(Val) when is_boolean(Val) -> - Val; to_s(Val) when is_atom(Val) -> atom_to_list(Val); to_s(Val) -> From 618b292c3d848636c85aaf335e32618f26ab8400 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Thu, 9 Dec 2010 23:29:22 +0100 Subject: [PATCH 09/12] Add Magnus Klaar to THANKS file --- THANKS | 1 + 1 file changed, 1 insertion(+) diff --git a/THANKS b/THANKS index 45ea6ed..f94e1da 100644 --- a/THANKS +++ b/THANKS @@ -33,3 +33,4 @@ Mihai Balea Matthew Batema Alexey Romanov Benjamin Nortier +Magnus Klaar From 5bb78f619e7e186e762a3ab95dbfe6caa9f5ba15 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Fri, 10 Dec 2010 17:11:01 +0100 Subject: [PATCH 10/12] Change vm process search to include non-smp beam --- priv/templates/simplenode.runner | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/priv/templates/simplenode.runner b/priv/templates/simplenode.runner index 36db59e..184ee44 100755 --- a/priv/templates/simplenode.runner +++ b/priv/templates/simplenode.runner @@ -70,16 +70,16 @@ case "$1" in Linux|Darwin|FreeBSD|DragonFly|NetBSD|OpenBSD) # PID COMMAND PID=`ps ax -o pid= -o command=|\ - grep "$RUNNER_BASE_DIR/.*/[b]eam.smp"|awk '{print $1}'` + grep "$RUNNER_BASE_DIR/.*/[b]eam"|awk '{print $1}'` ;; SunOS) # PID COMMAND PID=`ps -ef -o pid= -o args=|\ - grep "$RUNNER_BASE_DIR/.*/[b]eam.smp"|awk '{print $1}'` + grep "$RUNNER_BASE_DIR/.*/[b]eam"|awk '{print $1}'` ;; CYGWIN*) # UID PID PPID TTY STIME COMMAND - PID=`ps -efW|grep "$RUNNER_BASE_DIR/.*/[b]eam.smp"|\ + PID=`ps -efW|grep "$RUNNER_BASE_DIR/.*/[b]eam"|\ awk '{print $2}'` ;; esac From a6063692b239ca15244d2af61d05d0f773df22e9 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Fri, 10 Dec 2010 17:12:50 +0100 Subject: [PATCH 11/12] Use cut instead of awk to extract 1st column --- priv/templates/simplenode.runner | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/priv/templates/simplenode.runner b/priv/templates/simplenode.runner index 184ee44..0fb9176 100755 --- a/priv/templates/simplenode.runner +++ b/priv/templates/simplenode.runner @@ -70,17 +70,16 @@ case "$1" in Linux|Darwin|FreeBSD|DragonFly|NetBSD|OpenBSD) # PID COMMAND PID=`ps ax -o pid= -o command=|\ - grep "$RUNNER_BASE_DIR/.*/[b]eam"|awk '{print $1}'` + grep "$RUNNER_BASE_DIR/.*/[b]eam"|cut -d' ' -f1` ;; SunOS) # PID COMMAND PID=`ps -ef -o pid= -o args=|\ - grep "$RUNNER_BASE_DIR/.*/[b]eam"|awk '{print $1}'` + grep "$RUNNER_BASE_DIR/.*/[b]eam"|cut -d' ' -f1` ;; CYGWIN*) # UID PID PPID TTY STIME COMMAND - PID=`ps -efW|grep "$RUNNER_BASE_DIR/.*/[b]eam"|\ - awk '{print $2}'` + PID=`ps -efW|grep "$RUNNER_BASE_DIR/.*/[b]eam"|cut -d' ' -f1` ;; esac $NODETOOL stop From 90c5da80334eed4b97f475e1c0553567a9f14f0a Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Fri, 10 Dec 2010 17:17:46 +0100 Subject: [PATCH 12/12] Extract column 2 on CYGWIN --- priv/templates/simplenode.runner | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/priv/templates/simplenode.runner b/priv/templates/simplenode.runner index 0fb9176..cfde552 100755 --- a/priv/templates/simplenode.runner +++ b/priv/templates/simplenode.runner @@ -79,7 +79,7 @@ case "$1" in ;; CYGWIN*) # UID PID PPID TTY STIME COMMAND - PID=`ps -efW|grep "$RUNNER_BASE_DIR/.*/[b]eam"|cut -d' ' -f1` + PID=`ps -efW|grep "$RUNNER_BASE_DIR/.*/[b]eam"|cut -d' ' -f2` ;; esac $NODETOOL stop