From 14aaa4affed9ea3911f5757519f259cfa8937791 Mon Sep 17 00:00:00 2001 From: k32 <10274441+k32@users.noreply.github.com> Date: Thu, 14 Oct 2021 14:18:09 +0200 Subject: [PATCH] fix(update_appup): Fix dependency check --- scripts/update_appup.escript | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/update_appup.escript b/scripts/update_appup.escript index ffbfcb810..c947eee87 100755 --- a/scripts/update_appup.escript +++ b/scripts/update_appup.escript @@ -100,7 +100,7 @@ main(Options, Baseline) -> "~n===================================~n"), CurrAppsIdx = index_apps(CurrRelDir), 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), case getopt(check) of true -> @@ -215,7 +215,7 @@ find_appup_actions(App, CurrAppIdx, PrevAppIdx = #app{version = PrevVersion}) -> find_old_appup_actions(App, PrevVersion) -> {Upgrade0, Downgrade0} = - case locate(App, ".appup.src") of + case locate(ebin_current, App, ".appup") of {ok, AppupFile} -> {_, U, D} = read_appup(AppupFile), {U, D}; @@ -286,7 +286,7 @@ update_appups(Changes) -> Changes). do_update_appup(App, Upgrade, Downgrade) -> - case locate(App, ".appup.src") of + case locate(src, App, ".appup.src") of {ok, AppupFile} -> render_appfile(AppupFile, Upgrade, Downgrade); undefined -> @@ -308,7 +308,7 @@ render_appfile(File, Upgrade, Downgrade) -> ok = file:write_file(File, IOList). create_stub(App) -> - case locate(App, ".app.src") of + case locate(src, App, ".app.src") of {ok, AppSrc} -> AppupFile = filename:basename(AppSrc) ++ ".appup.src", Default = {<<".*">>, []}, @@ -411,7 +411,16 @@ semver(Maj, Min, Patch) -> lists:flatten(io_lib:format("~p.~p.~p", [Maj, Min, Patch])). %% 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), SrcDirs = getopt(src_dirs), case filelib:wildcard(SrcDirs ++ AppStr ++ Suffix) of