From 700e7ee884e3ae19a43a05e8a24f90ab703e6890 Mon Sep 17 00:00:00 2001 From: Juan Jose Comellas Date: Fri, 13 Jan 2012 10:17:34 -0300 Subject: Avoid creating an undefined start_phases entry when generating a release When a release is generated and the applications in the release do not define a value for the start_phases entry of their .app files, reltool will generate the following entry in the .app files of the release: {start_phases, undefined} If this happens, when trying to create a release upgrade systools will fail because it doesn't allow the start_phases entry to be set to undefined. This patch avoids this situation by not generating a start_phases entry when it is set to undefined. --- lib/reltool/src/reltool_target.erl | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/reltool/src/reltool_target.erl b/lib/reltool/src/reltool_target.erl index 0fcf89a360..648978bd01 100644 --- a/lib/reltool/src/reltool_target.erl +++ b/lib/reltool/src/reltool_target.erl @@ -247,10 +247,15 @@ gen_app(#app{name = Name, env = Env, mod = StartMod, start_phases = StartPhases}}) -> - StartMod2 = - case StartMod =:= undefined of - true -> []; - false -> [{mod, StartMod}] + StartPhases2 = + case StartPhases of + undefined -> []; + _ -> [{start_phases, StartPhases}] + end, + Tail = + case StartMod of + undefined -> StartPhases2; + _ -> [{mod, StartMod} | StartPhases2] end, {application, Name, [{description, Desc}, @@ -261,10 +266,9 @@ gen_app(#app{name = Name, {applications, ReqApps}, {included_applications, InclApps}, {env, Env}, - {start_phases, StartPhases}, {maxT, MaxT}, {maxP, MaxP} | - StartMod2]}. + Tail]}. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Generate the contents of a rel file -- cgit v1.2.3 From 5e575f65629f6d99ed423bc646219c162f6bfa1a Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Tue, 20 Mar 2012 14:38:50 +0100 Subject: Avoid undefined start_phases entry in .script Inorder to align with reltool a {start_phases,undefined} entry in will no longer occur in the application specification in .script files. The start_phases entry will only exist if it contains real start phases. Also, the default value for #application.start_phases is no longer set to [] in systools.hrl. This value was actually never used, since it was always explicitly set in systools_make:parse_applications - by default to 'undefined', so the default value in the record definition was only a confusing detail. Anyway - now corrected. --- lib/sasl/src/systools.hrl | 5 +++-- lib/sasl/src/systools_make.erl | 17 ++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/sasl/src/systools.hrl b/lib/sasl/src/systools.hrl index 9a3e98221c..da531dbee5 100644 --- a/lib/sasl/src/systools.hrl +++ b/lib/sasl/src/systools.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2012. 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 @@ -60,7 +60,8 @@ %% integer() | infinity. mod = [], %% [] | {Mod, StartArgs}, Mod= atom(), %% StartArgs = list(). - start_phases = [], %% [] | {Phase, PhaseArgs}, Phase = atom(), + start_phases, %% [{Phase, PhaseArgs}] | undefined, + %% Phase = atom(), %% PhaseArgs = list(). dir = "" %% The directory where the .app file was %% found (internal use). diff --git a/lib/sasl/src/systools_make.erl b/lib/sasl/src/systools_make.erl index 12ba2a5476..a2ea9a8d7e 100644 --- a/lib/sasl/src/systools_make.erl +++ b/lib/sasl/src/systools_make.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2011. All Rights Reserved. +%% Copyright Ericsson AB 1996-2012. 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 @@ -1456,15 +1456,18 @@ pack_app(#application{name=Name,vsn=V,id=Id,description=D,modules=M, {applications, App}, {included_applications, Incs}, {env, Env}, - {start_phases, SF}, {maxT, MaxT}, {maxP, MaxP} | - behave(Mod)]}. - + behave([{start_phases,SF},{mod,Mod}])]}. + +behave([{mod,[]}|T]) -> + behave(T); +behave([{start_phases,undefined}|T]) -> + behave(T); +behave([H|T]) -> + [H|behave(T)]; behave([]) -> - []; -behave(Mod) -> - [{mod, Mod}]. + []. %%______________________________________________________________________ %% mandatory modules; this modules must be loaded before processes -- cgit v1.2.3 From 973bc0094be5580055853d9ed0e40be2cc89970a Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Tue, 20 Mar 2012 15:03:36 +0100 Subject: Document correct default value for 'mod' parameter in .app The default value for the 'mod' parameter in .app files was incorrectly documented to be 'undefined'. It is now corrected to []. --- lib/kernel/doc/src/app.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/kernel/doc/src/app.xml b/lib/kernel/doc/src/app.xml index ff8a12fe97..1914844b37 100644 --- a/lib/kernel/doc/src/app.xml +++ b/lib/kernel/doc/src/app.xml @@ -4,7 +4,7 @@
- 19972011 + 19972012 Ericsson AB. All Rights Reserved. @@ -75,7 +75,7 @@ MaxT int() infinity Names [Name] [] Apps [App] [] Env [{Par,Val}] [] -Start {Module,StartArgs} undefined +Start {Module,StartArgs} [] Phases [{Phase,PhaseArgs}] undefined Module = Name = App = Par = Phase = atom() Val = StartArgs = PhaseArgs = term() -- cgit v1.2.3 From b773b65d724d31b87e0e1fb2f8e8c07aaae274f7 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Tue, 20 Mar 2012 15:25:14 +0100 Subject: Add documentation of regular expressions for version numbers in appup --- lib/sasl/doc/src/appup.xml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/sasl/doc/src/appup.xml b/lib/sasl/doc/src/appup.xml index 770b7c2492..bacfaa76ef 100644 --- a/lib/sasl/doc/src/appup.xml +++ b/lib/sasl/doc/src/appup.xml @@ -4,7 +4,7 @@
- 19972011 + 19972012 Ericsson AB. All Rights Reserved. @@ -56,12 +56,20 @@ the application.

-

UpFromVsn = string() is an earlier version of - the application to upgrade from.

+

UpFromVsn = string() | binary() is an earlier + version of the application to upgrade from. If it is a + string, it will be interpreted as a specific version + number. If it is a binary, it will be interpreted as a + regular expression which can match multiple version + numbers.

-

DownToVsn = string() is an earlier version of - the application to downgrade to.

+

DownToVsn = string() | binary() is an earlier + version of the application to downgrade to. If it is a + string, it will be interpreted as a specific version + number. If it is a binary, it will be interpreted as a + regular expression which can match multiple version + numbers.

Instructions is a list of release upgrade instructions, see below. It is recommended to use @@ -70,6 +78,12 @@ creating the relup file.

+

In order to avoid duplication of upgrade instructions it is + allowed to use regular expressions to specify the UpFromVsn + and DownToVsn. To be considered a regular expression, the + version identifier must be specified as a binary, e.g.

+ <<"2\\.1\\.[0-9]+">> +

will match all versions 2.1.x, where x is any number.

-- cgit v1.2.3 From f4a9831c176b3d477077a4e508e24777b2bf0342 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Tue, 20 Mar 2012 15:51:54 +0100 Subject: Fix error message if stdlib has faulty start type in .rel file If stdlib had a different start type than permanent, systools_make would fail but it would say that it was sasl that had faulty start type. This has been corrected. --- lib/sasl/src/systools_make.erl | 4 ++-- lib/sasl/test/systools_SUITE.erl | 26 ++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/sasl/src/systools_make.erl b/lib/sasl/src/systools_make.erl index 12ba2a5476..aca4ac0bba 100644 --- a/lib/sasl/src/systools_make.erl +++ b/lib/sasl/src/systools_make.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2011. All Rights Reserved. +%% Copyright Ericsson AB 1996-2012. 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 @@ -482,7 +482,7 @@ mandatory_applications([_|Apps],Kernel,Stdlib,Sasl) -> mandatory_applications([],Type,_,_) when Type=/=permanent -> error_mandatory_application(kernel,Type); mandatory_applications([],_,Type,_) when Type=/=permanent -> - error_mandatory_application(sasl,Type); + error_mandatory_application(stdlib,Type); mandatory_applications([],_,_,undefined) -> {ok, [{warning,missing_sasl}]}; mandatory_applications([],_,_,_) -> diff --git a/lib/sasl/test/systools_SUITE.erl b/lib/sasl/test/systools_SUITE.erl index 4cf7364d74..c0e51d39e3 100644 --- a/lib/sasl/test/systools_SUITE.erl +++ b/lib/sasl/test/systools_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2011. All Rights Reserved. +%% Copyright Ericsson AB 2012. 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 @@ -500,6 +500,22 @@ crazy_script(Config) when is_list(Config) -> {error, _, {mandatory_app,kernel,load}} = systools:make_script(LatestName3, [silent,{path,P}]), + %% Run with .rel file with non-permanent stdlib + {LatestDir4, LatestName4} = create_script(latest_stdlib_start_type, Config), + ok = file:set_cwd(LatestDir4), + + error = systools:make_script(LatestName4), + {error, _, {mandatory_app,stdlib,load}} = + systools:make_script(LatestName4, [silent,{path,P}]), + + %% Run with .rel file lacking stdlib + {LatestDir5, LatestName5} = create_script(latest_no_stdlib, Config), + ok = file:set_cwd(LatestDir5), + + error = systools:make_script(LatestName5), + {error, _, {missing_mandatory_app,stdlib}} = + systools:make_script(LatestName5, [silent,{path,P}]), + ok = file:set_cwd(OldDir), ok. @@ -2026,8 +2042,14 @@ create_script(latest_nokernel,Config) -> Apps = [{db,"2.1"},{fe,"3.1"}], do_create_script(latest_nokernel,Config,"4.4",Apps); create_script(latest_kernel_start_type,Config) -> - Apps = [{kernel,"1.0",load},{db,"2.1"},{fe,"3.1"}], + Apps = [{kernel,"1.0",load},{stdlib,"1.0"},{db,"2.1"},{fe,"3.1"}], do_create_script(latest_kernel_start_type,Config,"4.4",Apps); +create_script(latest_stdlib_start_type,Config) -> + Apps = [{kernel,"1.0"},{stdlib,"1.0",load},{db,"2.1"},{fe,"3.1"}], + do_create_script(latest_stdlib_start_type,Config,"4.4",Apps); +create_script(latest_no_stdlib,Config) -> + Apps = [{kernel,"1.0"},{db,"2.1"},{fe,"3.1"}], + do_create_script(latest_no_stdlib,Config,"4.4",Apps); create_script(latest_app_start_type1,Config) -> Apps = core_apps(current), do_create_script(latest_app_start_type1,Config,current,Apps); -- cgit v1.2.3