Fix dependency issues mentioned by automatic dependency checker

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
This commit is contained in:
Peter Lemenkov 2016-03-02 15:40:32 +03:00
parent a19a584c26
commit 9339c89dc5
14 changed files with 367 additions and 124 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
/basho-rebar-2.1.0-pre-0-gebb474b.tar.gz
/rebar-5dea85db1b697466586877bed133748bd80fa180.tar.gz
/rebar-365ac649dc818619757f96a699ddb174f004cff9.tar.gz
/rebar-2.6.1.tar.gz

View File

@ -1,8 +1,6 @@
%global realname rebar
%global upstream basho
%global upstream rebar
%global debug_package %{nil}
%global commit 365ac649dc818619757f96a699ddb174f004cff9
%global patchnumber 0
# Set this to true when starting a rebuild of the whole erlang stack. There's
# a cyclical dependency between erlang-rebar and erlang-getopt so this package
@ -14,13 +12,12 @@
Name: erlang-%{realname}
Version: 2.6.1
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Erlang Build Tools
Group: Development/Tools
License: MIT
URL: https://github.com/rebar/rebar
# wget --content-disposition https://github.com/rebar/rebar/archive/365ac649dc818619757f96a699ddb174f004cff9/rebar-365ac649dc818619757f96a699ddb174f004cff9.tar.gz
Source0: https://github.com/rebar/rebar/archive/%{commit}/%{realname}-%{commit}.tar.gz
URL: https://github.com/%{upstream}/%{realname}
Source0: https://github.com/%{upstream}/%{realname}/archive/%{version}/%{realname}-%{version}.tar.gz
Source1: rebar.escript
# Fedora/EPEL-specific
Patch1: rebar-0001-Don-t-load-templates-from-the-bundle.patch
@ -36,34 +33,37 @@ Patch3: rebar-0003-Remove-bundled-getopt.patch
Patch4: rebar-0004-Allow-discarding-building-ports.patch
# Fedora/EPEL-specific
Patch5: rebar-0005-Check-system-wide-libdir-in-case-of-source-based-dep.patch
# Fedora/EPEL-specific
# Fedora/EPEL-specific - we're using at least R16B03
Patch6: rebar-0006-Remove-any-traces-of-long-time-obsolete-escript-fold.patch
Patch7: rebar-0007-remove-abnfc.patch
Patch8: rebar-0008-Disable-eflame-support-for-now.patch
Patch9: rebar-0009-Remove-support-for-gpb-compiler.patch
# Fedora/EPEL-specific - we're using at least R16B03
Patch10: rebar-0010-Remove-pre-R15B02-workaround.patch
# Fedora/EPEL-specific - keep until we dump R16B03-1 and 17.x.y entirely
Patch11: rebar-0011-No-such-function-erlang-timestamp-0.patch
%if 0%{?need_bootstrap} < 1
BuildRequires: erlang-rebar
%else
BuildRequires: erlang
%endif
# FIXME should be removed in the next builds - it will be picked up
# automatically
BuildRequires: erlang-common_test
BuildRequires: erlang-parsetools
BuildRequires: erlang-rpm-macros
# FIXME wip
#Requires: erlang-abnfc%{?_isa}
Requires: erlang-common_test%{?_isa}
# Requires for port compiling - no direct references in Rebar's src/*.erl files
Requires: erlang-erl_interface%{?_isa}
# Autochecker picks up a missing dependency in R16 -
# eunit_test:function_wrapper/2. This function was removed in R16, and rebar
# contains a workaround for that. So no need to worry about that.
#Requires: erlang-eflame%{?_isa}
#Requires: erlang-gpb%{?_isa}
# This one cannot be picked up automatically
# See https://bugzilla.redhat.com/960079
Requires: erlang-common_test%{?_isa}
# Requires for port compiling - no direct references in Rebar's src/*.erl files
Requires: erlang-erl_interface%{?_isa}
# This one cannot be picked up automatically
# See https://bugzilla.redhat.com/960079
Requires: erlang-parsetools%{?_isa}
Requires: erlang-rpm-macros
Provides: %{realname} = %{version}-%{release}
@ -73,7 +73,7 @@ Erlang Build Tools.
%prep
%setup -q -n %{realname}-%{commit}
%setup -q -n %{realname}-%{version}
%patch1 -p1 -b .dont_load_templates
%patch2 -p1 -b .remove_bundled_mustache
%if 0%{?need_bootstrap} < 1
@ -82,11 +82,16 @@ Erlang Build Tools.
%patch4 -p1 -b .allow_discarding_ports
%patch5 -p1 -b .use_locally_installed
%patch6 -p1 -b .remove_escript_foldl_3
%patch7 -p1 -b .remove_abnfc
%patch8 -p1 -b .remove_eflame
%patch9 -p1 -b .remove_gpb
%patch10 -p1 -b .remove_pre_R15B02
%patch11 -p1 -b .typo_fix
%build
%if 0%{?need_bootstrap} < 1
rebar compile -v
%{rebar_compile}
%else
./bootstrap
./rebar compile -v
@ -95,15 +100,15 @@ rebar compile -v
%install
install -D -p -m 0755 %{SOURCE1} %{buildroot}%{_bindir}/rebar
mkdir -p %{buildroot}%{_libdir}/erlang/lib/%{realname}-%{version}/ebin
mkdir -p %{buildroot}%{_libdir}/erlang/lib/%{realname}-%{version}/include
install -m 644 ebin/%{realname}.app %{buildroot}%{_libdir}/erlang/lib/%{realname}-%{version}/ebin
install -m 644 ebin/*.beam %{buildroot}%{_libdir}/erlang/lib/%{realname}-%{version}/ebin
install -m 644 include/*.hrl %{buildroot}%{_libdir}/erlang/lib/%{realname}-%{version}/include
cp -a priv %{buildroot}%{_libdir}/erlang/lib/%{realname}-%{version}/
mkdir -p %{buildroot}%{_erllibdir}/%{realname}-%{version}/{ebin,include}
install -m 644 ebin/%{realname}.app %{buildroot}%{_erllibdir}/%{realname}-%{version}/ebin
install -m 644 ebin/*.beam %{buildroot}%{_erllibdir}/%{realname}-%{version}/ebin
install -m 644 include/*.hrl %{buildroot}%{_erllibdir}/%{realname}-%{version}/include
cp -a priv %{buildroot}%{_erllibdir}/%{realname}-%{version}/
%check
# FIXME
#rebar eunit -v
@ -111,10 +116,13 @@ cp -a priv %{buildroot}%{_libdir}/erlang/lib/%{realname}-%{version}/
%doc README.md THANKS rebar.config.sample
%license LICENSE
%{_bindir}/rebar
%{_libdir}/erlang/lib/%{realname}-%{version}
%{_erllibdir}/%{realname}-%{version}
%changelog
* Wed Mar 2 2016 Peter Lemenkov <lemenkov@gmail.com> - 2.6.1-5
- Fix dependency issues mentioned by automatic dependency checker
* Tue Mar 1 2016 Peter Lemenkov <lemenkov@gmail.com> - 2.6.1-4
- Add (Build)Requires which weren't picked up automatically

View File

@ -1,18 +1,14 @@
From b658042106136a5b471f0d248ec988c6eed77006 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Mon, 4 Mar 2013 19:03:03 +0400
Subject: [PATCH 01/10] Don't load templates from the bundle
Subject: [PATCH] Don't load templates from the bundle
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
src/rebar_templater.erl | 31 +++++--------------------------
1 file changed, 5 insertions(+), 26 deletions(-)
diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl
index 0e1eef1..7cc36f7 100644
index 085ac1c..efee394 100644
--- a/src/rebar_templater.erl
+++ b/src/rebar_templater.erl
@@ -167,27 +167,11 @@ create1(Config, TemplateId) ->
@@ -205,27 +205,11 @@ create1(Config, TemplateId) ->
execute_template(Files, FinalTemplate, Type, Template, Context, Force, []).
find_templates(Config) ->
@ -42,7 +38,7 @@ index 0e1eef1..7cc36f7 100644
template_id(Config) ->
case rebar_config:get_global(Config, template, undefined) of
@@ -197,10 +181,8 @@ template_id(Config) ->
@@ -235,10 +219,8 @@ template_id(Config) ->
TemplateId
end.
@ -55,7 +51,7 @@ index 0e1eef1..7cc36f7 100644
find_disk_templates(Config) ->
OtherTemplates = find_other_templates(Config),
@@ -231,10 +213,7 @@ select_template([{Type, Avail} | Rest], Template) ->
@@ -269,10 +251,7 @@ select_template([{Type, Avail} | Rest], Template) ->
%%
%% Read the contents of a file from the appropriate source
%%
@ -67,6 +63,3 @@ index 0e1eef1..7cc36f7 100644
{ok, Bin} = file:read_file(Name),
Bin.
--
1.8.1.4

View File

@ -1,18 +1,10 @@
From 119d6edc55c673d88b97e18aeb97ce1dcfb207c4 Mon Sep 17 00:00:00 2001
From: Filip Andres <filip@andresovi.net>
Date: Fri, 3 Jul 2015 10:46:48 +0200
Subject: [PATCH] Remove bundled mustache
---
ebin/rebar.app | 1 -
src/rebar_mustache.erl | 230 ----------------------------
src/rebar_templater.erl | 2 +-
src/rebar_templater.erl.dont_load_templates | 2 +-
4 files changed, 2 insertions(+), 233 deletions(-)
delete mode 100644 src/rebar_mustache.erl
diff --git a/ebin/rebar.app b/ebin/rebar.app
index 152829d..967afb0 100644
index b4de616..27707c3 100644
--- a/ebin/rebar.app
+++ b/ebin/rebar.app
@@ -45,7 +45,6 @@
@ -272,19 +264,3 @@ index efee394..77c5bd8 100644
%% ===================================================================
%% Internal functions
diff --git a/src/rebar_templater.erl.dont_load_templates b/src/rebar_templater.erl.dont_load_templates
index 085ac1c..0b70976 100644
--- a/src/rebar_templater.erl.dont_load_templates
+++ b/src/rebar_templater.erl.dont_load_templates
@@ -103,7 +103,7 @@ render(Bin, Context) ->
ReOpts = [global, {return, list}],
Str0 = re:replace(Bin, "\\\\", "\\\\\\", ReOpts),
Str1 = re:replace(Str0, "\"", "\\\\\"", ReOpts),
- rebar_mustache:render(Str1, Context).
+ mustache:render(Str1, Context).
%% ===================================================================
%% Internal functions
--
2.1.0

View File

@ -1,20 +1,13 @@
From 42fac65535e6cc260e39cd7594ac7de28129f76b Mon Sep 17 00:00:00 2001
From: Filip Andres <filip@andresovi.net>
Date: Fri, 3 Jul 2015 10:56:26 +0200
Subject: [PATCH] Remove bundled getopt
---
ebin/rebar.app | 1 -
src/rebar.erl | 4 +-
src/rebar_getopt.erl | 914 ---------------------------------------------------
3 files changed, 2 insertions(+), 917 deletions(-)
delete mode 100644 src/rebar_getopt.erl
diff --git a/ebin/rebar.app b/ebin/rebar.app
index 8a65fc8..2d2a0e7 100644
index 27707c3..f9b0c22 100644
--- a/ebin/rebar.app
+++ b/ebin/rebar.app
@@ -43,7 +43,6 @@
@@ -44,7 +44,6 @@
rebar_utils,
rebar_xref,
rebar_metacmds,
@ -964,6 +957,3 @@ index 79b871d..0000000
- atom_to_list(Atom);
-to_string(Value) ->
- io_lib:format("~p", [Value]).
--
2.1.0

View File

@ -1,21 +1,17 @@
From a101ee059baff585da6d1086097e8ceb20bda5d1 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Tue, 5 Jun 2012 15:10:12 +0400
Subject: [PATCH 05/10] Allow discarding building ports
Subject: [PATCH] Allow discarding building ports
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
Conflicts:
src/rebar_port_compiler.erl
---
src/rebar_port_compiler.erl | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl
index 70ee308..3deeb7c 100644
index 906bcb0..9ae4778 100644
--- a/src/rebar_port_compiler.erl
+++ b/src/rebar_port_compiler.erl
@@ -253,6 +253,12 @@ get_specs(Config, AppFile) ->
@@ -300,6 +300,12 @@ get_specs(Config, AppFile) ->
%% No spec provided. Construct a spec
%% from old-school so_name and sources
[port_spec_from_legacy(Config, AppFile)];
@ -28,6 +24,3 @@ index 70ee308..3deeb7c 100644
PortSpecs ->
Filtered = filter_port_specs(PortSpecs),
OsType = os:type(),
--
1.8.1.4

View File

@ -1,19 +1,14 @@
From 13fd63738960c567d32df3061a2a4e5452dac0e1 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Sat, 2 Mar 2013 10:39:15 +0400
Subject: [PATCH 06/10] Check system-wide libdir in case of source-based
dependency
Subject: [PATCH] Check system-wide libdir in case of source-based dependency
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
src/rebar_deps.erl | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl
index 074e929..9cc82f7 100644
index a6e5b27..ba2b4e8 100644
--- a/src/rebar_deps.erl
+++ b/src/rebar_deps.erl
@@ -305,7 +305,12 @@ find_dep(Config, Dep, _Source) ->
@@ -393,7 +393,12 @@ find_dep(Config, Dep, _Source) ->
%% _Source is defined. Regardless of what it is, we must find it
%% locally satisfied or fetch it from the original source
%% into the project's deps
@ -27,6 +22,3 @@ index 074e929..9cc82f7 100644
find_dep_in_dir(Config, _Dep, {false, Dir}) ->
{Config, {missing, Dir}};
--
1.8.1.4

View File

@ -1,18 +1,14 @@
From 1900df4838d7623009b09fffaa6f23daa5da46c8 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Sat, 2 Mar 2013 13:35:36 +0400
Subject: [PATCH 07/10] Remove any traces of long-time obsolete escript:foldl/3
Subject: [PATCH] Remove any traces of long-time obsolete escript:foldl/3
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
src/rebar_utils.erl | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index bb58460..c86c210 100644
index 64595a2..08f5b5f 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -155,12 +155,7 @@ abort(String, Args) ->
@@ -222,12 +222,7 @@ abort(String, Args) ->
%% undocumented exported fun and has been removed in R14.
escript_foldl(Fun, Acc, File) ->
{module, zip} = code:ensure_loaded(zip),
@ -26,6 +22,3 @@ index bb58460..c86c210 100644
find_executable(Name) ->
case os:find_executable(Name) of
--
1.8.1.4

View File

@ -1,17 +1,10 @@
From 80ec40458dbe04e10531f0ce6ac90207e9eeb7c7 Mon Sep 17 00:00:00 2001
From: Filip Andres <filip@andresovi.net>
Date: Mon, 29 Jun 2015 14:05:01 +0200
Subject: [PATCH] remove abnfc
---
ebin/rebar.app | 2 -
rebar.config | 1 -
src/rebar_abnfc_compiler.erl | 123 -------------------------------------------
3 files changed, 126 deletions(-)
delete mode 100644 src/rebar_abnfc_compiler.erl
diff --git a/ebin/rebar.app b/ebin/rebar.app
index 152829d..0205d3f 100644
index f9b0c22..9f5ae44 100644
--- a/ebin/rebar.app
+++ b/ebin/rebar.app
@@ -5,7 +5,6 @@
@ -22,7 +15,7 @@ index 152829d..0205d3f 100644
rebar_app_utils,
rebar_appups,
rebar_asn1_compiler,
@@ -80,7 +79,6 @@
@@ -81,7 +80,6 @@
%% Dir specific processing modules
{modules, [
{app_dir, [
@ -31,7 +24,7 @@ index 152829d..0205d3f 100644
rebar_protobuffs_compiler,
rebar_proto_gpb_compiler,
diff --git a/rebar.config b/rebar.config
index a3849ec..c72aef7 100644
index bcd5368..6fa4f27 100644
--- a/rebar.config
+++ b/rebar.config
@@ -20,7 +20,6 @@
@ -171,6 +164,3 @@ index 37731b5..0000000
- ?FAIL
- end
- end.
--
2.1.0

View File

@ -0,0 +1,64 @@
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Wed, 2 Mar 2016 14:56:59 +0300
Subject: [PATCH] Disable eflame support for now
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/src/rebar.erl b/src/rebar.erl
index 2040e7a..b8935ac 100644
--- a/src/rebar.erl
+++ b/src/rebar.erl
@@ -156,11 +156,7 @@ init_config1(BaseConfig) ->
rebar_config:set_xconf(BaseConfig1, base_dir, AbsCwd).
profile(BaseConfig1, Commands) ->
- ?CONSOLE("Please take note that profiler=[fprof|eflame] is preliminary"
- " and will be~nreplaced with a different command line flag"
- " in the next release.~n", []),
- Profiler = rebar_config:get_global(BaseConfig1, profiler, "fprof"),
- profile(BaseConfig1, Commands, list_to_atom(Profiler)).
+ profile(BaseConfig1, Commands, fprof).
profile(Config, Commands, fprof) ->
try
@@ -182,28 +178,6 @@ profile(Config, Commands, fprof) ->
ok
end
end;
-profile(Config, Commands, eflame) ->
- case code:lib_dir(eflame) of
- {error, bad_name} ->
- ?ABORT("eflame not found in code path~n", []),
- ok;
- EflameDir ->
- Trace = "eflame.trace",
- try
- eflame:apply(normal_with_children, Trace,
- rebar, run, [Config, Commands])
- after
- %% generate flame graph
- Script = filename:join(EflameDir, "stack_to_flame.sh"),
- Svg = "eflame.svg",
- %% stack_to_flame.sh < eflame.trace > eflame.png
- Cmd = ?FMT("~s < ~s > ~s", [Script, Trace, Svg]),
- {ok, []} = rebar_utils:sh(Cmd, [{use_stdout, false},
- abort_on_error]),
- ?CONSOLE("See eflame.svg (generated from eflame.trace)~n", []),
- ok
- end
- end;
profile(_Config, _Commands, Profiler) ->
?ABORT("Unsupported profiler: ~s~n", [Profiler]).
@@ -499,9 +473,8 @@ option_spec_list() ->
{jobs, $j, "jobs", integer, JobsHelp},
{config, $C, "config", string, "Rebar config file to use"},
{profile, $p, "profile", undefined,
- "Profile this run of rebar. Via profiler= you can optionally select "
- "either fprof (default) or eflame. The result can be found in "
- "fprof.analysis or eflame.svg."},
+ "Profile this run of rebar. The result can be found in "
+ "fprof.analysis."},
{keep_going, $k, "keep-going", undefined,
"Keep running after a command fails"},
{recursive, $r, "recursive", boolean,

View File

@ -0,0 +1,166 @@
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Wed, 2 Mar 2016 15:03:13 +0300
Subject: [PATCH] Remove support for gpb compiler
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/ebin/rebar.app b/ebin/rebar.app
index 9f5ae44..43189b7 100644
--- a/ebin/rebar.app
+++ b/ebin/rebar.app
@@ -31,7 +31,6 @@
rebar_port_compiler,
rebar_proto_compiler,
rebar_protobuffs_compiler,
- rebar_proto_gpb_compiler,
rebar_qc,
rebar_rel_utils,
rebar_reltool,
diff --git a/src/rebar_proto_gpb_compiler.erl b/src/rebar_proto_gpb_compiler.erl
deleted file mode 100644
index c528a4a..0000000
--- a/src/rebar_proto_gpb_compiler.erl
+++ /dev/null
@@ -1,142 +0,0 @@
-%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
-%% ex: ts=4 sw=4 et
-%% -------------------------------------------------------------------
-%%
-%% rebar: Erlang Build Tools
-%%
-%% Copyright (c) 2014 Tomas Abrahamsson (tomas.abrahamsson@gmail.com)
-%%
-%% Permission is hereby granted, free of charge, to any person obtaining a copy
-%% of this software and associated documentation files (the "Software"), to deal
-%% in the Software without restriction, including without limitation the rights
-%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-%% copies of the Software, and to permit persons to whom the Software is
-%% furnished to do so, subject to the following conditions:
-%%
-%% The above copyright notice and this permission notice shall be included in
-%% all copies or substantial portions of the Software.
-%%
-%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-%% THE SOFTWARE.
-%% -------------------------------------------------------------------
--module(rebar_proto_gpb_compiler).
-
--export([key/0,
- proto_compile/3,
- proto_clean/3]).
-
-%% for internal use only
--export([proto_info/2]).
-
--include("rebar.hrl").
-
-%% ===================================================================
-%% Public API
-%% ===================================================================
-
-key() ->
- gpb.
-
-proto_compile(Config, _AppFile, Files) ->
- %% Check for gpb library -- if it's not present, fail
- %% since we have.proto files that need building
- case gpb_is_present() of
- true ->
- GpbOpts = user_gpb_opts(Config),
- Targets = [filename:join("src", target_filename(F, GpbOpts))
- || F <- Files],
- rebar_base_compiler:run(Config, [],
- lists:zip(Files, Targets),
- fun compile_gpb/3,
- [{check_last_mod, true}]);
- false ->
- ?ERROR("The gpb library is not present in code path!\n", []),
- ?FAIL
- end.
-
-target_filename(ProtoFileName, GpbOpts) ->
- ModulePrefix = proplists:get_value(module_name_prefix, GpbOpts, ""),
- ModuleSuffix = proplists:get_value(module_name_suffix, GpbOpts, ""),
- Base = filename:basename(ProtoFileName, ".proto"),
- ModulePrefix ++ Base ++ ModuleSuffix ++ ".erl".
-
-proto_clean(Config, _AppFile, ProtoFiles) ->
- GpbOpts = user_gpb_opts(Config) ++ default_dest_opts(),
- rebar_file_utils:delete_each(
- [beam_file(F, GpbOpts) || F <- ProtoFiles]
- ++ [erl_file(F, GpbOpts) || F <- ProtoFiles]
- ++ [hrl_file(F, GpbOpts) || F <- ProtoFiles]),
- ok.
-
-%% ===================================================================
-%% Internal functions
-%% ===================================================================
-
-proto_info(help, compile) ->
- ?CONSOLE(
- " gpb_opts is passed as options to gpb_compile:file/2.~n"
- " erl_opts is used when compiling the generated erlang files,~n"
- " so you might want to add an include path to gpb here,~n"
- " for gpb.hrl, or else use the include_as_lib gpb_opts option,~n"
- " or the defs_as_proplists gpb_opts option.~n",
- []);
-proto_info(help, clean) ->
- ?CONSOLE("", []).
-
-gpb_is_present() ->
- code:which(gpb) =/= non_existing.
-
-user_gpb_opts(Config) ->
- rebar_config:get_local(Config, gpb_opts, []).
-
-default_dest_opts() ->
- [{o_erl, "src"}, {o_hrl, "include"}].
-
-compile_gpb(Source, _Target, Config) ->
- SourceFullPath = filename:absname(Source),
- GpbOpts = user_gpb_opts(Config) ++ default_dest_opts()
- ++ default_include_opts(SourceFullPath),
- ok = filelib:ensure_dir(filename:join("ebin", "dummy")),
- ok = filelib:ensure_dir(filename:join("include", "dummy")),
- case gpb_compile:file(SourceFullPath, GpbOpts) of
- ok ->
- ok;
- {error, Reason} ->
- ReasonStr = gpb_compile:format_error(Reason),
- ?ERROR("Failed to compile ~s: ~s~n", [SourceFullPath, ReasonStr]),
- ?FAIL
- end.
-
-default_include_opts(SourceFullPath) ->
- [{i,filename:dirname(SourceFullPath)}].
-
-beam_file(ProtoFile, GpbOpts) ->
- proto_filename_to_path("ebin", ProtoFile, ".beam", GpbOpts).
-
-erl_file(ProtoFile, GpbOpts) ->
- ErlOutDir = get_erl_outdir(GpbOpts),
- proto_filename_to_path(ErlOutDir, ProtoFile, ".erl", GpbOpts).
-
-hrl_file(ProtoFile, GpbOpts) ->
- HrlOutDir = get_hrl_outdir(GpbOpts),
- proto_filename_to_path(HrlOutDir, ProtoFile, ".hrl", GpbOpts).
-
-proto_filename_to_path(Dir, ProtoFile, NewExt, GpbOpts) ->
- BaseNoExt = filename:basename(ProtoFile, ".proto"),
- Prefix = proplists:get_value(module_name_prefix, GpbOpts, ""),
- Suffix = proplists:get_value(module_name_suffix, GpbOpts, ""),
- filename:join([Dir, Prefix ++ BaseNoExt ++ Suffix ++ NewExt]).
-
-get_erl_outdir(Opts) ->
- proplists:get_value(o_erl, Opts, get_outdir(Opts)).
-
-get_hrl_outdir(Opts) ->
- proplists:get_value(o_hrl, Opts, get_outdir(Opts)).
-
-get_outdir(Opts) ->
- proplists:get_value(o, Opts, ".").

View File

@ -0,0 +1,55 @@
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Wed, 2 Mar 2016 15:10:20 +0300
Subject: [PATCH] Remove pre-R15B02 workaround
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/src/rebar_eunit.erl b/src/rebar_eunit.erl
index 913f2f9..287cc84 100644
--- a/src/rebar_eunit.erl
+++ b/src/rebar_eunit.erl
@@ -435,18 +435,6 @@ get_beam_test_exports(ModuleStr) ->
end.
make_test_primitives(RawTests) ->
- %% Use {test,M,F} and {generator,M,F} if at least R15B02. Otherwise,
- %% use eunit_test:function_wrapper/2 fallback.
- %% eunit_test:function_wrapper/2 was renamed to eunit_test:mf_wrapper/2
- %% in R15B02; use that as >= R15B02 check.
- %% TODO: remove fallback and use only {test,M,F} and {generator,M,F}
- %% primitives once at least R15B02 is required.
- {module, eunit_test} = code:ensure_loaded(eunit_test),
- MakePrimitive = case erlang:function_exported(eunit_test, mf_wrapper, 2) of
- true -> fun eunit_primitive/3;
- false -> fun pre15b02_eunit_primitive/3
- end,
-
?CONSOLE(" Running test function(s):~n", []),
F = fun({M, F2}, Acc) ->
?CONSOLE(" ~p:~p/0~n", [M, F2]),
@@ -455,23 +443,15 @@ make_test_primitives(RawTests) ->
case re:run(FNameStr, "_test_") of
nomatch ->
%% Normal test
- MakePrimitive(test, M, F2);
+ {test, M, F2};
_ ->
%% Generator
- MakePrimitive(generator, M, F2)
+ {generator, M, F2}
end,
[NewFunction|Acc]
end,
lists:foldl(F, [], RawTests).
-eunit_primitive(Type, M, F) ->
- {Type, M, F}.
-
-pre15b02_eunit_primitive(test, M, F) ->
- eunit_test:function_wrapper(M, F);
-pre15b02_eunit_primitive(generator, M, F) ->
- {generator, eunit_test:function_wrapper(M, F)}.
-
%%
%% == run tests ==
%%

View File

@ -0,0 +1,22 @@
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Wed, 2 Mar 2016 13:52:44 +0300
Subject: [PATCH] No such function erlang:timestamp/0
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index 08f5b5f..348d06d 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -795,9 +795,9 @@ windows_temp_dir() ->
end.
rebar_now() ->
- case erlang:function_exported(erlang, timestamp, 0) of
+ case erlang:function_exported(os, timestamp, 0) of
true ->
- erlang:timestamp();
+ os:timestamp();
false ->
%% erlang:now/0 was deprecated in 18.0. One solution to avoid the
%% deprecation warning is to use

View File

@ -1 +1 @@
7591b36a97a3f91d978b914472628903 rebar-365ac649dc818619757f96a699ddb174f004cff9.tar.gz
1ae17dd671c0434012c7a688d4cf60e4 rebar-2.6.1.tar.gz