rebar3: 3.1.0 -> 3.3.2

authored by Eric Bailey and committed by Tuomas Tynkkynen fe727a19 41256881

+81 -71
+34 -34
pkgs/development/tools/build-managers/rebar3/default.nix
··· 3 tree, fetchFromGitHub, hexRegistrySnapshot }: 4 5 let 6 - version = "3.1.0"; 7 8 bootstrapper = ./rebar3-nix-bootstrap; 9 10 - erlware_commons = fetchHex { 11 - pkg = "erlware_commons"; 12 - version = "0.19.0"; 13 - sha256 = "1gfsy9bbhjb94c5ghff2niamn93x2x08lnklh6pp7sfr5i0gkgsv"; 14 - }; 15 - ssl_verify_hostname = fetchHex { 16 - pkg = "ssl_verify_hostname"; 17 - version = "1.0.5"; 18 - sha256 = "1gzavzqzljywx4l59gvhkjbr1dip4kxzjjz1s4wsn42f2kk13jzj"; 19 }; 20 certifi = fetchHex { 21 pkg = "certifi"; 22 version = "0.4.0"; 23 sha256 = "04bnvsbssdcf6b9h9bfglflds7j0gx6q5igl1xxhx6fnwaz37hhw"; 24 }; 25 - providers = fetchHex { 26 - pkg = "providers"; 27 - version = "1.6.0"; 28 - sha256 = "0byfa1h57n46jilz4q132j0vk3iqc0v1vip89li38gb1k997cs0g"; 29 - }; 30 - getopt = fetchHex { 31 - pkg = "getopt"; 32 - version = "0.8.2"; 33 - sha256 = "1xw30h59zbw957cyjd8n50hf9y09jnv9dyry6x3avfwzcyrnsvkk"; 34 - }; 35 - bbmustache = fetchHex { 36 - pkg = "bbmustache"; 37 - version = "1.0.4"; 38 - sha256 = "04lvwm7f78x8bys0js33higswjkyimbygp4n72cxz1kfnryx9c03"; 39 - }; 40 - relx = fetchHex { 41 - pkg = "relx"; 42 - version = "3.17.0"; 43 - sha256 = "1xjybi93m8gj9f9z3lkc7xbg3k5cw56yl78rcz5qfirr0223sby2"; 44 - }; 45 cf = fetchHex { 46 pkg = "cf"; 47 version = "0.2.1"; ··· 49 }; 50 cth_readable = fetchHex { 51 pkg = "cth_readable"; 52 - version = "1.2.2"; 53 - sha256 = "0kb9v4998liwyidpjkhcg1nin6djjzxcx6b313pbjicbp4r58n3p"; 54 }; 55 eunit_formatters = fetchHex { 56 pkg = "eunit_formatters"; 57 version = "0.3.1"; 58 sha256 = "0cg9dasv60v09q3q4wja76pld0546mhmlpb0khagyylv890hg934"; 59 }; 60 rebar3_hex = fetchHex { 61 pkg = "rebar3_hex"; 62 version = "1.12.0"; ··· 70 71 src = fetchurl { 72 url = "https://github.com/rebar/rebar3/archive/${version}.tar.gz"; 73 - sha256 = "0r4wpnpi81ha4iirv9hcif3vrgc82qd51kah7rnhvpym55wcy9ml"; 74 }; 75 76 inherit bootstrapper; ··· 97 cp --no-preserve=mode -R ${cth_readable} _build/default/lib/cth_readable 98 cp --no-preserve=mode -R ${eunit_formatters} _build/default/lib/eunit_formatters 99 cp --no-preserve=mode -R ${relx} _build/default/lib/relx 100 - cp --no-preserve=mode -R ${ssl_verify_hostname} _build/default/lib/ssl_verify_hostname 101 cp --no-preserve=mode -R ${rebar3_hex} _build/default/plugins/rebar3_hex 102 ''; 103
··· 3 tree, fetchFromGitHub, hexRegistrySnapshot }: 4 5 let 6 + version = "3.3.2"; 7 8 bootstrapper = ./rebar3-nix-bootstrap; 9 10 + bbmustache = fetchHex { 11 + pkg = "bbmustache"; 12 + version = "1.3.0"; 13 + sha256 = "042pfgss8kscq6ssg8gix8ccmdsrx0anjczsbrn2a6c36ljrx2p6"; 14 }; 15 certifi = fetchHex { 16 pkg = "certifi"; 17 version = "0.4.0"; 18 sha256 = "04bnvsbssdcf6b9h9bfglflds7j0gx6q5igl1xxhx6fnwaz37hhw"; 19 }; 20 cf = fetchHex { 21 pkg = "cf"; 22 version = "0.2.1"; ··· 24 }; 25 cth_readable = fetchHex { 26 pkg = "cth_readable"; 27 + version = "1.2.3"; 28 + sha256 = "0wfpfismzi2q0nzvx9qyllch4skwmsk6yqffw8iw2v48ssbfvfhz"; 29 + }; 30 + erlware_commons = fetchHex { 31 + pkg = "erlware_commons"; 32 + version = "0.21.0"; 33 + sha256 = "0gxb011m637rca2g0vhm1q9krm3va50rz1py6zf8k92q4iv9a2p7"; 34 }; 35 eunit_formatters = fetchHex { 36 pkg = "eunit_formatters"; 37 version = "0.3.1"; 38 sha256 = "0cg9dasv60v09q3q4wja76pld0546mhmlpb0khagyylv890hg934"; 39 }; 40 + getopt = fetchHex { 41 + pkg = "getopt"; 42 + version = "0.8.2"; 43 + sha256 = "1xw30h59zbw957cyjd8n50hf9y09jnv9dyry6x3avfwzcyrnsvkk"; 44 + }; 45 + providers = fetchHex { 46 + pkg = "providers"; 47 + version = "1.6.0"; 48 + sha256 = "0byfa1h57n46jilz4q132j0vk3iqc0v1vip89li38gb1k997cs0g"; 49 + }; 50 + ssl_verify_fun = fetchHex { 51 + pkg = "ssl_verify_fun"; 52 + version = "1.1.1"; 53 + sha256 = "0pnnan9xf4r6pr34hi28zdyv501i39jwnrwk6pr9r4wabkmhb22g"; 54 + }; 55 + relx = fetchHex { 56 + pkg = "relx"; 57 + version = "3.21.1"; 58 + sha256 = "00590aqy0rfzgsnzxqgwbmn90imxxqlzmnmapy6bq76vw2rynvb8"; 59 + }; 60 rebar3_hex = fetchHex { 61 pkg = "rebar3_hex"; 62 version = "1.12.0"; ··· 70 71 src = fetchurl { 72 url = "https://github.com/rebar/rebar3/archive/${version}.tar.gz"; 73 + sha256 = "14nhc1bmna3b4y9qmd0lzpi0jdaw92r7ljg7vlghn297awsjgg6c"; 74 }; 75 76 inherit bootstrapper; ··· 97 cp --no-preserve=mode -R ${cth_readable} _build/default/lib/cth_readable 98 cp --no-preserve=mode -R ${eunit_formatters} _build/default/lib/eunit_formatters 99 cp --no-preserve=mode -R ${relx} _build/default/lib/relx 100 + cp --no-preserve=mode -R ${ssl_verify_fun} _build/default/lib/ssl_verify_fun 101 cp --no-preserve=mode -R ${rebar3_hex} _build/default/plugins/rebar3_hex 102 ''; 103
+28 -18
pkgs/development/tools/build-managers/rebar3/hermetic-bootstrap.patch
··· 1 diff --git a/bootstrap b/bootstrap 2 - index 35759b0..939c838 100755 3 --- a/bootstrap 4 +++ b/bootstrap 5 @@ -7,9 +7,11 @@ main(_) -> ··· 9 - inets:start(), 10 - inets:start(httpc, [{profile, rebar}]), 11 - set_httpc_options(), 12 - + %% Removed for hermeticity on Nix 13 + %% 14 - + %% inets:start(), 15 - + %% inets:start(httpc, [{profile, rebar}]), 16 - + %% set_httpc_options(), 17 - 18 %% Fetch and build deps required to build rebar3 19 BaseDeps = [{providers, []} 20 - @@ -74,12 +76,12 @@ default_registry_file() -> 21 filename:join([CacheDir, "hex", "default", "registry"]). 22 - 23 - fetch_and_compile({Name, ErlFirstFiles}, Deps) -> 24 - case lists:keyfind(Name, 1, Deps) of 25 - {Name, Vsn} -> 26 - ok = fetch({pkg, atom_to_binary(Name, utf8), list_to_binary(Vsn)}, Name); 27 - {Name, _, Source} -> 28 - ok = fetch(Source, Name) 29 - end, 30 + %% case lists:keyfind(Name, 1, Deps) of 31 + %% {Name, Vsn} -> 32 + %% ok = fetch({pkg, atom_to_binary(Name, utf8), list_to_binary(Vsn)}, Name); 33 + %% {Name, _, Source} -> 34 + %% ok = fetch(Source, Name) 35 + %% end, 36 - 37 %% Hack: erlware_commons depends on a .script file to check if it is being built with 38 %% rebar2 or rebar3. But since rebar3 isn't built yet it can't get the vsn with get_key. 39 - @@ -88,63 +90,63 @@ fetch_and_compile({Name, ErlFirstFiles}, Deps) -> 40 - 41 compile(Name, ErlFirstFiles). 42 - 43 -fetch({pkg, Name, Vsn}, App) -> 44 - Dir = filename:join([filename:absname("_build/default/lib/"), App]), 45 - case filelib:is_dir(Dir) of 46 - false -> 47 - - CDN = "https://s3.amazonaws.com/s3.hex.pm/tarballs", 48 - Package = binary_to_list(<<Name/binary, "-", Vsn/binary, ".tar">>), 49 - Url = string:join([CDN, Package], "/"), 50 - case request(Url) of ··· 85 - end. 86 - 87 -get_http_vars(Scheme) -> 88 - - proplists:get_value(Scheme, get_rebar_config(), []). 89 - 90 -set_httpc_options() -> 91 - set_httpc_options(https_proxy, get_http_vars(https_proxy)), ··· 101 +%% Dir = filename:join([filename:absname("_build/default/lib/"), App]), 102 +%% case filelib:is_dir(Dir) of 103 +%% false -> 104 - +%% CDN = "https://s3.amazonaws.com/s3.hex.pm/tarballs", 105 +%% Package = binary_to_list(<<Name/binary, "-", Vsn/binary, ".tar">>), 106 +%% Url = string:join([CDN, Package], "/"), 107 +%% case request(Url) of ··· 142 +%% end. 143 + 144 +%% get_http_vars(Scheme) -> 145 - +%% proplists:get_value(Scheme, get_rebar_config(), []). 146 + 147 +%% set_httpc_options() -> 148 +%% set_httpc_options(https_proxy, get_http_vars(https_proxy)), ··· 154 +%% set_httpc_options(Scheme, Proxy) -> 155 +%% {ok, {_, _, Host, Port, _, _}} = http_uri:parse(Proxy), 156 +%% httpc:set_options([{Scheme, {{Host, Port}, []}}], rebar). 157 - 158 compile(App, FirstFiles) -> 159 Dir = filename:join(filename:absname("_build/default/lib/"), App),
··· 1 diff --git a/bootstrap b/bootstrap 2 + index c36fddb..9fcb718 100755 3 --- a/bootstrap 4 +++ b/bootstrap 5 @@ -7,9 +7,11 @@ main(_) -> ··· 9 - inets:start(), 10 - inets:start(httpc, [{profile, rebar}]), 11 - set_httpc_options(), 12 + + %% Removed for hermeticity on Nix 13 + %% 14 + + %% inets:start(), 15 + + %% inets:start(httpc, [{profile, rebar}]), 16 + + %% set_httpc_options(), 17 + 18 %% Fetch and build deps required to build rebar3 19 BaseDeps = [{providers, []} 20 + @@ -73,13 +75,13 @@ default_registry_file() -> 21 + CacheDir = filename:join([Home, ".cache", "rebar3"]), 22 filename:join([CacheDir, "hex", "default", "registry"]). 23 + 24 + -fetch_and_compile({Name, ErlFirstFiles}, Deps) -> 25 - case lists:keyfind(Name, 1, Deps) of 26 - {Name, Vsn} -> 27 - ok = fetch({pkg, atom_to_binary(Name, utf8), list_to_binary(Vsn)}, Name); 28 - {Name, _, Source} -> 29 - ok = fetch(Source, Name) 30 - end, 31 + +fetch_and_compile({Name, ErlFirstFiles}, _Deps) -> 32 + %% case lists:keyfind(Name, 1, Deps) of 33 + %% {Name, Vsn} -> 34 + %% ok = fetch({pkg, atom_to_binary(Name, utf8), list_to_binary(Vsn)}, Name); 35 + %% {Name, _, Source} -> 36 + %% ok = fetch(Source, Name) 37 + %% end, 38 + 39 %% Hack: erlware_commons depends on a .script file to check if it is being built with 40 %% rebar2 or rebar3. But since rebar3 isn't built yet it can't get the vsn with get_key. 41 + @@ -88,67 +90,67 @@ fetch_and_compile({Name, ErlFirstFiles}, Deps) -> 42 + 43 compile(Name, ErlFirstFiles). 44 + 45 -fetch({pkg, Name, Vsn}, App) -> 46 - Dir = filename:join([filename:absname("_build/default/lib/"), App]), 47 - case filelib:is_dir(Dir) of 48 - false -> 49 + - CDN = "https://repo.hex.pm/tarballs", 50 - Package = binary_to_list(<<Name/binary, "-", Vsn/binary, ".tar">>), 51 - Url = string:join([CDN, Package], "/"), 52 - case request(Url) of ··· 87 - end. 88 - 89 -get_http_vars(Scheme) -> 90 + - OS = case os:getenv(atom_to_list(Scheme)) of 91 + - Str when is_list(Str) -> Str; 92 + - _ -> [] 93 + - end, 94 + - proplists:get_value(Scheme, get_rebar_config(), OS). 95 - 96 -set_httpc_options() -> 97 - set_httpc_options(https_proxy, get_http_vars(https_proxy)), ··· 107 +%% Dir = filename:join([filename:absname("_build/default/lib/"), App]), 108 +%% case filelib:is_dir(Dir) of 109 +%% false -> 110 + +%% CDN = "https://repo.hex.pm/tarballs", 111 +%% Package = binary_to_list(<<Name/binary, "-", Vsn/binary, ".tar">>), 112 +%% Url = string:join([CDN, Package], "/"), 113 +%% case request(Url) of ··· 148 +%% end. 149 + 150 +%% get_http_vars(Scheme) -> 151 + +%% OS = case os:getenv(atom_to_list(Scheme)) of 152 + +%% Str when is_list(Str) -> Str; 153 + +%% _ -> [] 154 + +%% end, 155 + +%% proplists:get_value(Scheme, get_rebar_config(), OS). 156 + 157 +%% set_httpc_options() -> 158 +%% set_httpc_options(https_proxy, get_http_vars(https_proxy)), ··· 164 +%% set_httpc_options(Scheme, Proxy) -> 165 +%% {ok, {_, _, Host, Port, _, _}} = http_uri:parse(Proxy), 166 +%% httpc:set_options([{Scheme, {{Host, Port}, []}}], rebar). 167 + 168 compile(App, FirstFiles) -> 169 Dir = filename:join(filename:absname("_build/default/lib/"), App),
+19 -19
pkgs/development/tools/build-managers/rebar3/hermetic-rebar3.patch
··· 1 - diff a/src/rebar3.erl b/src/rebar3.erl 2 - index c1a1ae4..1bf1ea0 100644 3 --- a/src/rebar3.erl 4 +++ b/src/rebar3.erl 5 - @@ -294,9 +294,11 @@ start_and_load_apps(Caller) -> 6 ensure_running(crypto, Caller), 7 ensure_running(asn1, Caller), 8 ensure_running(public_key, Caller), ··· 12 + ensure_running(ssl, Caller). 13 +%% Removed due to the hermicity requirements of Nix 14 +%% 15 - +%% inets:start(), 16 - +%% inets:start(httpc, [{profile, rebar}]). 17 - 18 ensure_running(App, Caller) -> 19 case application:start(App) of 20 - diff a/src/rebar_hermicity.erl b/src/rebar_hermicity.erl 21 new file mode 100644 22 - index 0000000..d814e2a 23 --- /dev/null 24 - +++ b/src/rebar_hermicity.erl 25 @@ -0,0 +1,42 @@ 26 +%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- 27 +%% ex: ts=4 sw=4 et ··· 49 +%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 50 +%% THE SOFTWARE. 51 +%% ------------------------------------------------------------------- 52 - +-module(rebar_hermicity). 53 + 54 +-export([request/5]). 55 + ··· 63 + ?ERROR("A request is being made that violates Nix hermicity " 64 + "This request has been stopped. Details of the request " 65 + "are as follows:", []), 66 - + ?ERROR("Requesnt: ~p ~s", [Method, Url]), 67 + erlang:halt(1). 68 - diff a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl 69 - index ec7e09d..03be343 100644 70 --- a/src/rebar_pkg_resource.erl 71 +++ b/src/rebar_pkg_resource.erl 72 - @@ -104,7 +104,7 @@ make_vsn(_) -> 73 {error, "Replacing version of type pkg not supported."}. 74 - 75 request(Url, ETag) -> 76 - case httpc:request(get, {Url, [{"if-none-match", ETag} || ETag =/= false]++[{"User-Agent", rebar_utils:user_agent()}]}, 77 - + case rebar_hermicity:request(get, {Url, [{"if-none-match", ETag} || ETag =/= false]++[{"User-Agent", rebar_utils:user_agent()}]}, 78 [{ssl, ssl_opts(Url)}, {relaxed, true}], 79 [{body_format, binary}], 80 rebar) of 81 - diff a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl 82 - index 5e1e253..ea25b9e 100644 83 --- a/src/rebar_prv_update.erl 84 +++ b/src/rebar_prv_update.erl 85 @@ -52,7 +52,7 @@ do(State) -> ··· 87 {ok, Url} -> 88 ?DEBUG("Fetching registry from ~p", [Url]), 89 - case httpc:request(get, {Url, [{"User-Agent", rebar_utils:user_agent()}]}, 90 - + case rebar_hermicity:request(get, {Url, [{"User-Agent", rebar_utils:user_agent()}]}, 91 [], [{stream, TmpFile}, {sync, true}], 92 rebar) of 93 {ok, saved_to_file} ->
··· 1 + diff --git a/src/rebar3.erl b/src/rebar3.erl 2 + index 47dc25a..edda250 100644 3 --- a/src/rebar3.erl 4 +++ b/src/rebar3.erl 5 + @@ -304,9 +304,11 @@ start_and_load_apps(Caller) -> 6 ensure_running(crypto, Caller), 7 ensure_running(asn1, Caller), 8 ensure_running(public_key, Caller), ··· 12 + ensure_running(ssl, Caller). 13 +%% Removed due to the hermicity requirements of Nix 14 +%% 15 + +%% inets:start(), 16 + +%% inets:start(httpc, [{profile, rebar}]). 17 + 18 ensure_running(App, Caller) -> 19 case application:start(App) of 20 + diff --git a/src/rebar_hermeticity.erl b/src/rebar_hermeticity.erl 21 new file mode 100644 22 + index 0000000..8f6cc7d 23 --- /dev/null 24 + +++ b/src/rebar_hermeticity.erl 25 @@ -0,0 +1,42 @@ 26 +%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- 27 +%% ex: ts=4 sw=4 et ··· 49 +%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 50 +%% THE SOFTWARE. 51 +%% ------------------------------------------------------------------- 52 + +-module(rebar_hermeticity). 53 + 54 +-export([request/5]). 55 + ··· 63 + ?ERROR("A request is being made that violates Nix hermicity " 64 + "This request has been stopped. Details of the request " 65 + "are as follows:", []), 66 + + ?ERROR("Request: ~p ~s", [Method, Url]), 67 + erlang:halt(1). 68 + diff --git a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl 69 + index 5817817..2ea1703 100644 70 --- a/src/rebar_pkg_resource.erl 71 +++ b/src/rebar_pkg_resource.erl 72 + @@ -107,7 +107,7 @@ make_vsn(_) -> 73 {error, "Replacing version of type pkg not supported."}. 74 + 75 request(Url, ETag) -> 76 - case httpc:request(get, {Url, [{"if-none-match", ETag} || ETag =/= false]++[{"User-Agent", rebar_utils:user_agent()}]}, 77 + + case rebar_hermeticity:request(get, {Url, [{"if-none-match", ETag} || ETag =/= false]++[{"User-Agent", rebar_utils:user_agent()}]}, 78 [{ssl, ssl_opts(Url)}, {relaxed, true}], 79 [{body_format, binary}], 80 rebar) of 81 + diff --git a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl 82 + index 75c609e..4283c23 100644 83 --- a/src/rebar_prv_update.erl 84 +++ b/src/rebar_prv_update.erl 85 @@ -52,7 +52,7 @@ do(State) -> ··· 87 {ok, Url} -> 88 ?DEBUG("Fetching registry from ~p", [Url]), 89 - case httpc:request(get, {Url, [{"User-Agent", rebar_utils:user_agent()}]}, 90 + + case rebar_hermeticity:request(get, {Url, [{"User-Agent", rebar_utils:user_agent()}]}, 91 [], [{stream, TmpFile}, {sync, true}], 92 rebar) of 93 {ok, saved_to_file} ->