mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-16 06:47:09 +03:00
rebar3: 3.0.0-beta.4 -> 3.1.0
This commit is contained in:
parent
f36be6edbf
commit
658a49b81d
@ -3,16 +3,16 @@
|
||||
tree, fetchFromGitHub, hexRegistrySnapshot }:
|
||||
|
||||
let
|
||||
version = "3.0.0-beta.4";
|
||||
version = "3.1.0";
|
||||
|
||||
bootstrapper = ./rebar3-nix-bootstrap;
|
||||
|
||||
# TODO: all these below probably should go into nixpkgs.erlangModules.sources.*
|
||||
# {erlware_commons, "0.16.0"},
|
||||
# {erlware_commons, "0.19.0"},
|
||||
erlware_commons = fetchHex {
|
||||
pkg = "erlware_commons";
|
||||
version = "0.16.0";
|
||||
sha256 = "0kh24d0001390wfx28d0xa874vrsfvjgj41g315vg4hac632krxx";
|
||||
version = "0.19.0";
|
||||
sha256 = "1gfsy9bbhjb94c5ghff2niamn93x2x08lnklh6pp7sfr5i0gkgsv";
|
||||
};
|
||||
# {ssl_verify_hostname, "1.0.5"},
|
||||
ssl_verify_hostname = fetchHex {
|
||||
@ -20,17 +20,17 @@ let
|
||||
version = "1.0.5";
|
||||
sha256 = "1gzavzqzljywx4l59gvhkjbr1dip4kxzjjz1s4wsn42f2kk13jzj";
|
||||
};
|
||||
# {certifi, "0.1.1"},
|
||||
# {certifi, "0.4.0"},
|
||||
certifi = fetchHex {
|
||||
pkg = "certifi";
|
||||
version = "0.1.1";
|
||||
sha256 = "0afylwqg74gprbg116asz0my2nipmki0512c8mdiq6xdiyjdvlg6";
|
||||
version = "0.4.0";
|
||||
sha256 = "04bnvsbssdcf6b9h9bfglflds7j0gx6q5igl1xxhx6fnwaz37hhw";
|
||||
};
|
||||
# {providers, "1.5.0"},
|
||||
# {providers, "1.6.0"},
|
||||
providers = fetchHex {
|
||||
pkg = "providers";
|
||||
version = "1.5.0";
|
||||
sha256 = "1hc8sp2l1mmx9dfpmh1f8j9hayfg7541rmx05wb9cmvxvih7zyvf";
|
||||
version = "1.6.0";
|
||||
sha256 = "0byfa1h57n46jilz4q132j0vk3iqc0v1vip89li38gb1k997cs0g";
|
||||
};
|
||||
# {getopt, "0.8.2"},
|
||||
getopt = fetchHex {
|
||||
@ -44,11 +44,11 @@ let
|
||||
version = "1.0.4";
|
||||
sha256 = "04lvwm7f78x8bys0js33higswjkyimbygp4n72cxz1kfnryx9c03";
|
||||
};
|
||||
# {relx, "3.8.0"},
|
||||
# {relx, "3.17.0"},
|
||||
relx = fetchHex {
|
||||
pkg = "relx";
|
||||
version = "3.8.0";
|
||||
sha256 = "0y89iirjz3kc1rzkdvc6p3ssmwcm2hqgkklhgm4pkbc14fcz57hq";
|
||||
version = "3.17.0";
|
||||
sha256 = "1xjybi93m8gj9f9z3lkc7xbg3k5cw56yl78rcz5qfirr0223sby2";
|
||||
};
|
||||
# {cf, "0.2.1"},
|
||||
cf = fetchHex {
|
||||
@ -56,19 +56,19 @@ let
|
||||
version = "0.2.1";
|
||||
sha256 = "19d0yvg8wwa57cqhn3vqfvw978nafw8j2rvb92s3ryidxjkrmvms";
|
||||
};
|
||||
# {cth_readable, "1.1.0"},
|
||||
# {cth_readable, "1.2.2"},
|
||||
cth_readable = fetchHex {
|
||||
pkg = "cth_readable";
|
||||
version = "1.0.1";
|
||||
sha256 = "1cnc4fbypckqllfi5h73rdb24dz576k3177gzvp1kbymwkp1xcz1";
|
||||
version = "1.2.2";
|
||||
sha256 = "0kb9v4998liwyidpjkhcg1nin6djjzxcx6b313pbjicbp4r58n3p";
|
||||
};
|
||||
# {eunit_formatters, "0.2.0"}
|
||||
# {eunit_formatters, "0.3.1"}
|
||||
eunit_formatters = fetchHex {
|
||||
pkg = "eunit_formatters";
|
||||
version = "0.2.0";
|
||||
sha256 = "03kiszlbgzscfd2ns7na6bzbfzmcqdb5cx3p6qy3657jk2fai332";
|
||||
version = "0.3.1";
|
||||
sha256 = "0cg9dasv60v09q3q4wja76pld0546mhmlpb0khagyylv890hg934";
|
||||
};
|
||||
# {eunit_formatters, "0.2.0"}
|
||||
# {rebar3_hex, "1.12.0"}
|
||||
rebar3_hex = fetchHex {
|
||||
pkg = "rebar3_hex";
|
||||
version = "1.12.0";
|
||||
@ -82,7 +82,7 @@ stdenv.mkDerivation {
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/rebar/rebar3/archive/${version}.tar.gz";
|
||||
sha256 = "0px66scjdia9aaa5z36qzxb848r56m0k98g0bxw065a2narsh4xy";
|
||||
sha256 = "0r4wpnpi81ha4iirv9hcif3vrgc82qd51kah7rnhvpym55wcy9ml";
|
||||
};
|
||||
|
||||
inherit bootstrapper;
|
||||
|
@ -1,39 +1,61 @@
|
||||
diff --git a/bootstrap b/bootstrap
|
||||
index 25bd658..b2a986b 100755
|
||||
index 35759b0..939c838 100755
|
||||
--- a/bootstrap
|
||||
+++ b/bootstrap
|
||||
@@ -8,9 +8,6 @@ main(_Args) ->
|
||||
@@ -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, []}
|
||||
@@ -33,7 +30,6 @@ main(_Args) ->
|
||||
|
||||
setup_env(),
|
||||
os:putenv("REBAR_PROFILE", "bootstrap"),
|
||||
- rebar3:run(["update"]),
|
||||
{ok, State} = rebar3:run(["compile"]),
|
||||
reset_env(),
|
||||
os:putenv("REBAR_PROFILE", ""),
|
||||
@@ -71,33 +67,7 @@ fetch_and_compile({Name, ErlFirstFiles}, Deps) ->
|
||||
@@ -74,12 +76,12 @@ default_registry_file() ->
|
||||
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,
|
||||
+ %% 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) ->
|
||||
|
||||
compile(Name, ErlFirstFiles).
|
||||
|
||||
fetch({pkg, Name, Vsn}, App) ->
|
||||
|
||||
-fetch({pkg, Name, Vsn}, App) ->
|
||||
- Dir = filename:join([filename:absname("_build/default/lib/"), App]),
|
||||
- CDN = "https://s3.amazonaws.com/s3.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])
|
||||
- case filelib:is_dir(Dir) of
|
||||
- false ->
|
||||
- CDN = "https://s3.amazonaws.com/s3.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) ->
|
||||
@ -51,14 +73,17 @@ index 25bd658..b2a986b 100755
|
||||
- Error ->
|
||||
- Error
|
||||
- end.
|
||||
+ ok.
|
||||
|
||||
get_rebar_config() ->
|
||||
{ok, [[Home]]} = init:get_argument(home),
|
||||
@@ -109,20 +79,6 @@ get_rebar_config() ->
|
||||
[]
|
||||
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) ->
|
||||
- proplists:get_value(Scheme, get_rebar_config(), []).
|
||||
-
|
||||
@ -72,7 +97,63 @@ index 25bd658..b2a986b 100755
|
||||
-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://s3.amazonaws.com/s3.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) ->
|
||||
+%% proplists:get_value(Scheme, get_rebar_config(), []).
|
||||
+
|
||||
+%% 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),
|
||||
filelib:ensure_dir(filename:join([Dir, "ebin", "dummy.beam"])),
|
||||
|
@ -1,8 +1,8 @@
|
||||
diff --git a/src/rebar3.erl b/src/rebar3.erl
|
||||
index 2b73844..af1d871 100644
|
||||
diff a/src/rebar3.erl b/src/rebar3.erl
|
||||
index c1a1ae4..1bf1ea0 100644
|
||||
--- a/src/rebar3.erl
|
||||
+++ b/src/rebar3.erl
|
||||
@@ -282,9 +282,11 @@ start_and_load_apps(Caller) ->
|
||||
@@ -294,9 +294,11 @@ start_and_load_apps(Caller) ->
|
||||
ensure_running(crypto, Caller),
|
||||
ensure_running(asn1, Caller),
|
||||
ensure_running(public_key, Caller),
|
||||
@ -10,21 +10,14 @@ index 2b73844..af1d871 100644
|
||||
- inets:start(),
|
||||
- inets:start(httpc, [{profile, rebar}]).
|
||||
+ ensure_running(ssl, Caller).
|
||||
+%% Removed due to the hermicity requirements of Nix
|
||||
+%% Removed due to the hermicity requirements of Nix
|
||||
+%%
|
||||
+%% inets:start(),
|
||||
+%% inets:start(httpc, [{profile, rebar}]).
|
||||
|
||||
|
||||
ensure_running(App, Caller) ->
|
||||
case application:start(App) of
|
||||
@@ -339,4 +341,4 @@ safe_define_test_macro(Opts) ->
|
||||
test_defined([{d, 'TEST'}|_]) -> true;
|
||||
test_defined([{d, 'TEST', true}|_]) -> true;
|
||||
test_defined([_|Rest]) -> test_defined(Rest);
|
||||
-test_defined([]) -> false.
|
||||
\ No newline at end of file
|
||||
+test_defined([]) -> false.
|
||||
diff --git a/src/rebar_hermicity.erl b/src/rebar_hermicity.erl
|
||||
diff a/src/rebar_hermicity.erl b/src/rebar_hermicity.erl
|
||||
new file mode 100644
|
||||
index 0000000..d814e2a
|
||||
--- /dev/null
|
||||
@ -72,37 +65,29 @@ index 0000000..d814e2a
|
||||
+ "are as follows:", []),
|
||||
+ ?ERROR("Requesnt: ~p ~s", [Method, Url]),
|
||||
+ erlang:halt(1).
|
||||
diff --git a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl
|
||||
index 4f55ad1..f76fd5d 100644
|
||||
diff a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl
|
||||
index ec7e09d..03be343 100644
|
||||
--- a/src/rebar_pkg_resource.erl
|
||||
+++ b/src/rebar_pkg_resource.erl
|
||||
@@ -100,10 +100,10 @@ make_vsn(_) ->
|
||||
@@ -104,7 +104,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]},
|
||||
- [{ssl, ssl_opts(Url)}, {relaxed, true}],
|
||||
- [{body_format, binary}],
|
||||
- rebar) of
|
||||
+ case rebar_hermicity:request(get, {Url, [{"if-none-match", ETag} || ETag =/= false]},
|
||||
+ [{ssl, ssl_opts(Url)}, {relaxed, true}],
|
||||
+ [{body_format, binary}],
|
||||
+ rebar) of
|
||||
{ok, {{_Version, 200, _Reason}, Headers, Body}} ->
|
||||
?DEBUG("Successfully downloaded ~s", [Url]),
|
||||
{"etag", ETag1} = lists:keyfind("etag", 1, Headers),
|
||||
diff --git a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl
|
||||
index 6637ebe..d82c1d8 100644
|
||||
- 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()}]},
|
||||
[{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
|
||||
--- a/src/rebar_prv_update.erl
|
||||
+++ b/src/rebar_prv_update.erl
|
||||
@@ -44,8 +44,8 @@ do(State) ->
|
||||
TmpFile = filename:join(TmpDir, "packages.gz"),
|
||||
|
||||
Url = rebar_state:get(State, rebar_packages_cdn, ?DEFAULT_HEX_REGISTRY),
|
||||
- case httpc:request(get, {Url, []},
|
||||
- [], [{stream, TmpFile}, {sync, true}],
|
||||
+ case rebar_hermicity:request(get, {Url, []},
|
||||
+ [], [{stream, TmpFile}, {sync, true}],
|
||||
rebar) of
|
||||
{ok, saved_to_file} ->
|
||||
{ok, Data} = file:read_file(TmpFile),
|
||||
@@ -52,7 +52,7 @@ do(State) ->
|
||||
case rebar_utils:url_append_path(CDN, ?REMOTE_REGISTRY_FILE) of
|
||||
{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()}]},
|
||||
[], [{stream, TmpFile}, {sync, true}],
|
||||
rebar) of
|
||||
{ok, saved_to_file} ->
|
||||
|
Loading…
Reference in New Issue
Block a user