From bc966c32bfb52467f4fd527995c110c0a980527c Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Tue, 1 Oct 2013 14:16:21 +0200 Subject: sasl: Add no_dot_erlang start script Sometimes it is wanted to start erlang without loading the user dependent .erlang file, for example in scripts and configure tests. --- erts/Makefile.in | 3 ++- erts/etc/unix/Install.src | 2 +- erts/etc/win32/Install.c | 2 +- erts/start_scripts/Makefile | 33 +++++++++++++++++++++++++++++--- erts/start_scripts/no_dot_erlang.rel.src | 21 ++++++++++++++++++++ lib/sasl/src/systools_make.erl | 18 +++++++++++------ 6 files changed, 67 insertions(+), 12 deletions(-) create mode 100644 erts/start_scripts/no_dot_erlang.rel.src diff --git a/erts/Makefile.in b/erts/Makefile.in index 92fdc7a862..e3db37d3fd 100644 --- a/erts/Makefile.in +++ b/erts/Makefile.in @@ -107,7 +107,8 @@ local_setup: fi @cd start_scripts && $(MAKE) $(ERL_TOP)/bin/start.script \ $(ERL_TOP)/bin/start_sasl.script \ - $(ERL_TOP)/bin/start_clean.script + $(ERL_TOP)/bin/start_clean.script \ + $(ERL_TOP)/bin/no_dot_erlang.script # Run the configure script .PHONY: configure diff --git a/erts/etc/unix/Install.src b/erts/etc/unix/Install.src index 0f33258a28..8eb1db75bd 100644 --- a/erts/etc/unix/Install.src +++ b/erts/etc/unix/Install.src @@ -137,9 +137,9 @@ case $start_option in esac cp -p ../releases/%I_SYSTEM_VSN%/start_*.boot . +cp -p ../releases/%I_SYSTEM_VSN%/no_dot_erlang.boot . cp -p $Name.boot start.boot cp -p ../releases/%I_SYSTEM_VSN%/$Name.script start.script - # # Fixing the man pages # diff --git a/erts/etc/win32/Install.c b/erts/etc/win32/Install.c index dd02a9c111..c46bb89f7c 100644 --- a/erts/etc/win32/Install.c +++ b/erts/etc/win32/Install.c @@ -47,7 +47,7 @@ int main(int argc, char **argv) char *binaries[] = { "erl.exe", "werl.exe", "erlc.exe", "dialyzer.exe", "typer.exe", "escript.exe", "ct_run.exe", NULL }; - char *scripts[] = { "start_clean.boot", "start_sasl.boot", NULL }; + char *scripts[] = { "start_clean.boot", "start_sasl.boot", "no_dot_erlang.boot", NULL }; char fromname[MAX_PATH]; char toname[MAX_PATH]; diff --git a/erts/start_scripts/Makefile b/erts/start_scripts/Makefile index 3bf233cbb6..32e65a227f 100644 --- a/erts/start_scripts/Makefile +++ b/erts/start_scripts/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 1997-2012. All Rights Reserved. +# Copyright Ericsson AB 1997-2013. All Rights Reserved. # # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in @@ -34,12 +34,16 @@ INSTALL_SCRIPTS = \ $(SS_ROOT)/start_clean.script \ $(SS_ROOT)/start_clean.boot \ $(SS_ROOT)/start_sasl.boot \ - $(SS_ROOT)/start_sasl.script + $(SS_ROOT)/start_sasl.script \ + $(SS_ROOT)/no_dot_erlang.boot \ + $(SS_ROOT)/no_dot_erlang.script + REL_SCRIPTS = \ $(SS_ROOT)/start_clean.rel \ $(SS_ROOT)/start_sasl.rel \ - $(SS_ROOT)/start_all_example.rel + $(SS_ROOT)/start_all_example.rel \ + $(SS_ROOT)/no_dot_erlang.rel \ ifneq ($(findstring win32,$(TARGET)),win32) RELEASES_SRC = RELEASES.src @@ -82,6 +86,13 @@ $(SS_ROOT)/start_sasl.boot: $(SS_ROOT)/start_sasl.rel $(V_at)( cd $(SS_TMP) && \ $(ERLC) $(SASL_FLAGS) $(SCRIPT_PATH) -o $(SS_ROOT) $< ) +$(SS_ROOT)/no_dot_erlang.script \ +$(SS_ROOT)/no_dot_erlang.boot: $(SS_ROOT)/no_dot_erlang.rel + $(gen_verbose)$(INSTALL_DIR) $(SS_TMP) + $(V_at)( cd $(SS_TMP) && \ + $(ERLC) $(SASL_FLAGS) $(SCRIPT_PATH) +no_warn_sasl +no_dot_erlang -o $(SS_ROOT) $< ) + + $(SS_ROOT)/start_clean.rel: $(SS_ROOT)/start_clean.rel.src \ ../vsn.mk \ $(LIBPATH)/kernel/vsn.mk \ @@ -104,6 +115,16 @@ $(SS_ROOT)/start_sasl.rel: $(SS_ROOT)/start_sasl.rel.src \ -e 's;%SASL_VSN%;$(SASL_VSN);' \ $(SS_ROOT)/start_sasl.rel.src > $(SS_ROOT)/start_sasl.rel +$(SS_ROOT)/no_dot_erlang.rel: $(SS_ROOT)/no_dot_erlang.rel.src \ + ../vsn.mk \ + $(LIBPATH)/kernel/vsn.mk \ + $(LIBPATH)/stdlib/vsn.mk + $(gen_verbose)sed -e 's;%SYS_VSN%;$(SYSTEM_VSN);' \ + -e 's;%ERTS_VSN%;$(VSN);' \ + -e 's;%KERNEL_VSN%;$(KERNEL_VSN);' \ + -e 's;%STDLIB_VSN%;$(STDLIB_VSN);' \ + $(SS_ROOT)/no_dot_erlang.rel.src > $(SS_ROOT)/no_dot_erlang.rel + $(SS_ROOT)/start_all_example.rel: $(SS_ROOT)/start_all_example.rel.src \ ../vsn.mk \ $(LIBPATH)/kernel/vsn.mk \ @@ -140,7 +161,13 @@ $(ERL_TOP)/bin/start_clean.script: $(V_at)( cd $(SS_TMP) && \ $(ERLC) $(SCRIPT_PATH) +no_warn_sasl +otp_build -o $@ $(SS_ROOT)/start_clean.rel ) +$(ERL_TOP)/bin/no_dot_erlang.script: + $(gen_verbose)$(INSTALL_DIR) $(SS_TMP) + $(V_at)( cd $(SS_TMP) && \ + $(ERLC) $(SCRIPT_PATH) +no_warn_sasl +otp_build +no_dot_erlang -o $@ $(SS_ROOT)/no_dot_erlang.rel ) + ## Special target used from system/build/Makefile for source code release bootstrap. +## Add no_dot_erlang after next release bootstrap_scripts: $(SS_ROOT)/start_clean.rel $(V_at)$(INSTALL_DIR) $(TESTROOT)/bin $(V_at)$(INSTALL_DIR) $(SS_TMP) diff --git a/erts/start_scripts/no_dot_erlang.rel.src b/erts/start_scripts/no_dot_erlang.rel.src new file mode 100644 index 0000000000..03b64ebf1a --- /dev/null +++ b/erts/start_scripts/no_dot_erlang.rel.src @@ -0,0 +1,21 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2013. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +{release, {"OTP APN 181 01","%SYS_VSN%"}, {erts, "%ERTS_VSN%"}, + [{kernel,"%KERNEL_VSN%"}, + {stdlib,"%STDLIB_VSN%"}]}. diff --git a/lib/sasl/src/systools_make.erl b/lib/sasl/src/systools_make.erl index b2e95fdbee..bab88552f9 100644 --- a/lib/sasl/src/systools_make.erl +++ b/lib/sasl/src/systools_make.erl @@ -1135,10 +1135,10 @@ generate_script(Output, Release, Appls, Flags) -> load_appl_mods(Appls, Mandatory ++ Preloaded, PathFlag, Variables) ++ [{path, create_path(Appls, PathFlag, Variables)}] ++ - create_kernel_procs(Appls) ++ - create_load_appls(Appls) ++ - create_start_appls(Appls) ++ - script_end() + create_kernel_procs(Appls) ++ + create_load_appls(Appls) ++ + create_start_appls(Appls) ++ + script_end(lists:member(no_dot_erlang, Flags)) }, ScriptFile = Output ++ ".script", @@ -1229,9 +1229,12 @@ create_load_appls([]) -> %%______________________________________________________________________ %% The final part of the script. -script_end() -> +script_end(false) -> %% Do not skip loading of $HOME/.erlang [{apply, {c, erlangrc, []}}, - {progress, started}]. + {progress, started}]; +script_end(true) -> %% Ignore loading of $HOME/.erlang + [{progress, started}]. + %%----------------------------------------------------------------- %% Function: sort_appls(Appls) -> {ok, Appls'} | throw({error, Error}) @@ -2055,6 +2058,9 @@ cas([no_warn_sasl | Args], X) -> %%% no_module_tests (kept for backwards compatibility, but ignored) ---- cas([no_module_tests | Args], X) -> cas(Args, X); +cas([no_dot_erlang | Args], X) -> + cas(Args, X); + %%% ERROR -------------------------------------------------------------- cas([Y | Args], X) -> cas(Args, X++[Y]). -- cgit v1.2.3