From 90d2ce5e0770be25179376af87ce861c33c1ba14 Mon Sep 17 00:00:00 2001 From: joewilliams Date: Fri, 25 Feb 2011 10:16:52 -0500 Subject: Ignore app files not in ebin --- src/rebar_appups.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/rebar_appups.erl') diff --git a/src/rebar_appups.erl b/src/rebar_appups.erl index ab5af29..ec1df0a 100644 --- a/src/rebar_appups.erl +++ b/src/rebar_appups.erl @@ -56,10 +56,10 @@ "Reltool and .rel release names do not match~n", []), %% Get lists of the old and new app files - OldAppFiles = rebar_utils:find_files( - filename:join([OldVerPath, "lib"]), "^.*.app$"), - NewAppFiles = rebar_utils:find_files( - filename:join([NewName, "lib"]), "^.*.app$"), + OldAppFiles = filelib:wildcard( + filename:join([OldVerPath, "lib", "*", "ebin", "*.app"])), + NewAppFiles = filelib:wildcard( + filename:join([NewName, "lib", "*", "ebin", "*.app"])), %% Find all the apps that have been upgraded UpgradedApps = get_upgraded_apps(OldAppFiles, NewAppFiles), -- cgit v1.1 From 0f99ba22804abe2f69f1425b82f6dc1d098ab441 Mon Sep 17 00:00:00 2001 From: joewilliams Date: Thu, 3 Mar 2011 10:39:44 -0800 Subject: Fix bug that causes appup generation to fail This commit changes how rebar determines which apps have been updated, added and removed from a release during appup generation. Rather than use app files it now determines this from the rel file in each version of the release. In addition it fixes a bug reported on the mailing list when generating appups when an application has been added or removed from either release. --- src/rebar_appups.erl | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/rebar_appups.erl') diff --git a/src/rebar_appups.erl b/src/rebar_appups.erl index ec1df0a..079d596 100644 --- a/src/rebar_appups.erl +++ b/src/rebar_appups.erl @@ -55,14 +55,8 @@ NewName == OldName, "Reltool and .rel release names do not match~n", []), - %% Get lists of the old and new app files - OldAppFiles = filelib:wildcard( - filename:join([OldVerPath, "lib", "*", "ebin", "*.app"])), - NewAppFiles = filelib:wildcard( - filename:join([NewName, "lib", "*", "ebin", "*.app"])), - %% Find all the apps that have been upgraded - UpgradedApps = get_upgraded_apps(OldAppFiles, NewAppFiles), + UpgradedApps = get_upgraded_apps(Name, OldVerPath, NewVerPath), %% Get a list of any appup files that exist in the new release NewAppUpFiles = rebar_utils:find_files( @@ -85,18 +79,24 @@ %% Internal functions %% =================================================================== -get_upgraded_apps(OldAppFiles, NewAppFiles) -> - OldAppsVer = [{rebar_app_utils:app_name(AppFile), - rebar_app_utils:app_vsn(AppFile)} || AppFile <- OldAppFiles], - NewAppsVer = [{rebar_app_utils:app_name(AppFile), - rebar_app_utils:app_vsn(AppFile)} || AppFile <- NewAppFiles], - UpgradedApps = lists:subtract(NewAppsVer, OldAppsVer), - lists:map( - fun({App, NewVer}) -> - {App, OldVer} = proplists:lookup(App, OldAppsVer), - {App, {OldVer, NewVer}} - end, - UpgradedApps). +get_upgraded_apps(Name, OldVerPath, NewVerPath) -> + OldApps = rebar_rel_utils:get_rel_apps(Name, OldVerPath), + NewApps = rebar_rel_utils:get_rel_apps(Name, NewVerPath), + + Sorted = lists:umerge(lists:sort(NewApps), lists:sort(OldApps)), + AddedorChanged = lists:subtract(Sorted, OldApps), + DeletedorChanged = lists:subtract(Sorted, NewApps), + ?DEBUG("Added or Changed: ~p~n", [AddedorChanged]), + ?DEBUG("Deleted or Changed: ~p~n", [DeletedorChanged]), + + AddedDeletedChanged = lists:ukeysort(1, lists:append(DeletedorChanged, + AddedorChanged)), + UpgradedApps = lists:subtract(AddedorChanged, AddedDeletedChanged), + ?DEBUG("Upgraded Apps:~p~n", [UpgradedApps]), + + [{AppName, {proplists:get_value(AppName, OldApps), NewVer}} + || {AppName, NewVer} <- UpgradedApps]. + file_to_name(File) -> filename:rootname(filename:basename(File)). -- cgit v1.1