3
0
Fork 0
forked from mirrors/nixpkgs

rebar3: 3.3.2 -> 3.4.3

This commit is contained in:
Gleb Peregud 2017-09-10 23:26:00 +02:00
parent 90b3d2db91
commit adbc1ed0d9
7 changed files with 89 additions and 249 deletions

View file

@ -2,14 +2,15 @@
stdenv.mkDerivation rec {
name = "hex-registry";
rev = "e5e494a";
rev = "9f736e7";
version = "0.0.0+build.${rev}";
# src = /home/gleber/code/erl/hex-pm-registry-snapshots;
src = fetchFromGitHub {
owner = "erlang-nix";
repo = "hex-pm-registry-snapshots";
inherit rev;
sha256 = "0877dragfxs22a05d8mv42z5535kfx9rs4y7fwwbd1ybphczf8za";
sha256 = "1xiw5yifyk3bbmr0cr82y1nc4c6zk11f6azdv07glb7yrgccrv79";
};
installPhase = ''

View file

@ -1,10 +1,10 @@
{stdenv, fetchFromGitHub, writeText, elixir }:
{ stdenv, fetchFromGitHub, writeText, elixir }:
let
shell = drv: stdenv.mkDerivation {
name = "interactive-shell-${drv.name}";
buildInputs = [ drv ];
};
name = "interactive-shell-${drv.name}";
buildInputs = [ drv ];
};
pkg = self: stdenv.mkDerivation rec {
name = "hex";
@ -53,6 +53,5 @@ let
passthru = {
env = shell self;
};
};
in stdenv.lib.fix pkg

View file

@ -2,9 +2,9 @@
let
shell = drv: stdenv.mkDerivation {
name = "interactive-shell-${drv.name}";
buildInputs = [ drv ];
};
name = "interactive-shell-${drv.name}";
buildInputs = [ drv ];
};
pkg = self: stdenv.mkDerivation rec {
name = "webdriver";

View file

@ -3,64 +3,64 @@
tree, fetchFromGitHub, hexRegistrySnapshot }:
let
version = "3.3.2";
version = "3.4.3";
bootstrapper = ./rebar3-nix-bootstrap;
bbmustache = fetchHex {
pkg = "bbmustache";
version = "1.3.0";
sha256 = "042pfgss8kscq6ssg8gix8ccmdsrx0anjczsbrn2a6c36ljrx2p6";
erlware_commons = fetchHex {
pkg = "erlware_commons";
version = "1.0.0";
sha256 = "0wkphbrjk19lxdwndy92v058qwcaz13bcgdzp33h21aa7vminzx7";
};
ssl_verify_fun = fetchHex {
pkg = "ssl_verify_fun";
version = "1.1.2";
sha256 = "0qdyx70v09fydv4wzz1djnkixqj62ny40yjjhv2q6mh47lns2arj";
};
certifi = fetchHex {
pkg = "certifi";
version = "0.4.0";
sha256 = "04bnvsbssdcf6b9h9bfglflds7j0gx6q5igl1xxhx6fnwaz37hhw";
};
cf = fetchHex {
pkg = "cf";
version = "0.2.1";
sha256 = "19d0yvg8wwa57cqhn3vqfvw978nafw8j2rvb92s3ryidxjkrmvms";
};
cth_readable = fetchHex {
pkg = "cth_readable";
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";
version = "2.0.0";
sha256 = "075v7cvny52jbhnskchd3fp68fxgp7qfvdls0haamcycxrn0dipx";
};
providers = fetchHex {
pkg = "providers";
version = "1.6.0";
sha256 = "0byfa1h57n46jilz4q132j0vk3iqc0v1vip89li38gb1k997cs0g";
};
ssl_verify_fun = fetchHex {
pkg = "ssl_verify_fun";
version = "1.1.1";
sha256 = "0pnnan9xf4r6pr34hi28zdyv501i39jwnrwk6pr9r4wabkmhb22g";
getopt = fetchHex {
pkg = "getopt";
version = "0.8.2";
sha256 = "1xw30h59zbw957cyjd8n50hf9y09jnv9dyry6x3avfwzcyrnsvkk";
};
bbmustache = fetchHex {
pkg = "bbmustache";
version = "1.3.0";
sha256 = "042pfgss8kscq6ssg8gix8ccmdsrx0anjczsbrn2a6c36ljrx2p6";
};
relx = fetchHex {
pkg = "relx";
version = "3.21.1";
sha256 = "00590aqy0rfzgsnzxqgwbmn90imxxqlzmnmapy6bq76vw2rynvb8";
version = "3.23.1";
sha256 = "13j7wds2d7b8v3r9pwy3zhwhzywgwhn6l9gm3slqzyrs1jld0a9d";
};
cf = fetchHex {
pkg = "cf";
version = "0.2.2";
sha256 = "08cvy7skn5d2k4manlx5k3anqgjdvajjhc5jwxbaszxw34q3na28";
};
cth_readable = fetchHex {
pkg = "cth_readable";
version = "1.3.0";
sha256 = "1s7bqj6f2zpbyjmbfq2mm6vcz1jrxjr2nd0531wshsx6fnshqhvs";
};
eunit_formatters = fetchHex {
pkg = "eunit_formatters";
version = "0.3.1";
sha256 = "0cg9dasv60v09q3q4wja76pld0546mhmlpb0khagyylv890hg934";
};
rebar3_hex = fetchHex {
pkg = "rebar3_hex";
version = "1.12.0";
sha256 = "45467e93ae8d776c6038fdaeaffbc55d8f2f097f300a54dab9b81c6d1cf21f73";
version = "4.0.0";
sha256 = "0k0ykx1lz62r03dpbi2zxsvrxgnr5hj67yky0hjrls09ynk4682v";
};
in
@ -70,22 +70,20 @@ stdenv.mkDerivation {
src = fetchurl {
url = "https://github.com/rebar/rebar3/archive/${version}.tar.gz";
sha256 = "14nhc1bmna3b4y9qmd0lzpi0jdaw92r7ljg7vlghn297awsjgg6c";
sha256 = "1a05gpxxc3mx5v33kzpb5xnq5vglmjl0q8hrcvpinjlazcwbg531";
};
inherit bootstrapper;
patches = if hermeticRebar3 == true
then [ ./hermetic-bootstrap.patch ./hermetic-rebar3.patch ]
then [ ./hermetic-rebar3.patch ]
else [];
buildInputs = [ erlang tree ];
propagatedBuildInputs = [ hexRegistrySnapshot ];
postPatch = ''
echo postPatch
${erlang}/bin/escript ${bootstrapper} registry-only
echo "$ERL_LIBS"
mkdir -p _build/default/lib/
mkdir -p _build/default/plugins
cp --no-preserve=mode -R ${erlware_commons} _build/default/lib/erlware_commons

View file

@ -1,169 +0,0 @@
diff --git a/bootstrap b/bootstrap
index c36fddb..9fcb718 100755
--- a/bootstrap
+++ b/bootstrap
@@ -7,9 +7,11 @@ main(_) ->
application:start(asn1),
application:start(public_key),
application:start(ssl),
- inets:start(),
- inets:start(httpc, [{profile, rebar}]),
- set_httpc_options(),
+ %% Removed for hermeticity on Nix
+ %%
+ %% inets:start(),
+ %% inets:start(httpc, [{profile, rebar}]),
+ %% set_httpc_options(),
%% Fetch and build deps required to build rebar3
BaseDeps = [{providers, []}
@@ -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) ->
- 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,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://repo.hex.pm/tarballs",
- Package = binary_to_list(<<Name/binary, "-", Vsn/binary, ".tar">>),
- Url = string:join([CDN, Package], "/"),
- case request(Url) of
- {ok, Binary} ->
- {ok, Contents} = extract(Binary),
- ok = erl_tar:extract({binary, Contents}, [{cwd, Dir}, compressed]);
- _ ->
- io:format("Error: Unable to fetch package ~p ~p~n", [Name, Vsn])
- end;
- true ->
- io:format("Dependency ~s already exists~n", [Name])
- end.
-
-extract(Binary) ->
- {ok, Files} = erl_tar:extract({binary, Binary}, [memory]),
- {"contents.tar.gz", Contents} = lists:keyfind("contents.tar.gz", 1, Files),
- {ok, Contents}.
-
-request(Url) ->
- case httpc:request(get, {Url, []},
- [{relaxed, true}],
- [{body_format, binary}],
- rebar) of
- {ok, {{_Version, 200, _Reason}, _Headers, Body}} ->
- {ok, Body};
- Error ->
- Error
- end.
-
-get_rebar_config() ->
- {ok, [[Home]]} = init:get_argument(home),
- ConfDir = filename:join(Home, ".config/rebar3"),
- case file:consult(filename:join(ConfDir, "rebar.config")) of
- {ok, Config} ->
- Config;
- _ ->
- []
- end.
-
-get_http_vars(Scheme) ->
- 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)),
- set_httpc_options(proxy, get_http_vars(http_proxy)).
-
-set_httpc_options(_, []) ->
- ok;
-
-set_httpc_options(Scheme, Proxy) ->
- {ok, {_, _, Host, Port, _, _}} = http_uri:parse(Proxy),
- httpc:set_options([{Scheme, {{Host, Port}, []}}], rebar).
+%% fetch({pkg, Name, Vsn}, App) ->
+%% Dir = filename:join([filename:absname("_build/default/lib/"), App]),
+%% case filelib:is_dir(Dir) of
+%% false ->
+%% CDN = "https://repo.hex.pm/tarballs",
+%% Package = binary_to_list(<<Name/binary, "-", Vsn/binary, ".tar">>),
+%% Url = string:join([CDN, Package], "/"),
+%% case request(Url) of
+%% {ok, Binary} ->
+%% {ok, Contents} = extract(Binary),
+%% ok = erl_tar:extract({binary, Contents}, [{cwd, Dir}, compressed]);
+%% _ ->
+%% io:format("Error: Unable to fetch package ~p ~p~n", [Name, Vsn])
+%% end;
+%% true ->
+%% io:format("Dependency ~s already exists~n", [Name])
+%% end.
+
+%% extract(Binary) ->
+%% {ok, Files} = erl_tar:extract({binary, Binary}, [memory]),
+%% {"contents.tar.gz", Contents} = lists:keyfind("contents.tar.gz", 1, Files),
+%% {ok, Contents}.
+
+%% request(Url) ->
+%% case httpc:request(get, {Url, []},
+%% [{relaxed, true}],
+%% [{body_format, binary}],
+%% rebar) of
+%% {ok, {{_Version, 200, _Reason}, _Headers, Body}} ->
+%% {ok, Body};
+%% Error ->
+%% Error
+%% end.
+
+%% get_rebar_config() ->
+%% {ok, [[Home]]} = init:get_argument(home),
+%% ConfDir = filename:join(Home, ".config/rebar3"),
+%% case file:consult(filename:join(ConfDir, "rebar.config")) of
+%% {ok, Config} ->
+%% Config;
+%% _ ->
+%% []
+%% end.
+
+%% get_http_vars(Scheme) ->
+%% 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)),
+%% set_httpc_options(proxy, get_http_vars(http_proxy)).
+
+%% set_httpc_options(_, []) ->
+%% ok;
+
+%% 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,22 +1,16 @@
diff --git a/src/rebar3.erl b/src/rebar3.erl
index 47dc25a..edda250 100644
--- a/src/rebar3.erl
+++ b/src/rebar3.erl
@@ -304,9 +304,11 @@ start_and_load_apps(Caller) ->
ensure_running(crypto, Caller),
ensure_running(asn1, Caller),
ensure_running(public_key, Caller),
- ensure_running(ssl, Caller),
- inets:start(),
- inets:start(httpc, [{profile, rebar}]).
+ ensure_running(ssl, Caller).
+%% Removed due to the hermicity requirements of Nix
+%%
+%% inets:start(),
+%% inets:start(httpc, [{profile, rebar}]).
diff --git a/bootstrap b/bootstrap
index 7c56bab..16c1be5 100755
--- a/bootstrap
+++ b/bootstrap
@@ -101,7 +101,7 @@ extract(Binary) ->
request(Url) ->
HttpOptions = [{relaxed, true} | get_proxy_auth()],
ensure_running(App, Caller) ->
case application:start(App) of
- case httpc:request(get, {Url, []},
+ case rebar_hermeticity:request(get, {Url, []},
HttpOptions,
[{body_format, binary}],
rebar) of
diff --git a/src/rebar_hermeticity.erl b/src/rebar_hermeticity.erl
new file mode 100644
index 0000000..8f6cc7d
@ -66,23 +60,32 @@ index 0000000..8f6cc7d
+ ?ERROR("Request: ~p ~s", [Method, Url]),
+ erlang:halt(1).
diff --git a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl
index 5817817..2ea1703 100644
index d588f24..9ac8ad4 100644
--- a/src/rebar_pkg_resource.erl
+++ b/src/rebar_pkg_resource.erl
@@ -107,7 +107,7 @@ make_vsn(_) ->
{error, "Replacing version of type pkg not supported."}.
@@ -109,7 +109,7 @@ make_vsn(_) ->
request(Url, ETag) ->
HttpOptions = [{ssl, ssl_opts(Url)}, {relaxed, true} | rebar_utils:get_proxy_auth()],
- case httpc: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}],
HttpOptions,
[{body_format, binary}],
rebar) of
diff --git a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl
index 75c609e..4283c23 100644
index a019c5a..697cbab 100644
--- a/src/rebar_prv_update.erl
+++ b/src/rebar_prv_update.erl
@@ -52,7 +52,7 @@ do(State) ->
@@ -38,6 +38,8 @@ init(State) ->
{ok, State1}.
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
+do(State) -> {ok, State}.
+-ifdef(non_hermetic).
do(State) ->
try
case rebar_packages:registry_dir(State) of
@@ -52,7 +54,7 @@ do(State) ->
case rebar_utils:url_append_path(CDN, ?REMOTE_REGISTRY_FILE) of
{ok, Url} ->
?DEBUG("Fetching registry from ~p", [Url]),
@ -91,3 +94,11 @@ index 75c609e..4283c23 100644
[], [{stream, TmpFile}, {sync, true}],
rebar) of
{ok, saved_to_file} ->
@@ -76,6 +78,7 @@ do(State) ->
?DEBUG("Error creating package index: ~p ~p", [C, erlang:get_stacktrace()]),
throw(?PRV_ERROR(package_index_write))
end.
+-endif.
-spec format_error(any()) -> iolist().
format_error({package_parse_cdn, Uri}) ->

View file

@ -94,7 +94,7 @@ bootstrap_plugins(#data{plugins = Plugins}) ->
-spec bootstrap_libs(#data{}) -> ok.
bootstrap_libs(#data{erl_libs = ErlLibs}) ->
io:format("Bootstrapping dependent librariesXXXX~n"),
io:format("Bootstrapping dependent libraries~n"),
Target = "_build/default/lib/",
Paths = string:tokens(ErlLibs, ":"),
CopiableFiles =