A new user interface for you! Read more...

File relx-3.18.0-git.patch of Package relx

diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin
index 3c406aa..8c523d9 100755
--- a/priv/templates/extended_bin
+++ b/priv/templates/extended_bin
@@ -42,9 +42,9 @@ relx_get_pid() {
     fi
 }
 
-relx_get_longname() {
+relx_get_nodename() {
     id="longname$(relx_gen_id)-${NAME}"
-    "$BINDIR/erl" -boot start_clean -eval 'io:format("~s~n", [node()]), halt()' -noshell -name $id | sed -e 's/.*@//g'
+    "$BINDIR/erl" -boot start_clean -eval '[Host] = tl(string:tokens(atom_to_list(node()),"@")), io:format("~s~n", [Host]), halt()' -noshell ${NAME_TYPE} $id
 }
 
 # Connect to a remote node
@@ -64,7 +64,7 @@ relx_rem_sh() {
 
 # Generate a random id
 relx_gen_id() {
-    od -X -N 4 /dev/urandom | head -n1 | awk '{print $2}'
+    od -t x -N 4 /dev/urandom | head -n1 | awk '{print $2}'
 }
 
 # Control a node
@@ -189,15 +189,7 @@ case $NAME in
         # Nothing to do
         ;;
     *)
-        # Add @hostname
-        case $NAME_TYPE in
-             -sname)
-                 NAME=$NAME@`hostname -s`
-                 ;;
-             -name)
-                 NAME=$NAME@$(relx_get_longname)
-                 ;;
-        esac
+        NAME=$NAME@$(relx_get_nodename)
         ;;
 esac
 
@@ -449,9 +441,18 @@ case "$1" in
 
         relx_nodetool rpcterms $@
         ;;
+    eval)
+        # Make sure a node IS running
+        if ! relx_nodetool "ping" > /dev/null; then
+            echo "Node is not running!"
+            exit 1
+        fi
 
+        shift
+        relx_nodetool "eval" $@
+        ;;
     *)
-        echo "Usage: $REL_NAME {start|start_boot <file>|foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot <file>|attach|remote_console|upgrade|escript|rpc|rpcterms}"
+        echo "Usage: $REL_NAME {start|start_boot <file>|foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot <file>|attach|remote_console|upgrade|escript|rpc|rpcterms|eval}"
         exit 1
         ;;
 esac
diff --git a/priv/templates/nodetool b/priv/templates/nodetool
index b3cd247..1f409f5 100644
--- a/priv/templates/nodetool
+++ b/priv/templates/nodetool
@@ -52,9 +52,38 @@ main(Args) ->
                 Other ->
                     io:format("~p\n", [Other])
             end;
+        ["eval" | ListOfArgs] ->
+            % shells may process args into more than one, and end up stripping
+            % spaces, so this converts all of that to a single string to parse
+            String = binary_to_list(
+                      list_to_binary(
+                        string:join(ListOfArgs," ")
+                      )
+                    ),
+
+            % then just as a convenience to users, if they forgot a trailing
+            % '.' add it for them.
+            Normalized =
+              case lists:reverse(String) of
+                [$. | _] -> String;
+                R -> lists:reverse([$. | R])
+              end,
+
+            % then scan and parse the string
+            {ok, Scanned, _} = erl_scan:string(Normalized),
+            {ok, Parsed } = erl_parse:parse_exprs(Scanned),
+
+            % and evaluate it on the remote node
+            case rpc:call(TargetNode, erl_eval, exprs, [Parsed, [] ]) of
+                {value, Value, _} ->
+                    io:format ("~p\n",[Value]);
+                {badrpc, Reason} ->
+                    io:format("RPC to ~p failed: ~p\n", [TargetNode, Reason]),
+                    halt(1)
+            end;
         Other ->
             io:format("Other: ~p\n", [Other]),
-            io:format("Usage: nodetool {ping|stop|restart|reboot|rpc|rpcterms} [RPC]\n")
+            io:format("Usage: nodetool {ping|stop|restart|reboot|rpc|rpcterms|eval [Terms]} [RPC]\n")
     end,
     net_kernel:stop().
 
diff --git a/rebar.lock b/rebar.lock
index 27729ee..ba00abd 100644
--- a/rebar.lock
+++ b/rebar.lock
@@ -1,5 +1,5 @@
 [{<<"bbmustache">>,{pkg,<<"bbmustache">>,<<"1.0.4">>},0},
  {<<"cf">>,{pkg,<<"cf">>,<<"0.2.1">>},0},
- {<<"erlware_commons">>,{pkg,<<"erlware_commons">>,<<"0.18.0">>},0},
+ {<<"erlware_commons">>,{pkg,<<"erlware_commons">>,<<"0.19.0">>},0},
  {<<"getopt">>,{pkg,<<"getopt">>,<<"0.8.2">>},0},
  {<<"providers">>,{pkg,<<"providers">>,<<"1.6.0">>},0}].
diff --git a/src/rlx_prv_overlay.erl b/src/rlx_prv_overlay.erl
index 412e5ba..becdb32 100644
--- a/src/rlx_prv_overlay.erl
+++ b/src/rlx_prv_overlay.erl
@@ -197,7 +197,9 @@ merge_overlay_vars(State, FileNames) ->
                                 %% to the current one being read
                                 OverlayRelativeRoot = filename:dirname(FileName),
                                 NewTerms = check_overlay_inclusion(State, OverlayRelativeRoot, Terms),
-                                lists:ukeymerge(1, lists:ukeysort(1, NewTerms), Acc);
+                                lists:foldl(fun(NewTerm, A) ->
+                                                lists:keystore(element(1, NewTerm), 1, A, NewTerm)
+                                            end, Acc, NewTerms);
                             {error, Reason} ->
                                 ec_cmd_log:warn(rlx_state:log(State),
                                                 format_error({unable_to_read_varsfile, FileName, Reason})),
diff --git a/test/rlx_release_SUITE.erl b/test/rlx_release_SUITE.erl
index 710370a..780b1c8 100644
--- a/test/rlx_release_SUITE.erl
+++ b/test/rlx_release_SUITE.erl
@@ -550,6 +550,7 @@ overlay_release(Config) ->
     VarsFile1 = filename:join([LibDir1, "vars1.config"]),
     rlx_test_utils:write_config(VarsFile1, [{yahoo, "yahoo"},
                                             {yahoo2, [{foo, "bar"}]},
+                                            {foo_yahoo, "foo_{{yahoo}}"},
                                             {foo_dir, "foodir"}]),
 
     VarsFile2 = filename:join([LibDir1, "vars2.config"]),
@@ -610,6 +611,8 @@ overlay_release(Config) ->
                  proplists:get_value(release_name, TemplateData)),
     ?assertEqual("yahoo/foo4",
                  proplists:get_value(yahoo4, TemplateData)),
+    ?assertEqual("foo_yahoo",
+                 proplists:get_value(foo_yahoo, TemplateData)),
     ?assertEqual("yahoo",
                  proplists:get_value(google, TemplateData)).
 
diff --git a/test/rlx_test_utils.erl b/test/rlx_test_utils.erl
index 9db2835..1157e3f 100644
--- a/test/rlx_test_utils.erl
+++ b/test/rlx_test_utils.erl
@@ -77,4 +77,5 @@ test_template_contents() ->
         "{yahoo4, \"{{yahoo4}}\"}.\n"
         "{yahoo, \"{{yahoo}}\"}.\n"
         "{foo_dir, \"{{foo_dir}}\"}.\n"
+        "{foo_yahoo, \"{{foo_yahoo}}\"}.\n"
         "{google, \"{{google}}\"}.\n".