diff options
-rw-r--r-- | RELEASE-NOTES.md | 114 | ||||
-rw-r--r-- | ebin/rebar.app | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | priv/templates/simplenode.install_upgrade.escript | 8 | ||||
-rw-r--r-- | priv/templates/simplenode.reltool.config | 2 | ||||
-rwxr-xr-x | priv/templates/simplenode.runner | 46 | ||||
-rw-r--r-- | src/rebar_rel_utils.erl | 8 | ||||
-rw-r--r-- | src/rebar_reltool.erl | 33 |
7 files changed, 137 insertions, 76 deletions
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index a072d1b..093e771 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,66 +1,64 @@ +# Rebar 2.3.1 + +## PR's Merged + +* rebar/242: [Extra commits for #129](https://github.com/rebar/rebar/pull/242) +* rebar/244: [Document skip_apps=, apps=, and require_*_vsn](https://github.com/rebar/rebar/pull/244) +* rebar/251: [Make sure that eunit/qc_compile_opts works](https://github.com/rebar/rebar/pull/251) +* rebar/255: [rebar.app: remove superfluous quoting](https://github.com/rebar/rebar/pull/255) +* rebar/274: [Use lowercase for Windows drive name to resolve issue #250](https://github.com/rebar/rebar/pull/274) + # Rebar 2.3.0 -* rebar/56: [add preprocess support for edoc](https://github.com/basho/rebar/pull/56) -* rebar/90: [look for new and old versions in the target parent](https://github.com/basho/rebar/pull/90) -* rebar/95: [Propagate exit status from nodetool to runner script](https://github.com/basho/rebar/pull/95) -* rebar/98: [Restore R13B03 compatibility](https://github.com/basho/rebar/pull/98) -* rebar/115: [specify the erlang system module name while calling monitor/2](https://github.com/basho/rebar/pull/115) -* rebar/129: [Allow plugins to participate in pre and post processing](https://github.com/basho/rebar/pull/129) -* rebar/139: [@ characters before elses were causing the script to not run](https://github.com/basho/rebar/pull/139) -* rebar/175: [Common Test changes to add configurable log dir and improve testing framework overlaps.](https://github.com/basho/rebar/pull/175) -* rebar/188: [Generated rebar.cmd needs a tweak](https://github.com/basho/rebar/issues/188) -* rebar/208: [Is the "Release Handling" wiki page out of date?](https://github.com/basho/rebar/issues/208) -* rebar/219: [remove dependency on erl_interface](https://github.com/basho/rebar/pull/219) -* rebar/220: [add crypto, syntax_tools and tools to applications key as dependencies](https://github.com/basho/rebar/pull/220) -* rebar/221: [Versioning scheme](https://github.com/basho/rebar/issues/221) -* rebar/223: [ebadf if run under nohup](https://github.com/basho/rebar/issues/223) -* rebar/224: [When generating a release rebar should expand VCS version in the top directory (git)](https://github.com/basho/rebar/pull/224) -* rebar/226: [make check dialyzer error](https://github.com/basho/rebar/issues/226) -* rebar/228: [about load plugin modules](https://github.com/basho/rebar/issues/228) -* rebar/230: [Support ct_run using short name](https://github.com/basho/rebar/pull/230) -* rebar/232: [bug about ./rebar generate ](https://github.com/basho/rebar/issues/232) -* rebar/233: [Add {git_format, Format} notation for vsn entries](https://github.com/basho/rebar/pull/233) -* rebar/234: [Use ?INFO instead of ?CONSOLE when printing directory changes](https://github.com/basho/rebar/pull/234) -* rebar/237: [Allow rebar.config and reltool.config to be configured](https://github.com/basho/rebar/pull/237) -* rebar/252: [eunit suite=<suite name> fails if there is a rebar dependency defined.](https://github.com/basho/rebar/issues/252) -* rebar/253: [rebar creates templates in deps as well as main](https://github.com/basho/rebar/issues/253) -* rebar/254: [Force running eunit tests via -k cmdline switch](https://github.com/basho/rebar/pull/254) -* rebar/265: [Fix rebar_base_compiler:format_errors/3 for errors in include files](https://github.com/basho/rebar/pull/265) -* rebar/267: [Add 'eunit-compile' cmd (Suggested-by: Joe Norton)](https://github.com/basho/rebar/pull/267) -* rebar/268: [Add 'qc' command](https://github.com/basho/rebar/pull/268) -* rebar/269: [Add qc and test-compile commands](https://github.com/basho/rebar/pull/269) +## PR's Merged +* rebar/98: [Repetition of environment variable definitions in child processes (ports)](https://github.com/rebar/rebar/pull/98) +* rebar/115: [Incorrect REMSH args when sname is used.](https://github.com/rebar/rebar/pull/115) +* rebar/129: [Speed up the compilation process v5](https://github.com/rebar/rebar/pull/129) +* rebar/139: [Allow specification of module dependencies for appups](https://github.com/rebar/rebar/pull/139) +* rebar/175: [CWD plugins regression](https://github.com/rebar/rebar/pull/175) +* rebar/188: [Xref extra path](https://github.com/rebar/rebar/pull/188) +* rebar/208: [Fix typo in rebar_erlydtl_compiler](https://github.com/rebar/rebar/pull/208) +* rebar/219: [Added R16B01 and R16B02 to travis config.](https://github.com/rebar/rebar/pull/219) +* rebar/221: [Adapt erlydtl compiler plugin to latest version of erlydtl](https://github.com/rebar/rebar/pull/221) +* rebar/223: [Add random_suite_order option to eunit command](https://github.com/rebar/rebar/pull/223) +* rebar/224: [allow suites or tests as options for eunit and ct](https://github.com/rebar/rebar/pull/224) +* rebar/230: [eunit: fix dialyzer warnings introduced in 03da5e0b](https://github.com/rebar/rebar/pull/230) +* rebar/232: [Document support for abbreviated commands](https://github.com/rebar/rebar/pull/232) +* rebar/233: [docs: fix #228](https://github.com/rebar/rebar/pull/233) +* rebar/234: [Fix #220 (Reported-by: Joseph Norton)](https://github.com/rebar/rebar/pull/234) +* rebar/237: [Add partial support for Erlang/OTP 17](https://github.com/rebar/rebar/pull/237) +* rebar/252: [file_utils: properly report errors (fix #95)](https://github.com/rebar/rebar/pull/252) +* rebar/254: [Fix 'rebar generate' regression (#253)](https://github.com/rebar/rebar/pull/254) +* rebar/265: [Fix 'rebar help clean' function_clause error](https://github.com/rebar/rebar/pull/265) +* rebar/268: [Fix #267 (code path regression)](https://github.com/rebar/rebar/pull/268) +* rebar/269: [Update THANKS](https://github.com/rebar/rebar/pull/269) # Rebar 2.2.0 ## PR's Merged -* rebar/137: [Filter documented behaviour callbacks](https://github.com/basho/rebar/pull/137) -* rebar/142: [Fix rebar_file_utils module on Windows with MSYS](https://github.com/basho/rebar/pull/142) -* rebar/152: [Allow users to configure skip_deps for specific commands](https://github.com/basho/rebar/pull/152) -* rebar/154: [Stop applications nicely before killing extra processes](https://github.com/basho/rebar/pull/154) -* rebar/155: [Fix rebar_utils:expand_env_variable/3](https://github.com/basho/rebar/pull/155) -* rebar/157: [add native Windows compiler support](https://github.com/basho/rebar/pull/157) -* rebar/172: [Allow reltool target_dir to be constructed on the fly](https://github.com/basho/rebar/pull/172) -* rebar/173: [rebar should expand VCS version in the top directory, if possible](https://github.com/basho/rebar/pull/173) -* rebar/174: [Fixed handle_call response in simplesrv.erl](https://github.com/basho/rebar/pull/174) -* rebar/177: [Cache vsn information during the run to avoid extra unnecessary shell calls](https://github.com/basho/rebar/pull/177) -* rebar/179: [Add ebin to the path before compiling erlydtl templates](https://github.com/basho/rebar/pull/179) -* rebar/183: [Fix compiling DTL templates with latest erlydtl](https://github.com/basho/rebar/pull/183) -* rebar/184: [Fix for destruction of config app vars on reset](https://github.com/basho/rebar/pull/184) -* rebar/185: [simple enhance and simple bugfix](https://github.com/basho/rebar/pull/185) -* rebar/187: [fix for cp_r_win32 where copying a directory to a non-existant directory would crash](https://github.com/basho/rebar/pull/187) -* rebar/189: [Fix typos in generated cmd script in bootstrap](https://github.com/basho/rebar/pull/189) -* rebar/190: [Windows xcopy dir to non-existant dir (re-request)](https://github.com/basho/rebar/pull/190) -* rebar/191: [Fix typos in rebar_templater](https://github.com/basho/rebar/pull/191) -* rebar/196: [Escape '|' in the Windows runner usage string](https://github.com/basho/rebar/pull/196) -* rebar/198: [New feature to rebar_xref to allow execution of custom queries.](https://github.com/basho/rebar/pull/198) -* rebar/199: [Added new feature to rebar xref to allow execution of custom queries.](https://github.com/basho/rebar/pull/199) -* rebar/200: [Enable runner to pass more than one argument to start](https://github.com/basho/rebar/pull/200) -* rebar/201: [include simplemodule.app.src in simplemod template](https://github.com/basho/rebar/pull/201) -* rebar/205: [Ports in languages other than C](https://github.com/basho/rebar/issues/205) -* rebar/210: [use file:script if a .config.script file present](https://github.com/basho/rebar/pull/210) -* rebar/212: [ Modified simplenode.runner to start from alternative directory](https://github.com/basho/rebar/pull/212) -* rebar/214: [Foreground running doesn't allow console attaching](https://github.com/basho/rebar/issues/214) -* rebar/215: [Add support for http proxy_friendly_github_urls](https://github.com/basho/rebar/pull/215) -* rebar/388: [Less than useful rebar error message when error in .hrl files](https://github.com/basho/rebar/issues/388) +* rebar/152: [Fix erl_opts use](https://github.com/rebar/rebar/pull/152) +* rebar/154: [Fix update-deps with certain forms of the {tag, ...} type](https://github.com/rebar/rebar/pull/154) +* rebar/155: [Fixes for #137 and #142](https://github.com/rebar/rebar/pull/155) +* rebar/157: [Don't over-aggressively clean the code path in the presence of lib_dir directives](https://github.com/rebar/rebar/pull/157) +* rebar/172: [Add missing dep examples and fix existing ones](https://github.com/rebar/rebar/pull/172) +* rebar/173: [Fix false reporting of (plain) vsn strings](https://github.com/rebar/rebar/pull/173) +* rebar/174: [rebar_core: fix Dialyzer warning introduced in aa46d85 (#157)](https://github.com/rebar/rebar/pull/174) +* rebar/177: [Delete unused inttest/retest binary](https://github.com/rebar/rebar/pull/177) +* rebar/179: [Make list of commands (for unabbreviation) easier to maintain](https://github.com/rebar/rebar/pull/179) +* rebar/183: [generate-upgrade can now take target_dir argument](https://github.com/rebar/rebar/pull/183) +* rebar/184: [Fix log levels](https://github.com/rebar/rebar/pull/184) +* rebar/185: [Switch retest dep to upstream (dizzyd/retest.git)](https://github.com/rebar/rebar/pull/185) +* rebar/189: [inttest/rgen1: increase retest timeout (30s -> 60s)](https://github.com/rebar/rebar/pull/189) +* rebar/190: [inttest/rgen_1: double the timeout a second time](https://github.com/rebar/rebar/pull/190) +* rebar/191: [Fix #187 (rename getopt and mustache)](https://github.com/rebar/rebar/pull/191) +* rebar/196: [Print a more appropriate message on 'rebar info'](https://github.com/rebar/rebar/pull/196) +* rebar/198: [Clean up rebar.config.script](https://github.com/rebar/rebar/pull/198) +* rebar/199: [rebar_dia_compiler: fix Dialyzer warnings](https://github.com/rebar/rebar/pull/199) +* rebar/200: [bootstrap: avoid trying to run 'debug' command](https://github.com/rebar/rebar/pull/200) +* rebar/201: [Added a library template.](https://github.com/rebar/rebar/pull/201) +* rebar/210: [Fix #205 (erlydtl:compile/3 returns warnings)](https://github.com/rebar/rebar/pull/210) +* rebar/212: [Fix basho/rebar#388](https://github.com/rebar/rebar/pull/212) +* rebar/214: [Document compile_only=true](https://github.com/rebar/rebar/pull/214) +* rebar/215: [Remove experimental flags](https://github.com/rebar/rebar/pull/215) diff --git a/ebin/rebar.app b/ebin/rebar.app index 5d53718..29ad8cf 100644 --- a/ebin/rebar.app +++ b/ebin/rebar.app @@ -3,7 +3,7 @@ {application, rebar, [{description, "Rebar: Erlang Build Tool"}, - {vsn, "2.3.0"}, + {vsn, "2.3.1"}, {modules, [ rebar, rebar_abnfc_compiler, rebar_app_utils, diff --git a/priv/templates/simplenode.install_upgrade.escript b/priv/templates/simplenode.install_upgrade.escript index 56cea19..0d4cbe3 100644..100755 --- a/priv/templates/simplenode.install_upgrade.escript +++ b/priv/templates/simplenode.install_upgrade.escript @@ -6,6 +6,14 @@ -define(TIMEOUT, 60000). -define(INFO(Fmt,Args), io:format(Fmt,Args)). +%% TODO: This script currently does NOT support slim releases. +%% Necessary steps to upgrade a slim release are as follows: +%% 1. unpack relup archive manually +%% 2. copy releases directory and necessary libraries +%% 3. using release_hander:set_unpacked/2 . +%% For more details, see https://github.com/rebar/rebar/pull/52 +%% and https://github.com/rebar/rebar/issues/202 + main([NodeName, Cookie, ReleasePackage]) -> TargetNode = start_distribution(NodeName, Cookie), {ok, Vsn} = rpc:call(TargetNode, release_handler, unpack_release, diff --git a/priv/templates/simplenode.reltool.config b/priv/templates/simplenode.reltool.config index bac7270..eae8ab3 100644 --- a/priv/templates/simplenode.reltool.config +++ b/priv/templates/simplenode.reltool.config @@ -32,7 +32,7 @@ {overlay, [ {mkdir, "log/sasl"}, {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"}, - {copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"}, + {copy, "files/nodetool", "releases/\{\{rel_vsn\}\}/nodetool"}, {copy, "{{nodeid}}/bin/start_clean.boot", "\{\{erts_vsn\}\}/bin/start_clean.boot"}, {copy, "files/{{nodeid}}", "bin/{{nodeid}}"}, diff --git a/priv/templates/simplenode.runner b/priv/templates/simplenode.runner index 032eb28..595a1ea 100755 --- a/priv/templates/simplenode.runner +++ b/priv/templates/simplenode.runner @@ -130,11 +130,43 @@ cd $USE_DIR # Make sure log directory exists mkdir -p $USE_DIR/log -# Add ERTS bin dir to our path -ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin +RUNNER_SCRIPT_DATA= +if [ -e "$RUNNER_BASE_DIR/releases/$APP_VSN/runner_script.data" ]; then + RUNNER_SCRIPT_DATA=`cat $RUNNER_BASE_DIR/releases/$APP_VSN/runner_script.data` +fi -# Setup command to control the node -NODETOOL="$ERTS_PATH/escript $ERTS_PATH/nodetool $NAME_ARG $COOKIE_ARG" +if [ -z "$RUNNER_SCRIPT_DATA" ]; then + ROOTDIR=$RUNNER_BASE_DIR + ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin + if [ -e "$RUNNER_BASE_DIR/releases/$APP_VSN/nodetool" ]; then + NODETOOL="$ERTS_PATH/escript $RUNNER_BASE_DIR/releases/$APP_VSN/nodetool $NAME_ARG $COOKIE_ARG" + else + NODETOOL="$ERTS_PATH/escript $ERTS_PATH/nodetool $NAME_ARG $COOKIE_ARG" + fi + SLIM_ARGS= +elif [ "$RUNNER_SCRIPT_DATA" = "slim" ]; then + # Setup system paths + SYSTEM_ERL_PATH=`which erl` + if [ ! -x "$SYSTEM_ERL_PATH" ]; then + echo "Failed to find erl. Is Erlang/OTP available in PATH?" + exit 1 + fi + SYSTEM_HOME_BIN=${SYSTEM_ERL_PATH%/*} + ROOTDIR=$SYSTEM_HOME_BIN/../lib/erlang + ERTS_PATH=$ROOTDIR/erts-$ERTS_VSN/bin + unset SYSTEM_ERL_PATH + unset SYSTEM_HOME_BIN + + LOCAL_ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin + NODETOOL="$ERTS_PATH/escript $RUNNER_BASE_DIR/releases/$APP_VSN/nodetool $NAME_ARG $COOKIE_ARG" + unset LOCAL_ERL_PATH + + # Setup additional arguments for slim release + SLIM_ARGS="-boot_var RELTOOL_EXT_LIB $RUNNER_BASE_DIR/lib -sasl releases_dir \"$RUNNER_BASE_DIR/releases\"" +else + echo "Unknown runner_script.data" + exit 1 +fi # Setup remote shell command to control node REMSH="$ERTS_PATH/erl -hidden $REMSH_NAME_ARG $REMSH_REMSH_ARG $COOKIE_ARG" @@ -310,11 +342,10 @@ case "$1" in ;; esac # Setup beam-required vars - ROOTDIR=$RUNNER_BASE_DIR 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" + CMD="$BINDIR/erlexec $SLIM_ARGS -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -mode embedded -config $CONFIG_PATH -args_file $VMARGS_PATH" export EMU export ROOTDIR export BINDIR @@ -339,11 +370,10 @@ case "$1" in 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" + CMD="$BINDIR/erlexec $SLIM_ARGS $FOREGROUNDOPTIONS -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -config $CONFIG_PATH -args_file $VMARGS_PATH" export EMU export ROOTDIR export BINDIR diff --git a/src/rebar_rel_utils.erl b/src/rebar_rel_utils.erl index 085dbd9..5d99948 100644 --- a/src/rebar_rel_utils.erl +++ b/src/rebar_rel_utils.erl @@ -37,6 +37,7 @@ get_rel_file_path/2, load_config/2, get_sys_tuple/1, + get_excl_lib_tuple/1, get_target_dir/2, get_root_dir/2, get_target_parent_dir/2]). @@ -144,6 +145,13 @@ get_sys_tuple(ReltoolConfig) -> end. %% +%% Look for the {excl_lib, ...} tuple in sys tuple of the reltool.config file. +%% Without this present, return false. +%% +get_excl_lib_tuple(ReltoolConfig) -> + lists:keyfind(excl_lib, 1, element(2, get_sys_tuple(ReltoolConfig))). + +%% %% Look for {target_dir, TargetDir} in the reltool config file; if none is %% found, use the name of the release as the default target directory. %% diff --git a/src/rebar_reltool.erl b/src/rebar_reltool.erl index 9f9488e..fdaa7e0 100644 --- a/src/rebar_reltool.erl +++ b/src/rebar_reltool.erl @@ -147,15 +147,12 @@ process_overlay(Config, ReltoolConfig) -> OverlayVars1), %% Finally, overlay the files specified by the overlay section - case lists:keyfind(overlay, 1, ReltoolConfig) of - {overlay, Overlay} when is_list(Overlay) -> + case overlay_files(ReltoolConfig) of + [] -> + ok; + Overlay -> execute_overlay(Overlay, OverlayVars, rebar_utils:get_cwd(), - TargetDir); - false -> - ?INFO("No {overlay, [...]} found in reltool.config.\n", []); - _ -> - ?ABORT("{overlay, [...]} entry in reltool.config " - "must be a list.\n", []) + TargetDir) end. %% @@ -292,6 +289,26 @@ dump_spec(Config, Spec) -> end. +overlay_files(ReltoolConfig) -> + Original = case lists:keyfind(overlay, 1, ReltoolConfig) of + {overlay, Overlay} when is_list(Overlay) -> + Overlay; + false -> + ?INFO("No {overlay, [...]} found in reltool.config.\n", []), + []; + _ -> + ?ABORT("{overlay, [...]} entry in reltool.config " + "must be a list.\n", []) + end, + SlimAddition = case rebar_rel_utils:get_excl_lib_tuple(ReltoolConfig) of + {excl_lib, otp_root} -> + [{create, "releases/{{rel_vsn}}/runner_script.data", + "slim\n"}]; + false -> + [] + end, + Original ++ SlimAddition. + %% TODO: Merge functionality here with rebar_templater execute_overlay([], _Vars, _BaseDir, _TargetDir) -> |