rebar3: 3.1.0 -> 3.3.2

This commit is contained in:
Eric Bailey 2016-11-23 15:06:15 -06:00 committed by Tuomas Tynkkynen
parent 41256881bf
commit fe727a19c1
3 changed files with 81 additions and 71 deletions

View File

@ -3,45 +3,20 @@
tree, fetchFromGitHub, hexRegistrySnapshot }:
let
version = "3.1.0";
version = "3.3.2";
bootstrapper = ./rebar3-nix-bootstrap;
erlware_commons = fetchHex {
pkg = "erlware_commons";
version = "0.19.0";
sha256 = "1gfsy9bbhjb94c5ghff2niamn93x2x08lnklh6pp7sfr5i0gkgsv";
};
ssl_verify_hostname = fetchHex {
pkg = "ssl_verify_hostname";
version = "1.0.5";
sha256 = "1gzavzqzljywx4l59gvhkjbr1dip4kxzjjz1s4wsn42f2kk13jzj";
bbmustache = fetchHex {
pkg = "bbmustache";
version = "1.3.0";
sha256 = "042pfgss8kscq6ssg8gix8ccmdsrx0anjczsbrn2a6c36ljrx2p6";
};
certifi = fetchHex {
pkg = "certifi";
version = "0.4.0";
sha256 = "04bnvsbssdcf6b9h9bfglflds7j0gx6q5igl1xxhx6fnwaz37hhw";
};
providers = fetchHex {
pkg = "providers";
version = "1.6.0";
sha256 = "0byfa1h57n46jilz4q132j0vk3iqc0v1vip89li38gb1k997cs0g";
};
getopt = fetchHex {
pkg = "getopt";
version = "0.8.2";
sha256 = "1xw30h59zbw957cyjd8n50hf9y09jnv9dyry6x3avfwzcyrnsvkk";
};
bbmustache = fetchHex {
pkg = "bbmustache";
version = "1.0.4";
sha256 = "04lvwm7f78x8bys0js33higswjkyimbygp4n72cxz1kfnryx9c03";
};
relx = fetchHex {
pkg = "relx";
version = "3.17.0";
sha256 = "1xjybi93m8gj9f9z3lkc7xbg3k5cw56yl78rcz5qfirr0223sby2";
};
cf = fetchHex {
pkg = "cf";
version = "0.2.1";
@ -49,14 +24,39 @@ let
};
cth_readable = fetchHex {
pkg = "cth_readable";
version = "1.2.2";
sha256 = "0kb9v4998liwyidpjkhcg1nin6djjzxcx6b313pbjicbp4r58n3p";
version = "1.2.3";
sha256 = "0wfpfismzi2q0nzvx9qyllch4skwmsk6yqffw8iw2v48ssbfvfhz";
};
erlware_commons = fetchHex {
pkg = "erlware_commons";
version = "0.21.0";
sha256 = "0gxb011m637rca2g0vhm1q9krm3va50rz1py6zf8k92q4iv9a2p7";
};
eunit_formatters = fetchHex {
pkg = "eunit_formatters";
version = "0.3.1";
sha256 = "0cg9dasv60v09q3q4wja76pld0546mhmlpb0khagyylv890hg934";
};
getopt = fetchHex {
pkg = "getopt";
version = "0.8.2";
sha256 = "1xw30h59zbw957cyjd8n50hf9y09jnv9dyry6x3avfwzcyrnsvkk";
};
providers = fetchHex {
pkg = "providers";
version = "1.6.0";
sha256 = "0byfa1h57n46jilz4q132j0vk3iqc0v1vip89li38gb1k997cs0g";
};
ssl_verify_fun = fetchHex {
pkg = "ssl_verify_fun";
version = "1.1.1";
sha256 = "0pnnan9xf4r6pr34hi28zdyv501i39jwnrwk6pr9r4wabkmhb22g";
};
relx = fetchHex {
pkg = "relx";
version = "3.21.1";
sha256 = "00590aqy0rfzgsnzxqgwbmn90imxxqlzmnmapy6bq76vw2rynvb8";
};
rebar3_hex = fetchHex {
pkg = "rebar3_hex";
version = "1.12.0";
@ -70,7 +70,7 @@ stdenv.mkDerivation {
src = fetchurl {
url = "https://github.com/rebar/rebar3/archive/${version}.tar.gz";
sha256 = "0r4wpnpi81ha4iirv9hcif3vrgc82qd51kah7rnhvpym55wcy9ml";
sha256 = "14nhc1bmna3b4y9qmd0lzpi0jdaw92r7ljg7vlghn297awsjgg6c";
};
inherit bootstrapper;
@ -97,7 +97,7 @@ stdenv.mkDerivation {
cp --no-preserve=mode -R ${cth_readable} _build/default/lib/cth_readable
cp --no-preserve=mode -R ${eunit_formatters} _build/default/lib/eunit_formatters
cp --no-preserve=mode -R ${relx} _build/default/lib/relx
cp --no-preserve=mode -R ${ssl_verify_hostname} _build/default/lib/ssl_verify_hostname
cp --no-preserve=mode -R ${ssl_verify_fun} _build/default/lib/ssl_verify_fun
cp --no-preserve=mode -R ${rebar3_hex} _build/default/plugins/rebar3_hex
'';

View File

@ -1,5 +1,5 @@
diff --git a/bootstrap b/bootstrap
index 35759b0..939c838 100755
index c36fddb..9fcb718 100755
--- a/bootstrap
+++ b/bootstrap
@@ -7,9 +7,11 @@ main(_) ->
@ -9,42 +9,44 @@ index 35759b0..939c838 100755
- inets:start(),
- inets:start(httpc, [{profile, rebar}]),
- set_httpc_options(),
+ %% Removed for hermeticity on Nix
+ %% Removed for hermeticity on Nix
+ %%
+ %% inets:start(),
+ %% inets:start(httpc, [{profile, rebar}]),
+ %% set_httpc_options(),
+ %% inets:start(),
+ %% inets:start(httpc, [{profile, rebar}]),
+ %% set_httpc_options(),
%% Fetch and build deps required to build rebar3
BaseDeps = [{providers, []}
@@ -74,12 +76,12 @@ default_registry_file() ->
@@ -73,13 +75,13 @@ default_registry_file() ->
CacheDir = filename:join([Home, ".cache", "rebar3"]),
filename:join([CacheDir, "hex", "default", "registry"]).
fetch_and_compile({Name, ErlFirstFiles}, Deps) ->
-fetch_and_compile({Name, ErlFirstFiles}, Deps) ->
- case lists:keyfind(Name, 1, Deps) of
- {Name, Vsn} ->
- ok = fetch({pkg, atom_to_binary(Name, utf8), list_to_binary(Vsn)}, Name);
- {Name, _, Source} ->
- ok = fetch(Source, Name)
- end,
+fetch_and_compile({Name, ErlFirstFiles}, _Deps) ->
+ %% case lists:keyfind(Name, 1, Deps) of
+ %% {Name, Vsn} ->
+ %% ok = fetch({pkg, atom_to_binary(Name, utf8), list_to_binary(Vsn)}, Name);
+ %% {Name, _, Source} ->
+ %% ok = fetch(Source, Name)
+ %% end,
%% Hack: erlware_commons depends on a .script file to check if it is being built with
%% rebar2 or rebar3. But since rebar3 isn't built yet it can't get the vsn with get_key.
@@ -88,63 +90,63 @@ fetch_and_compile({Name, ErlFirstFiles}, Deps) ->
@@ -88,67 +90,67 @@ fetch_and_compile({Name, ErlFirstFiles}, Deps) ->
compile(Name, ErlFirstFiles).
-fetch({pkg, Name, Vsn}, App) ->
- Dir = filename:join([filename:absname("_build/default/lib/"), App]),
- case filelib:is_dir(Dir) of
- false ->
- CDN = "https://s3.amazonaws.com/s3.hex.pm/tarballs",
- CDN = "https://repo.hex.pm/tarballs",
- Package = binary_to_list(<<Name/binary, "-", Vsn/binary, ".tar">>),
- Url = string:join([CDN, Package], "/"),
- case request(Url) of
@ -85,7 +87,11 @@ index 35759b0..939c838 100755
- end.
-
-get_http_vars(Scheme) ->
- proplists:get_value(Scheme, get_rebar_config(), []).
- OS = case os:getenv(atom_to_list(Scheme)) of
- Str when is_list(Str) -> Str;
- _ -> []
- end,
- proplists:get_value(Scheme, get_rebar_config(), OS).
-
-set_httpc_options() ->
- set_httpc_options(https_proxy, get_http_vars(https_proxy)),
@ -101,7 +107,7 @@ index 35759b0..939c838 100755
+%% Dir = filename:join([filename:absname("_build/default/lib/"), App]),
+%% case filelib:is_dir(Dir) of
+%% false ->
+%% CDN = "https://s3.amazonaws.com/s3.hex.pm/tarballs",
+%% CDN = "https://repo.hex.pm/tarballs",
+%% Package = binary_to_list(<<Name/binary, "-", Vsn/binary, ".tar">>),
+%% Url = string:join([CDN, Package], "/"),
+%% case request(Url) of
@ -142,7 +148,11 @@ index 35759b0..939c838 100755
+%% end.
+
+%% get_http_vars(Scheme) ->
+%% proplists:get_value(Scheme, get_rebar_config(), []).
+%% OS = case os:getenv(atom_to_list(Scheme)) of
+%% Str when is_list(Str) -> Str;
+%% _ -> []
+%% end,
+%% proplists:get_value(Scheme, get_rebar_config(), OS).
+
+%% set_httpc_options() ->
+%% set_httpc_options(https_proxy, get_http_vars(https_proxy)),
@ -154,6 +164,6 @@ index 35759b0..939c838 100755
+%% set_httpc_options(Scheme, Proxy) ->
+%% {ok, {_, _, Host, Port, _, _}} = http_uri:parse(Proxy),
+%% httpc:set_options([{Scheme, {{Host, Port}, []}}], rebar).
compile(App, FirstFiles) ->
Dir = filename:join(filename:absname("_build/default/lib/"), App),

View File

@ -1,8 +1,8 @@
diff a/src/rebar3.erl b/src/rebar3.erl
index c1a1ae4..1bf1ea0 100644
diff --git a/src/rebar3.erl b/src/rebar3.erl
index 47dc25a..edda250 100644
--- a/src/rebar3.erl
+++ b/src/rebar3.erl
@@ -294,9 +294,11 @@ start_and_load_apps(Caller) ->
@@ -304,9 +304,11 @@ start_and_load_apps(Caller) ->
ensure_running(crypto, Caller),
ensure_running(asn1, Caller),
ensure_running(public_key, Caller),
@ -12,16 +12,16 @@ index c1a1ae4..1bf1ea0 100644
+ ensure_running(ssl, Caller).
+%% Removed due to the hermicity requirements of Nix
+%%
+%% inets:start(),
+%% inets:start(httpc, [{profile, rebar}]).
+%% inets:start(),
+%% inets:start(httpc, [{profile, rebar}]).
ensure_running(App, Caller) ->
case application:start(App) of
diff a/src/rebar_hermicity.erl b/src/rebar_hermicity.erl
diff --git a/src/rebar_hermeticity.erl b/src/rebar_hermeticity.erl
new file mode 100644
index 0000000..d814e2a
index 0000000..8f6cc7d
--- /dev/null
+++ b/src/rebar_hermicity.erl
+++ b/src/rebar_hermeticity.erl
@@ -0,0 +1,42 @@
+%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
+%% ex: ts=4 sw=4 et
@ -49,7 +49,7 @@ index 0000000..d814e2a
+%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+%% THE SOFTWARE.
+%% -------------------------------------------------------------------
+-module(rebar_hermicity).
+-module(rebar_hermeticity).
+
+-export([request/5]).
+
@ -63,23 +63,23 @@ index 0000000..d814e2a
+ ?ERROR("A request is being made that violates Nix hermicity "
+ "This request has been stopped. Details of the request "
+ "are as follows:", []),
+ ?ERROR("Requesnt: ~p ~s", [Method, Url]),
+ ?ERROR("Request: ~p ~s", [Method, Url]),
+ erlang:halt(1).
diff a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl
index ec7e09d..03be343 100644
diff --git a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl
index 5817817..2ea1703 100644
--- a/src/rebar_pkg_resource.erl
+++ b/src/rebar_pkg_resource.erl
@@ -104,7 +104,7 @@ make_vsn(_) ->
@@ -107,7 +107,7 @@ make_vsn(_) ->
{error, "Replacing version of type pkg not supported."}.
request(Url, ETag) ->
- case httpc:request(get, {Url, [{"if-none-match", ETag} || ETag =/= false]++[{"User-Agent", rebar_utils:user_agent()}]},
+ case rebar_hermicity:request(get, {Url, [{"if-none-match", ETag} || ETag =/= false]++[{"User-Agent", rebar_utils:user_agent()}]},
+ case rebar_hermeticity:request(get, {Url, [{"if-none-match", ETag} || ETag =/= false]++[{"User-Agent", rebar_utils:user_agent()}]},
[{ssl, ssl_opts(Url)}, {relaxed, true}],
[{body_format, binary}],
rebar) of
diff a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl
index 5e1e253..ea25b9e 100644
diff --git a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl
index 75c609e..4283c23 100644
--- a/src/rebar_prv_update.erl
+++ b/src/rebar_prv_update.erl
@@ -52,7 +52,7 @@ do(State) ->
@ -87,7 +87,7 @@ index 5e1e253..ea25b9e 100644
{ok, Url} ->
?DEBUG("Fetching registry from ~p", [Url]),
- case httpc:request(get, {Url, [{"User-Agent", rebar_utils:user_agent()}]},
+ case rebar_hermicity:request(get, {Url, [{"User-Agent", rebar_utils:user_agent()}]},
+ case rebar_hermeticity:request(get, {Url, [{"User-Agent", rebar_utils:user_agent()}]},
[], [{stream, TmpFile}, {sync, true}],
rebar) of
{ok, saved_to_file} ->