beam-modules/hex-snapshot: remove
The package set is not maintained. It is also not used by most of the BEAM community. Removing it to allow a more useful set of tools fit to the BEAM community in Nixpkgs.
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
{ stdenv, fetchFromGitHub,
|
||||
fetchHex, erlang,
|
||||
tree, hexRegistrySnapshot }:
|
||||
tree }:
|
||||
|
||||
let
|
||||
version = "3.12.0";
|
||||
|
||||
bootstrapper = ./rebar3-nix-bootstrap;
|
||||
|
||||
erlware_commons = fetchHex {
|
||||
pkg = "erlware_commons";
|
||||
version = "1.3.1";
|
||||
@@ -80,15 +78,9 @@ stdenv.mkDerivation rec {
|
||||
sha256 = "0936ix7lfwsamssap58b265zid7x2m97azrr2qpjcln3xysd16lg";
|
||||
};
|
||||
|
||||
inherit bootstrapper;
|
||||
|
||||
buildInputs = [ erlang tree ];
|
||||
|
||||
# TODO: Remove registry snapshot
|
||||
propagatedBuildInputs = [ hexRegistrySnapshot ];
|
||||
|
||||
postPatch = ''
|
||||
${erlang}/bin/escript ${bootstrapper} registry-only
|
||||
mkdir -p _checkouts
|
||||
mkdir -p _build/default/lib/
|
||||
|
||||
|
||||
@@ -25,14 +25,12 @@
|
||||
%%% Environment Variable
|
||||
|
||||
-record(data, {version
|
||||
, registry_only = false
|
||||
, debug_info = false
|
||||
, compile_ports
|
||||
, erl_libs
|
||||
, plugins
|
||||
, root
|
||||
, name
|
||||
, registry_snapshot}).
|
||||
, name}).
|
||||
|
||||
-define(HEX_REGISTRY_PATH, ".cache/rebar3/hex/default/registry").
|
||||
|
||||
@@ -41,30 +39,24 @@ main(Args) ->
|
||||
{ok, RequiredData} = gather_required_data_from_the_environment(ArgData),
|
||||
do_the_bootstrap(RequiredData).
|
||||
|
||||
%% @doc There are two modes 'registry_only' where the register is
|
||||
%% created from hex and everything else.
|
||||
-spec do_the_bootstrap(#data{}) -> ok.
|
||||
do_the_bootstrap(RequiredData = #data{registry_only = true}) ->
|
||||
ok = bootstrap_registry(RequiredData);
|
||||
do_the_bootstrap(RequiredData) ->
|
||||
ok = bootstrap_registry(RequiredData),
|
||||
ok = bootstrap_configs(RequiredData),
|
||||
ok = bootstrap_plugins(RequiredData),
|
||||
ok = bootstrap_libs(RequiredData).
|
||||
|
||||
%% @doc
|
||||
%% Argument parsing is super simple only because we want to keep the
|
||||
%% dependencies minimal. For now there can be two entries on the
|
||||
%% command line, "registry-only" and "debug-info"
|
||||
%% dependencies minimal. For now there can be one entry on the
|
||||
%% command line: "debug-info"
|
||||
-spec parse_args([string()]) -> #data{}.
|
||||
parse_args(Args0) ->
|
||||
PossibleArgs = sets:from_list(["registry-only", "debug-info"]),
|
||||
PossibleArgs = sets:from_list(["debug-info"]),
|
||||
Args1 = sets:from_list(Args0),
|
||||
Result = sets:subtract(Args1, PossibleArgs),
|
||||
case sets:to_list(Result) of
|
||||
[] ->
|
||||
{ok, #data{registry_only = sets:is_element("registry-only", Args1),
|
||||
debug_info = sets:is_element("debug-info", Args1)}};
|
||||
{ok, #data{debug_info = sets:is_element("debug-info", Args1)}};
|
||||
UnknownArgs ->
|
||||
io:format("Unexpected command line arguments passed in: ~p~n",
|
||||
[UnknownArgs]),
|
||||
@@ -156,30 +148,6 @@ fixup_app_name(FileName) ->
|
||||
[Name, _Version, _Tag] -> Name
|
||||
end.
|
||||
|
||||
-spec bootstrap_registry(#data{}) -> ok.
|
||||
bootstrap_registry(#data{registry_snapshot = RegistrySnapshot}) ->
|
||||
io:format("Bootstrapping Hex Registry for Rebar~n"),
|
||||
make_sure_registry_snapshot_exists(RegistrySnapshot),
|
||||
filelib:ensure_dir(?HEX_REGISTRY_PATH),
|
||||
ok = case filelib:is_file(?HEX_REGISTRY_PATH) of
|
||||
true ->
|
||||
file:delete(?HEX_REGISTRY_PATH);
|
||||
false ->
|
||||
ok
|
||||
end,
|
||||
ok = file:make_symlink(RegistrySnapshot,
|
||||
?HEX_REGISTRY_PATH).
|
||||
|
||||
-spec make_sure_registry_snapshot_exists(string()) -> ok.
|
||||
make_sure_registry_snapshot_exists(RegistrySnapshot) ->
|
||||
case filelib:is_file(RegistrySnapshot) of
|
||||
true ->
|
||||
ok;
|
||||
false ->
|
||||
stderr("Registry snapshot (~s) does not exist!", [RegistrySnapshot]),
|
||||
erlang:halt(1)
|
||||
end.
|
||||
|
||||
-spec gather_required_data_from_the_environment(#data{}) -> {ok, #data{}}.
|
||||
gather_required_data_from_the_environment(ArgData) ->
|
||||
{ok, ArgData#data{ version = guard_env("version")
|
||||
@@ -187,8 +155,7 @@ gather_required_data_from_the_environment(ArgData) ->
|
||||
, plugins = get_env("buildPlugins", [])
|
||||
, root = code:root_dir()
|
||||
, name = guard_env("name")
|
||||
, compile_ports = nix2bool(get_env("compilePorts", ""))
|
||||
, registry_snapshot = guard_env("HEX_REGISTRY_SNAPSHOT")}}.
|
||||
, compile_ports = nix2bool(get_env("compilePorts", ""))}}.
|
||||
|
||||
-spec nix2bool(any()) -> boolean().
|
||||
nix2bool("1") ->
|
||||
|
||||
Reference in New Issue
Block a user