[erlang-rebar] Fixed build in EL5 and added erl_interface as a dependency

Peter Lemenkov peter at fedoraproject.org
Tue May 22 11:17:52 UTC 2012


commit dbaf4f91569ee31a61246650a2d0b2fb5199c422
Author: Peter Lemenkov <lemenkov at gmail.com>
Date:   Tue May 22 15:17:38 2012 +0400

    Fixed build in EL5 and added erl_interface as a dependency
    
    Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>

 erlang-rebar.spec                                  |   42 ++++++-
 rebar-0001-No-need-to-create-bundle.patch          |    4 +-
 rebar-0002-Remove-bundled-mustache.patch           |    4 +-
 rebar-0003-Remove-bundled-getopt.patch             |    4 +-
 ...-No-erlang-min-2-and-erlang-max-2-in-R12B.patch |   43 ++++++
 ...ction-lists-keyfind-3-in-R12B5-use-lists-.patch |  146 ++++++++++++++++++++
 rebar-0006-No-such-type-dict-in-R12B.patch         |   26 ++++
 rebar-0007-No-such-directive-opaque-in-R12B.patch  |   27 ++++
 rebar-0008-No-such-type-boolean-in-R12B.patch      |   26 ++++
 9 files changed, 314 insertions(+), 8 deletions(-)
---
diff --git a/erlang-rebar.spec b/erlang-rebar.spec
index a439671..79c208d 100644
--- a/erlang-rebar.spec
+++ b/erlang-rebar.spec
@@ -7,7 +7,7 @@
 
 Name:		erlang-%{realname}
 Version:	2
-Release:	7.20120514git%{git_tag}%{?dist}
+Release:	8.20120514git%{git_tag}%{?dist}
 Summary:	Erlang Build Tools
 Group:		Development/Tools
 License:	MIT
@@ -18,11 +18,24 @@ Source1:	rebar.escript
 Patch1:		rebar-0001-No-need-to-create-bundle.patch
 Patch2:		rebar-0002-Remove-bundled-mustache.patch
 Patch3:		rebar-0003-Remove-bundled-getopt.patch
+# R12B - EPEL5-specific
+Patch4:		rebar-0004-No-erlang-min-2-and-erlang-max-2-in-R12B.patch
+# R12B - EPEL5-specific
+Patch5:		rebar-0005-No-such-function-lists-keyfind-3-in-R12B5-use-lists-.patch
+# R12B - EPEL5-specific
+Patch6:		rebar-0006-No-such-type-dict-in-R12B.patch
+# R12B - EPEL5-specific
+Patch7:		rebar-0007-No-such-directive-opaque-in-R12B.patch
+# R12B - EPEL5-specific
+Patch8:		rebar-0008-No-such-type-boolean-in-R12B.patch
 BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
-BuildRequires:	erlang-erts >= R13B-03
+BuildRequires:	erlang-erts
 BuildRequires:	erlang-getopt
+%if 0%{!?el5}
+# Missing dependency - FIXME this is a bug in erlang in EPEL5
 BuildRequires:	erlang-erl_interface
 BuildRequires:	erlang-reltool
+%endif
 # wip
 #Requires:	erlang-abnfc
 Requires:	erlang-asn1
@@ -34,6 +47,10 @@ Requires:	erlang-edoc
 Requires:	erlang-erlydtl
 %endif
 Requires:	erlang-erts
+%if 0%{!?el5}
+# Missing dependency - FIXME this is a bug in erlang in EPEL5
+Requires:	erlang-erl_interface
+%endif
 Requires:	erlang-eunit
 Requires:	erlang-getopt
 Requires:	erlang-kernel
@@ -41,7 +58,10 @@ Requires:	erlang-lfe
 Requires:	erlang-mustache
 Requires:	erlang-neotoma
 Requires:	erlang-protobuffs
+%if 0%{!?el5}
+# No reltool at all in the R12B
 Requires:	erlang-reltool
+%endif
 Requires:	erlang-snmp
 Requires:	erlang-stdlib
 Requires:	erlang-syntax_tools
@@ -58,12 +78,26 @@ Erlang Build Tools.
 %patch1 -p1 -b .no_bundle
 %patch2 -p1 -b .remove_bundled_mustache
 %patch3 -p1 -b .remove_bundled_getopt
+%if 0%{?el5}
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%endif
 # FIXME enable back when erlang-abnfc will be available
 rm -f src/rebar_abnfc_compiler.erl
 sed -i -e "/rebar_abnfc_compiler/d" ebin/rebar.app
 %if 0%{?el5}
+# Remove erlydtl support
 rm -f src/rebar_erlydtl_compiler.erl
 sed -i -e "/rebar_erlydtl_compiler/d" ebin/rebar.app
+# Remove reltool support
+rm -f src/rebar_reltool.erl
+sed -i -e "/rebar_reltool/d" ebin/rebar.app
+# Remove templater support - not required just for building anyway
+rm -f src/rebar_templater.erl
+sed -i -e "/rebar_templater/d" ebin/rebar.app
 %endif
 
 
@@ -94,6 +128,10 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Mon May 21 2012 Peter Lemenkov <lemenkov at gmail.com> - 2-8.20120514git635d1a9
+- Explicitly list erlang-erl_interface as a dependency
+- Fixed EPEL5 dependencies
+
 * Sun May 20 2012 Peter Lemenkov <lemenkov at gmail.com> - 2-7.20120514git635d1a9
 - Enable building on EL5 (remove erlydtl-related stuff on el5)
 - Remove abnfc-related stff until we package it
diff --git a/rebar-0001-No-need-to-create-bundle.patch b/rebar-0001-No-need-to-create-bundle.patch
index 7058aab..888c0e2 100644
--- a/rebar-0001-No-need-to-create-bundle.patch
+++ b/rebar-0001-No-need-to-create-bundle.patch
@@ -1,7 +1,7 @@
 From 6d7b6dca598f26fa5b46561b851e6b8286a50662 Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Tue, 28 Sep 2010 23:04:36 +0400
-Subject: [PATCH 1/3] No need to create bundle
+Subject: [PATCH 1/8] No need to create bundle
 
 Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
 ---
@@ -60,5 +60,5 @@ index e86ad8e..c4992a7 100755
      io:format("Congratulations! You now have a self-contained script called"
                " \"rebar\" in\n"
 -- 
-1.7.10.1
+1.7.10.2
 
diff --git a/rebar-0002-Remove-bundled-mustache.patch b/rebar-0002-Remove-bundled-mustache.patch
index 3ec0efb..1c608ea 100644
--- a/rebar-0002-Remove-bundled-mustache.patch
+++ b/rebar-0002-Remove-bundled-mustache.patch
@@ -1,7 +1,7 @@
 From 844182030976e868e7cd6aa67e891d55db749a65 Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Sat, 20 Nov 2010 16:36:45 +0300
-Subject: [PATCH 2/3] Remove bundled mustache
+Subject: [PATCH 2/8] Remove bundled mustache
 
 Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
 ---
@@ -265,5 +265,5 @@ index ac501a0..0000000
 -
 --endif.
 -- 
-1.7.10.1
+1.7.10.2
 
diff --git a/rebar-0003-Remove-bundled-getopt.patch b/rebar-0003-Remove-bundled-getopt.patch
index 8012c50..7243333 100644
--- a/rebar-0003-Remove-bundled-getopt.patch
+++ b/rebar-0003-Remove-bundled-getopt.patch
@@ -1,7 +1,7 @@
 From 0915eb1978ebca6d0f89421203d5be6d6b4fdd86 Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Sat, 20 Nov 2010 16:40:15 +0300
-Subject: [PATCH 3/3] Remove bundled getopt
+Subject: [PATCH 3/8] Remove bundled getopt
 
 Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
 ---
@@ -652,5 +652,5 @@ index 175b7a5..0000000
 -            T
 -    end.
 -- 
-1.7.10.1
+1.7.10.2
 
diff --git a/rebar-0004-No-erlang-min-2-and-erlang-max-2-in-R12B.patch b/rebar-0004-No-erlang-min-2-and-erlang-max-2-in-R12B.patch
new file mode 100644
index 0000000..5f80d0f
--- /dev/null
+++ b/rebar-0004-No-erlang-min-2-and-erlang-max-2-in-R12B.patch
@@ -0,0 +1,43 @@
+From e5fcb003c75c57ace23e1dcc873511ef550a0cab Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <lemenkov at gmail.com>
+Date: Tue, 22 May 2012 14:03:31 +0400
+Subject: [PATCH 4/8] No erlang:min/2 and erlang:max/2 in R12B
+
+Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
+---
+ src/rebar_config.erl |    2 +-
+ src/rebar_log.erl    |    5 ++++-
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/src/rebar_config.erl b/src/rebar_config.erl
+index 7f7d03c..41fa7be 100644
+--- a/src/rebar_config.erl
++++ b/src/rebar_config.erl
+@@ -110,7 +110,7 @@ set(Config, Key, Value) ->
+ set_global(jobs=Key, Value) when is_list(Value) ->
+     set_global(Key, list_to_integer(Value));
+ set_global(jobs=Key, Value) when is_integer(Value) ->
+-    application:set_env(rebar_global, Key, erlang:max(1, Value));
++    application:set_env(rebar_global, Key, case (1 > Value) of true -> 1; _ -> Value end);
+ set_global(Key, Value) ->
+     application:set_env(rebar_global, Key, Value).
+ 
+diff --git a/src/rebar_log.erl b/src/rebar_log.erl
+index b7529a9..29cd4ee 100644
+--- a/src/rebar_log.erl
++++ b/src/rebar_log.erl
+@@ -69,7 +69,10 @@ default_level() -> error_level().
+ %% ===================================================================
+ 
+ valid_level(Level) ->
+-    erlang:max(error_level(), erlang:min(Level, debug_level())).
++    DL0= debug_level(),
++    EL = error_level(),
++    DL = case (Level < DL0) of true -> Level; _ -> DL0 end,
++    case (EL > DL) of true -> EL; _ -> DL end.
+ 
+ error_level() -> 0.
+ debug_level() -> 3.
+-- 
+1.7.10.2
+
diff --git a/rebar-0005-No-such-function-lists-keyfind-3-in-R12B5-use-lists-.patch b/rebar-0005-No-such-function-lists-keyfind-3-in-R12B5-use-lists-.patch
new file mode 100644
index 0000000..20d140d
--- /dev/null
+++ b/rebar-0005-No-such-function-lists-keyfind-3-in-R12B5-use-lists-.patch
@@ -0,0 +1,146 @@
+From e0c8d80a666c83f304b22f8a8cb0838ea645744a Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <lemenkov at gmail.com>
+Date: Tue, 22 May 2012 14:11:11 +0400
+Subject: [PATCH 5/8] No such function lists:keyfind/3 in R12B5 - use
+ lists:keysearch/3 instead
+
+Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
+---
+ src/rebar_rel_utils.erl |   18 +++++++++---------
+ src/rebar_reltool.erl   |   10 +++++-----
+ src/rebar_templater.erl |    6 +++---
+ src/rebar_xref.erl      |    4 ++--
+ 4 files changed, 19 insertions(+), 19 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 42c7f15..5ff4044 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 f608512..6b9946f 100644
+--- a/src/rebar_templater.erl
++++ b/src/rebar_templater.erl
+@@ -90,8 +90,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,
+@@ -228,7 +228,7 @@ select_template([{Type, Avail} | Rest], Template) ->
+ %% Read the contents of a file from the appropriate source
+ %%
+ load_file(escript, Name) ->
+-    {Name, Bin} = lists:keyfind(Name, 1, erlang:get(escript_files)),
++    {value, {Name, Bin}} = lists:keysearch(Name, 1, erlang:get(escript_files)),
+     Bin;
+ load_file(file, Name) ->
+     {ok, Bin} = file:read_file(Name),
+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.7.10.2
+
diff --git a/rebar-0006-No-such-type-dict-in-R12B.patch b/rebar-0006-No-such-type-dict-in-R12B.patch
new file mode 100644
index 0000000..7bdd1ee
--- /dev/null
+++ b/rebar-0006-No-such-type-dict-in-R12B.patch
@@ -0,0 +1,26 @@
+From 1f4d9503c3ed5c81a1a3182e36cfa48fed71e13d Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <lemenkov at gmail.com>
+Date: Tue, 22 May 2012 14:44:44 +0400
+Subject: [PATCH 6/8] No such type dict() in R12B
+
+Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
+---
+ src/rebar_config.erl |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/rebar_config.erl b/src/rebar_config.erl
+index 41fa7be..6cc9c53 100644
+--- a/src/rebar_config.erl
++++ b/src/rebar_config.erl
+@@ -38,7 +38,7 @@
+ 
+ -record(config, { dir :: file:filename(),
+                   opts = [] :: list(),
+-                  envs = new_env() :: dict() }).
++                  envs = new_env() :: term() }).
+ 
+ %% Types that can be used from other modules -- alphabetically ordered.
+ -export_type([config/0]).
+-- 
+1.7.10.2
+
diff --git a/rebar-0007-No-such-directive-opaque-in-R12B.patch b/rebar-0007-No-such-directive-opaque-in-R12B.patch
new file mode 100644
index 0000000..0a23dcc
--- /dev/null
+++ b/rebar-0007-No-such-directive-opaque-in-R12B.patch
@@ -0,0 +1,27 @@
+From 4354f14dd2d0a4478ce1e3015eafe23d41ef9963 Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <lemenkov at gmail.com>
+Date: Tue, 22 May 2012 14:55:39 +0400
+Subject: [PATCH 7/8] No such directive -opaque in R12B
+
+Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
+---
+ src/rebar_config.erl |    3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/src/rebar_config.erl b/src/rebar_config.erl
+index 6cc9c53..d4909a9 100644
+--- a/src/rebar_config.erl
++++ b/src/rebar_config.erl
+@@ -43,9 +43,6 @@
+ %% Types that can be used from other modules -- alphabetically ordered.
+ -export_type([config/0]).
+ 
+-%% data types
+--opaque config() :: #config{}.
+-
+ %% ===================================================================
+ %% Public API
+ %% ===================================================================
+-- 
+1.7.10.2
+
diff --git a/rebar-0008-No-such-type-boolean-in-R12B.patch b/rebar-0008-No-such-type-boolean-in-R12B.patch
new file mode 100644
index 0000000..2d4f245
--- /dev/null
+++ b/rebar-0008-No-such-type-boolean-in-R12B.patch
@@ -0,0 +1,26 @@
+From 8a138f286a7b85e6a7d3f006bbdc0f521486d546 Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <lemenkov at gmail.com>
+Date: Tue, 22 May 2012 15:06:36 +0400
+Subject: [PATCH 8/8] No such type boolean in R12B
+
+Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
+---
+ src/rebar_erlc_compiler.erl |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl
+index 6535324..4c77af1 100644
+--- a/src/rebar_erlc_compiler.erl
++++ b/src/rebar_erlc_compiler.erl
+@@ -233,7 +233,7 @@ inspect_epp(Epp, Source, Module, Includes) ->
+     end.
+ 
+ -spec needs_compile(Source::file:filename(), Target::file:filename(),
+-                    Hrls::[string()]) -> boolean().
++                    Hrls::[string()]) -> bool().
+ needs_compile(Source, Target, Hrls) ->
+     TargetLastMod = filelib:last_modified(Target),
+     lists:any(fun(I) -> TargetLastMod < filelib:last_modified(I) end,
+-- 
+1.7.10.2
+


More information about the scm-commits mailing list