f16f160235
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
138 lines
5.4 KiB
Diff
138 lines
5.4 KiB
Diff
From 9a2ccd60d6336d2faefd86d54606f5e824c6976b Mon Sep 17 00:00:00 2001
|
|
From: Peter Lemenkov <lemenkov@gmail.com>
|
|
Date: Tue, 22 May 2012 14:11:11 +0400
|
|
Subject: [PATCH 6/9] No such function lists:keyfind/3 in R12B5 - use
|
|
lists:keysearch/3 instead
|
|
|
|
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
|
---
|
|
src/rebar_rel_utils.erl | 18 +++++++++---------
|
|
src/rebar_reltool.erl | 10 +++++-----
|
|
src/rebar_templater.erl | 4 ++--
|
|
src/rebar_xref.erl | 4 ++--
|
|
4 files changed, 18 insertions(+), 18 deletions(-)
|
|
|
|
diff --git a/src/rebar_rel_utils.erl b/src/rebar_rel_utils.erl
|
|
index e502743..21ff2dc 100644
|
|
--- a/src/rebar_rel_utils.erl
|
|
+++ b/src/rebar_rel_utils.erl
|
|
@@ -137,8 +137,8 @@ load_config(ReltoolFile) ->
|
|
%% Without this present, we can't run reltool.
|
|
%%
|
|
get_sys_tuple(ReltoolConfig) ->
|
|
- case lists:keyfind(sys, 1, ReltoolConfig) of
|
|
- {sys, _} = SysTuple ->
|
|
+ case lists:keysearch(sys, 1, ReltoolConfig) of
|
|
+ {value, {sys, _}} = SysTuple ->
|
|
SysTuple;
|
|
false ->
|
|
?ABORT("Failed to find {sys, [...]} tuple in reltool.config.", [])
|
|
@@ -151,13 +151,13 @@ get_sys_tuple(ReltoolConfig) ->
|
|
get_target_dir(ReltoolConfig) ->
|
|
case rebar_config:get_global(target_dir, undefined) of
|
|
undefined ->
|
|
- case lists:keyfind(target_dir, 1, ReltoolConfig) of
|
|
- {target_dir, TargetDir} ->
|
|
+ case lists:keysearch(target_dir, 1, ReltoolConfig) of
|
|
+ {value, {target_dir, TargetDir}} ->
|
|
filename:absname(TargetDir);
|
|
false ->
|
|
{sys, SysInfo} = get_sys_tuple(ReltoolConfig),
|
|
- case lists:keyfind(rel, 1, SysInfo) of
|
|
- {rel, Name, _Vsn, _Apps} ->
|
|
+ case lists:keysearch(rel, 1, SysInfo) of
|
|
+ {value, {rel, Name, _Vsn, _Apps}} ->
|
|
filename:absname(Name);
|
|
false ->
|
|
filename:absname("target")
|
|
@@ -180,7 +180,7 @@ get_target_parent_dir(ReltoolConfig) ->
|
|
%%
|
|
get_root_dir(ReltoolConfig) ->
|
|
{sys, SysInfo} = get_sys_tuple(ReltoolConfig),
|
|
- SysRootDirTuple = lists:keyfind(root_dir, 1, SysInfo),
|
|
+ {value, SysRootDirTuple} = lists:keysearch(root_dir, 1, SysInfo),
|
|
CmdRootDir = rebar_config:get_global(root_dir, undefined),
|
|
case {SysRootDirTuple, CmdRootDir} of
|
|
%% root_dir in sys typle and no root_dir on cmd-line
|
|
@@ -218,8 +218,8 @@ make_proplist([], Acc) ->
|
|
Acc.
|
|
|
|
expand_version(ReltoolConfig, Dir) ->
|
|
- case lists:keyfind(sys, 1, ReltoolConfig) of
|
|
- {sys, Sys} ->
|
|
+ case lists:keysearch(sys, 1, ReltoolConfig) of
|
|
+ {value, {sys, Sys}} ->
|
|
ExpandedSys = {sys, [expand_rel_version(Term, Dir) || Term <- Sys]},
|
|
lists:keyreplace(sys, 1, ReltoolConfig, ExpandedSys);
|
|
_ ->
|
|
diff --git a/src/rebar_reltool.erl b/src/rebar_reltool.erl
|
|
index c114811..eb34385 100644
|
|
--- a/src/rebar_reltool.erl
|
|
+++ b/src/rebar_reltool.erl
|
|
@@ -116,8 +116,8 @@ process_overlay(ReltoolConfig) ->
|
|
OverlayVars1),
|
|
|
|
%% Finally, overlay the files specified by the overlay section
|
|
- case lists:keyfind(overlay, 1, ReltoolConfig) of
|
|
- {overlay, Overlay} when is_list(Overlay) ->
|
|
+ case lists:keysearch(overlay, 1, ReltoolConfig) of
|
|
+ {value, {overlay, Overlay}} when is_list(Overlay) ->
|
|
execute_overlay(Overlay, OverlayVars, rebar_utils:get_cwd(),
|
|
TargetDir);
|
|
false ->
|
|
@@ -156,10 +156,10 @@ load_vars_file(File) ->
|
|
|
|
|
|
validate_rel_apps(ReltoolServer, {sys, ReltoolConfig}) ->
|
|
- case lists:keyfind(rel, 1, ReltoolConfig) of
|
|
+ case lists:keysearch(rel, 1, ReltoolConfig) of
|
|
false ->
|
|
ok;
|
|
- {rel, _Name, _Vsn, Apps} ->
|
|
+ {value, {rel, _Name, _Vsn, Apps}} ->
|
|
%% Identify all the apps that do NOT exist, based on
|
|
%% what's available from the reltool server
|
|
Missing = lists:sort(
|
|
@@ -172,7 +172,7 @@ validate_rel_apps(ReltoolServer, {sys, ReltoolConfig}) ->
|
|
?ABORT("Apps in {rel, ...} section not found by "
|
|
"reltool: ~p\n", [Missing])
|
|
end;
|
|
- Rel ->
|
|
+ {value, Rel} ->
|
|
%% Invalid release format!
|
|
?ABORT("Invalid {rel, ...} section in reltools.config: ~p\n", [Rel])
|
|
end.
|
|
diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl
|
|
index 450eb4d..6ec3277 100644
|
|
--- a/src/rebar_templater.erl
|
|
+++ b/src/rebar_templater.erl
|
|
@@ -80,8 +80,8 @@ create(_Config, _) ->
|
|
%% Load the template definition as is and get the list of variables the
|
|
%% template requires.
|
|
TemplateTerms = consult(load_file(Type, Template)),
|
|
- case lists:keyfind(variables, 1, TemplateTerms) of
|
|
- {variables, Vars} ->
|
|
+ case lists:keysearch(variables, 1, TemplateTerms) of
|
|
+ {value, {variables, Vars}} ->
|
|
case parse_vars(Vars, dict:new()) of
|
|
{error, Entry} ->
|
|
Context0 = undefined,
|
|
diff --git a/src/rebar_xref.erl b/src/rebar_xref.erl
|
|
index 94103eb..17fb2a1 100644
|
|
--- a/src/rebar_xref.erl
|
|
+++ b/src/rebar_xref.erl
|
|
@@ -159,8 +159,8 @@ filter_away_ignored(UnusedExports) ->
|
|
|
|
|
|
kf(Key, List) ->
|
|
- case lists:keyfind(Key, 1, List) of
|
|
- {Key, Value} ->
|
|
+ case lists:keysearch(Key, 1, List) of
|
|
+ {value, {Key, Value}} ->
|
|
Value;
|
|
false ->
|
|
[]
|
|
--
|
|
1.8.0.1
|
|
|