diff options
author | Kostis Sagonas <[email protected]> | 2011-03-06 16:05:40 +0200 |
---|---|---|
committer | Kostis Sagonas <[email protected]> | 2011-03-06 16:05:40 +0200 |
commit | d3a8a3136caac3a020c1c27c18c6b23f0c5eebce (patch) | |
tree | 2df7120f61a9ff1cf11871c3e257a9344cd70bd9 /lib | |
parent | 5ed0324ceb1e01839aa55e547cdeef98cbe4ad24 (diff) | |
download | otp-d3a8a3136caac3a020c1c27c18c6b23f0c5eebce.tar.gz otp-d3a8a3136caac3a020c1c27c18c6b23f0c5eebce.tar.bz2 otp-d3a8a3136caac3a020c1c27c18c6b23f0c5eebce.zip |
Fix a bug in the calculation of circular dependencies
While at it, applied some cleanups and code modernizations suggested by tidier.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reltool/src/reltool_target.erl | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/reltool/src/reltool_target.erl b/lib/reltool/src/reltool_target.erl index dd6f75b9fc..89ebbd1b5f 100644 --- a/lib/reltool/src/reltool_target.erl +++ b/lib/reltool/src/reltool_target.erl @@ -90,11 +90,11 @@ do_gen_config(#sys{root_dir = RootDir, debug_info = DebugInfo}, InclDefs) -> ErtsItems = - case lists:keysearch(erts, #app.name, Apps) of - {value, Erts} -> - [{erts, do_gen_config(Erts, InclDefs)}]; - false -> - [] + case lists:keyfind(erts, #app.name, Apps) of + false -> + []; + Erts -> + [{erts, do_gen_config(Erts, InclDefs)}] end, AppsItems = [do_gen_config(A, InclDefs) @@ -521,7 +521,6 @@ sort_apps([#app{name = Name, info = Info} = App | Apps], Visited, [], []), - Missing1 = NotFnd1 ++ NotFnd2 ++ Missing, case Uses ++ Incs of [] -> @@ -533,7 +532,7 @@ sort_apps([#app{name = Name, info = Info} = App | Apps], %% The apps in L must be started before the app. %% Check if we have already taken care of some app in L, %% in that case we have a circular dependency. - NewCircular = [N1 || N1 <- L, N2 <- Visited, N1 =:= N2], + NewCircular = [N || #app{name = N} <- L, N2 <- Visited, N =:= N2], Circular1 = case NewCircular of [] -> Circular; _ -> [Name | NewCircular] ++ Circular @@ -558,9 +557,9 @@ sort_apps([], Missing, Circular, _) -> [make_set(Circular), make_set(Missing)]). find_all(CheckingApp, [Name | Names], Apps, Visited, Found, NotFound) -> - case lists:keysearch(Name, #app.name, Apps) of - {value, #app{info = Info} = App} -> - %% It is OK to have a dependecy like + case lists:keyfind(Name, #app.name, Apps) of + #app{info = Info} = App -> + %% It is OK to have a dependency like %% X includes Y, Y uses X. case lists:member(CheckingApp, Info#app_info.incl_apps) of true -> @@ -1232,7 +1231,7 @@ do_eval_spec({strip_beam, File}, _OrigSourceDir, SourceDir, TargetDir) -> reltool_utils:write_file(TargetFile, BeamBin2). cleanup_spec(List, TargetDir) when is_list(List) -> - lists:foreach(fun(F)-> cleanup_spec(F, TargetDir) end, List); + lists:foreach(fun(F) -> cleanup_spec(F, TargetDir) end, List); %% cleanup_spec({source_dir, _SourceDir, Spec}, TargetDir) -> %% cleanup_spec(Spec, TargetDir); cleanup_spec({create_dir, Dir, Files}, TargetDir) -> @@ -1444,8 +1443,8 @@ subst([], _Vars, Result) -> subst_var([$%| Rest], Vars, Result, VarAcc) -> Key = lists:reverse(VarAcc), - case lists:keysearch(Key, 1, Vars) of - {value, {Key, Value}} -> + case lists:keyfind(Key, 1, Vars) of + {Key, Value} -> subst(Rest, Vars, lists:reverse(Value, Result)); false -> subst(Rest, Vars, [$% | VarAcc ++ [$% | Result]]) |