fix(update_appup): Fix dependency check
This commit is contained in:
parent
cb5db8059b
commit
14aaa4affe
|
@ -100,7 +100,7 @@ main(Options, Baseline) ->
|
||||||
"~n===================================~n"),
|
"~n===================================~n"),
|
||||||
CurrAppsIdx = index_apps(CurrRelDir),
|
CurrAppsIdx = index_apps(CurrRelDir),
|
||||||
PrevAppsIdx = index_apps(PrevRelDir),
|
PrevAppsIdx = index_apps(PrevRelDir),
|
||||||
%% log("Curr: ~p~nPrev: ~p~n", [CurrApps, PrevApps]),
|
%% log("Curr: ~p~nPrev: ~p~n", [CurrAppsIdx, PrevAppsIdx]),
|
||||||
AppupChanges = find_appup_actions(CurrAppsIdx, PrevAppsIdx),
|
AppupChanges = find_appup_actions(CurrAppsIdx, PrevAppsIdx),
|
||||||
case getopt(check) of
|
case getopt(check) of
|
||||||
true ->
|
true ->
|
||||||
|
@ -215,7 +215,7 @@ find_appup_actions(App, CurrAppIdx, PrevAppIdx = #app{version = PrevVersion}) ->
|
||||||
|
|
||||||
find_old_appup_actions(App, PrevVersion) ->
|
find_old_appup_actions(App, PrevVersion) ->
|
||||||
{Upgrade0, Downgrade0} =
|
{Upgrade0, Downgrade0} =
|
||||||
case locate(App, ".appup.src") of
|
case locate(ebin_current, App, ".appup") of
|
||||||
{ok, AppupFile} ->
|
{ok, AppupFile} ->
|
||||||
{_, U, D} = read_appup(AppupFile),
|
{_, U, D} = read_appup(AppupFile),
|
||||||
{U, D};
|
{U, D};
|
||||||
|
@ -286,7 +286,7 @@ update_appups(Changes) ->
|
||||||
Changes).
|
Changes).
|
||||||
|
|
||||||
do_update_appup(App, Upgrade, Downgrade) ->
|
do_update_appup(App, Upgrade, Downgrade) ->
|
||||||
case locate(App, ".appup.src") of
|
case locate(src, App, ".appup.src") of
|
||||||
{ok, AppupFile} ->
|
{ok, AppupFile} ->
|
||||||
render_appfile(AppupFile, Upgrade, Downgrade);
|
render_appfile(AppupFile, Upgrade, Downgrade);
|
||||||
undefined ->
|
undefined ->
|
||||||
|
@ -308,7 +308,7 @@ render_appfile(File, Upgrade, Downgrade) ->
|
||||||
ok = file:write_file(File, IOList).
|
ok = file:write_file(File, IOList).
|
||||||
|
|
||||||
create_stub(App) ->
|
create_stub(App) ->
|
||||||
case locate(App, ".app.src") of
|
case locate(src, App, ".app.src") of
|
||||||
{ok, AppSrc} ->
|
{ok, AppSrc} ->
|
||||||
AppupFile = filename:basename(AppSrc) ++ ".appup.src",
|
AppupFile = filename:basename(AppSrc) ++ ".appup.src",
|
||||||
Default = {<<".*">>, []},
|
Default = {<<".*">>, []},
|
||||||
|
@ -411,7 +411,16 @@ semver(Maj, Min, Patch) ->
|
||||||
lists:flatten(io_lib:format("~p.~p.~p", [Maj, Min, Patch])).
|
lists:flatten(io_lib:format("~p.~p.~p", [Maj, Min, Patch])).
|
||||||
|
|
||||||
%% Locate a file in a specified application
|
%% Locate a file in a specified application
|
||||||
locate(App, Suffix) ->
|
locate(ebin_current, App, Suffix) ->
|
||||||
|
ReleaseDir = getopt(beams_dir),
|
||||||
|
AppStr = atom_to_list(App),
|
||||||
|
case filelib:wildcard(ReleaseDir ++ "/**/ebin/" ++ AppStr ++ Suffix) of
|
||||||
|
[File] ->
|
||||||
|
{ok, File};
|
||||||
|
[] ->
|
||||||
|
undefined
|
||||||
|
end;
|
||||||
|
locate(src, App, Suffix) ->
|
||||||
AppStr = atom_to_list(App),
|
AppStr = atom_to_list(App),
|
||||||
SrcDirs = getopt(src_dirs),
|
SrcDirs = getopt(src_dirs),
|
||||||
case filelib:wildcard(SrcDirs ++ AppStr ++ Suffix) of
|
case filelib:wildcard(SrcDirs ++ AppStr ++ Suffix) of
|
||||||
|
|
Loading…
Reference in New Issue