chore(update_appup): do not force appup render if contents are the same
To avoid losing comments and/or manual indentation in appup files that are already up to date, we now check whether the contents have the exact same terms as those we are about to write to an existint .appup file.
This commit is contained in:
parent
e1e72c144a
commit
42ca5ab5a9
|
@ -368,7 +368,12 @@ update_appups(Changes) ->
|
||||||
do_update_appup(App, Upgrade, Downgrade, OldUpgrade, OldDowngrade) ->
|
do_update_appup(App, Upgrade, Downgrade, OldUpgrade, OldDowngrade) ->
|
||||||
case locate(src, App, ".appup.src") of
|
case locate(src, App, ".appup.src") of
|
||||||
{ok, AppupFile} ->
|
{ok, AppupFile} ->
|
||||||
render_appfile(AppupFile, Upgrade, Downgrade);
|
case contains_contents(AppupFile, Upgrade, Downgrade) of
|
||||||
|
true ->
|
||||||
|
ok;
|
||||||
|
false ->
|
||||||
|
render_appfile(AppupFile, Upgrade, Downgrade)
|
||||||
|
end;
|
||||||
undefined ->
|
undefined ->
|
||||||
case create_stub(App) of
|
case create_stub(App) of
|
||||||
{ok, AppupFile} ->
|
{ok, AppupFile} ->
|
||||||
|
@ -408,6 +413,17 @@ create_stub(App) ->
|
||||||
false
|
false
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
%% we check whether the destination file already has the contents we
|
||||||
|
%% want to write to avoid writing and losing indentation and comments.
|
||||||
|
contains_contents(File, Upgrade, Downgrade) ->
|
||||||
|
%% the file may contain the VSN variable, so it's a script
|
||||||
|
case file:script(File, [{'VSN', 'VSN'}]) of
|
||||||
|
{ok, {_, Upgrade, Downgrade}} ->
|
||||||
|
true;
|
||||||
|
_ ->
|
||||||
|
false
|
||||||
|
end.
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
%% application and release indexing
|
%% application and release indexing
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
Loading…
Reference in New Issue