Allow skipping check for apps

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
This commit is contained in:
Peter Lemenkov 2016-03-07 17:05:03 +03:00
parent a537e470a7
commit 4d9f3c57db
3 changed files with 57 additions and 15 deletions

View File

@ -12,7 +12,7 @@
Name: erlang-%{realname}
Version: 2.6.1
Release: 8%{?dist}
Release: 9%{?dist}
Summary: Erlang Build Tools
Group: Development/Tools
License: MIT
@ -42,6 +42,9 @@ Patch10: rebar-0010-Remove-pre-R15B02-workaround.patch
Patch11: rebar-0011-No-such-function-erlang-timestamp-0.patch
# Fedora/EPEL-specific - allow vsn variable override
Patch12: rebar-0012-Try-shell-variable-VSN-first.patch
# Fedora/EPEL-specific - allow overriding missind deps error (versions
# mismatch)
Patch13: rebar-0013-Allow-ignoring-missing-deps.patch
%if 0%{?need_bootstrap} < 1
BuildRequires: erlang-rebar
@ -111,6 +114,7 @@ Erlang Build Tools.
%patch10 -p1 -b .remove_pre_R15B02
%patch11 -p1 -b .typo_fix
%patch12 -p1 -b .vsn_override
%patch13 -p1 -b .skip_deps_checking
%build
@ -139,10 +143,15 @@ cp -a priv %{buildroot}%{_erllibdir}/%{realname}-%{version}/
%doc README.md THANKS rebar.config.sample
%license LICENSE
%{_bindir}/rebar
%{_erllibdir}/%{realname}-%{version}
%{_erllibdir}/%{realname}-%{version}/
%changelog
* Mon Mar 7 2016 Peter Lemenkov <lemenkov@gmail.com> - 2.6.1-9
- Allow skipping check for apps (not recommended for the end users - we'll use
it only during rpm building so we won't introduce this functionality
officially).
* Sun Mar 6 2016 Peter Lemenkov <lemenkov@gmail.com> - 2.6.1-8
- Allow VSN override using shell environment variable of the same name.

View File

@ -7,16 +7,19 @@ app-file.
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index 348d06d..47975cb 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -268,7 +268,7 @@ vcs_vsn(Config, Vsn, Dir) ->
Cache = rebar_config:get_xconf(Config, vsn_cache),
case dict:find(Key, Cache) of
error ->
- VsnString = vcs_vsn_1(Vsn, Dir),
+ VsnString = case os:getenv("VSN") of false -> vcs_vsn_1(Vsn, Dir); V -> V end,
Cache1 = dict:store(Key, VsnString, Cache),
Config1 = rebar_config:set_xconf(Config, vsn_cache, Cache1),
{Config1, VsnString};
diff --git a/src/rebar_otp_app.erl b/src/rebar_otp_app.erl
index b3566c8..187b1c3 100644
--- a/src/rebar_otp_app.erl
+++ b/src/rebar_otp_app.erl
@@ -116,7 +116,10 @@ preprocess(Config, AppSrcFile) ->
%% AppSrcFile may contain instructions for generating a vsn number
- {Config2, Vsn} = rebar_app_utils:app_vsn(Config1, AppSrcFile),
+ {Config2, Vsn} = case os:getenv("VSN") of
+ false -> rebar_app_utils:app_vsn(Config1, AppSrcFile);
+ V -> {Config1, V}
+ end,
A2 = lists:keystore(vsn, 1, A1, {vsn, Vsn}),
%% systools:make_relup/4 fails with {missing_param, registered}

View File

@ -0,0 +1,30 @@
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Mon, 7 Mar 2016 16:55:33 +0300
Subject: [PATCH] Allow ignoring missing deps
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl
index ba2b4e8..0f90e0f 100644
--- a/src/rebar_deps.erl
+++ b/src/rebar_deps.erl
@@ -160,12 +160,17 @@ do_check_deps(Config) ->
{Config1, {AvailDeps, []}} ->
%% No missing deps
{Config1, AvailDeps};
- {_Config1, {_, MissingDeps}} ->
+ {Config1, {AvailDeps, MissingDeps}} ->
lists:foreach(fun (#dep{app=App, vsn_regex=Vsn, source=Src}) ->
?CONSOLE("Dependency not available: "
"~p-~s (~p)\n", [App, Vsn, Src])
end, MissingDeps),
- ?FAIL
+ case os:getenv("IGNORE_MISSING_DEPS") of
+ false -> ?FAIL;
+ _ ->
+ ?CONSOLE("Continue anyway because IGNORE_MISSING_DEPS was set\n", []),
+ {Config1, lists:sort(AvailDeps ++ MissingDeps)}
+ end
end.
'check-deps'(Config, _) ->