diff options
author | Eric <[email protected]> | 2012-12-28 11:47:35 -0500 |
---|---|---|
committer | Eric <[email protected]> | 2012-12-28 11:47:35 -0500 |
commit | ae2e47e811ef113c0e6ab1df2bb66a4917f7ea07 (patch) | |
tree | e2bf405b7fcc8b3d54bcfb27abb0b5809ee0c7eb | |
parent | b5b6cf855b3bceaac76ccd330d64cfeb2b1f4c14 (diff) | |
download | relx-ae2e47e811ef113c0e6ab1df2bb66a4917f7ea07.tar.gz relx-ae2e47e811ef113c0e6ab1df2bb66a4917f7ea07.tar.bz2 relx-ae2e47e811ef113c0e6ab1df2bb66a4917f7ea07.zip |
support the ability to *not* autogenerate start scripts
-rw-r--r-- | src/rcl_prv_assembler.erl | 17 | ||||
-rw-r--r-- | test/rclt_release_SUITE.erl | 47 |
2 files changed, 56 insertions, 8 deletions
diff --git a/src/rcl_prv_assembler.erl b/src/rcl_prv_assembler.erl index a721b12..61f6dad 100644 --- a/src/rcl_prv_assembler.erl +++ b/src/rcl_prv_assembler.erl @@ -210,11 +210,18 @@ write_bin_file(State, Release, OutputDir, RelDir) -> ErlOpts = rcl_state:get(State, erl_opts, ""), StartFile = bin_file_contents(RelName, RelVsn, rcl_release:erts(Release), - ErlOpts), - ok = file:write_file(VsnRel, StartFile), - ok = file:change_mode(VsnRel, 8#777), - ok = file:write_file(BareRel, StartFile), - ok = file:change_mode(BareRel, 8#777), + ErlOpts), + %% We generate the start script by default, unless the user + %% tells us not too + case rcl_state:get(State, generate_start_script, true) of + false -> + ok; + _ -> + ok = file:write_file(VsnRel, StartFile), + ok = file:change_mode(VsnRel, 8#777), + ok = file:write_file(BareRel, StartFile), + ok = file:change_mode(BareRel, 8#777) + end, copy_or_generate_sys_config_file(State, Release, OutputDir, RelDir). %% @doc copy config/sys.config or generate one to releases/VSN/sys.config diff --git a/test/rclt_release_SUITE.erl b/test/rclt_release_SUITE.erl index 06644ee..848c129 100644 --- a/test/rclt_release_SUITE.erl +++ b/test/rclt_release_SUITE.erl @@ -25,6 +25,7 @@ init_per_testcase/2, all/0, make_release/1, + make_scriptless_release/1, make_overridden_release/1, make_rerun_overridden_release/1, make_implicit_config_release/1, @@ -52,8 +53,9 @@ init_per_testcase(_, Config) -> {state, State} | Config]. all() -> - [make_release, make_overridden_release, make_implicit_config_release, - make_rerun_overridden_release, overlay_release]. + [make_release, make_scriptless_release, make_overridden_release, + make_implicit_config_release, make_rerun_overridden_release, + overlay_release]. make_release(Config) -> LibDir1 = proplists:get_value(lib1, Config), @@ -90,6 +92,46 @@ make_release(Config) -> ?assert(lists:member({goal_app_2, "0.0.1"}, AppSpecs)), ?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)). +make_scriptless_release(Config) -> + LibDir1 = proplists:get_value(lib1, Config), + [(fun({Name, Vsn}) -> + create_app(LibDir1, Name, Vsn, [kernel, stdlib], []) + end)(App) + || + App <- + [{create_random_name("lib_app1_"), create_random_vsn()} + || _ <- lists:seq(1, 100)]], + + create_app(LibDir1, "goal_app_1", "0.0.1", [stdlib,kernel,non_goal_1], []), + create_app(LibDir1, "lib_dep_1", "0.0.1", [stdlib,kernel], []), + create_app(LibDir1, "goal_app_2", "0.0.1", [stdlib,kernel,goal_app_1,non_goal_2], []), + create_app(LibDir1, "non_goal_1", "0.0.1", [stdlib,kernel], [lib_dep_1]), + create_app(LibDir1, "non_goal_2", "0.0.1", [stdlib,kernel], []), + + ConfigFile = filename:join([LibDir1, "relcool.config"]), + write_config(ConfigFile, + [{generate_start_script, false}, + {release, {foo, "0.0.1"}, + [goal_app_1, + goal_app_2]}]), + OutputDir = filename:join([proplists:get_value(data_dir, Config), + create_random_name("relcool-output")]), + {ok, State} = relcool:do(undefined, undefined, [], [LibDir1], 2, + OutputDir, [ConfigFile]), + + ?assert(not ec_file:exists(filename:join([OutputDir, "bin", "foo"]))), + ?assert(not ec_file:exists(filename:join([OutputDir, "bin", "foo-0.0.1"]))), + + [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rcl_state:releases(State)), + AppSpecs = rcl_release:applications(Release), + ?assert(lists:keymember(stdlib, 1, AppSpecs)), + ?assert(lists:keymember(kernel, 1, AppSpecs)), + ?assert(lists:member({non_goal_1, "0.0.1"}, AppSpecs)), + ?assert(lists:member({non_goal_2, "0.0.1"}, AppSpecs)), + ?assert(lists:member({goal_app_1, "0.0.1"}, AppSpecs)), + ?assert(lists:member({goal_app_2, "0.0.1"}, AppSpecs)), + ?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)). + make_overridden_release(Config) -> DataDir = proplists:get_value(data_dir, Config), @@ -171,7 +213,6 @@ make_implicit_config_release(Config) -> OutputDir, []), [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rcl_state:releases(State)), ?assert(ec_file:exists(OutputDir)), - AppSpecs = rcl_release:applications(Release), ?assert(lists:keymember(stdlib, 1, AppSpecs)), ?assert(lists:keymember(kernel, 1, AppSpecs)), |