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(-) 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(-) 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