Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow more precise install dir configuration with AGNER_EXACT_PREFIX

  • Loading branch information...
commit b1339d9995a0442c7bc8e9e6aafaeaecdc7af5d9 1 parent 1dccef5
@evax evax authored yrashk committed
Showing with 15 additions and 6 deletions.
  1. +7 −1 src/agner.erl
  2. +3 −3 src/agner_fetch.erl
  3. +5 −2 src/agner_main.erl
View
8 src/agner.erl
@@ -22,7 +22,13 @@ start() ->
[_|_] ->
ignore
end,
- filelib:ensure_dir(os:getenv("AGNER_PREFIX") ++ "/"),
+ case os:getenv("AGNER_EXACT_PREFIX") of
+ false ->
+ os:putenv("AGNER_EXACT_PREFIX",filename:join(os:getenv("AGNER_PREFIX"),"packages"));
+ [_|_] ->
+ ignore
+ end,
+ filelib:ensure_dir(os:getenv("AGNER_EXACT_PREFIX") ++ "/"),
inets:start(),
ssl:start(),
inets:start(httpc,[{profile, agner}]),
View
6 src/agner_fetch.erl
@@ -543,7 +543,7 @@ install_dirs(#opts_rec{ spec = {spec, Spec} } = Opts) ->
" $AGNER_INSTALL_PREFIX 2>/dev/null && true || true"},
{bin_files, undefined}|Spec],
- filelib:ensure_dir(filename:join([os:getenv("AGNER_PREFIX"),"packages"]) ++ "/"),
+ filelib:ensure_dir(os:getenv("AGNER_EXACT_PREFIX") ++ "/"),
InstallPrefix = set_install_prefix(Opts),
os:cmd("rm -rf " ++ InstallPrefix),
ok = filelib:ensure_dir(InstallPrefix ++ "/"),
@@ -556,7 +556,7 @@ install_command(#opts_rec{ spec = {spec, Spec}, directory = Directory, quiet = Q
os:putenv("AGNER_PACKAGE_NAME", Package),
os:putenv("AGNER_PACKAGE_VERSION", Version),
- filelib:ensure_dir(filename:join([os:getenv("AGNER_PREFIX"),"packages"]) ++ "/"),
+ filelib:ensure_dir(os:getenv("AGNER_EXACT_PREFIX") ++ "/"),
InstallPrefix = set_install_prefix(Opts),
ok = filelib:ensure_dir(InstallPrefix ++ "/"),
@@ -618,6 +618,6 @@ install_command(#opts_rec{ spec = {spec, Spec}, directory = Directory, quiet = Q
end.
set_install_prefix(#opts_rec{ package = Package, version = Version }) ->
- InstallPrefix = filename:join([os:getenv("AGNER_PREFIX"),"packages",Package ++ "-" ++ Version]),
+ InstallPrefix = filename:join([os:getenv("AGNER_EXACT_PREFIX"), Package ++ "-" ++ Version]),
os:putenv("AGNER_INSTALL_PREFIX", InstallPrefix),
InstallPrefix.
View
7 src/agner_main.erl
@@ -321,7 +321,7 @@ handle_command(prefix, Opts) ->
io:format("ERROR: Package name required.~n");
Package ->
Version = proplists:get_value(version, Opts),
- InstallPrefix = filename:join([os:getenv("AGNER_PREFIX"),"packages",Package ++ "-" ++ Version]),
+ InstallPrefix = filename:join([os:getenv("AGNER_EXACT_PREFIX"),Package ++ "-" ++ Version]),
case filelib:is_dir(InstallPrefix) of
true ->
io:format("~s~n",[InstallPrefix]);
@@ -336,7 +336,7 @@ handle_command(uninstall, Opts) ->
io:format("ERROR: Package name required.~n");
Package ->
Version = proplists:get_value(version, Opts),
- InstallPrefix = filename:join([os:getenv("AGNER_PREFIX"),"packages",Package ++ "-" ++ Version]),
+ InstallPrefix = filename:join([os:getenv("AGNER_EXACT_PREFIX"),Package ++ "-" ++ Version]),
case filelib:is_dir(InstallPrefix) of
true ->
io:format("Uninstalling...~n"),
@@ -427,9 +427,12 @@ handle_command(version, _) ->
handle_command(config, []) ->
io:format("prefix="), handle_command(config,[{variable, "prefix"}]),
+ io:format("exact_prefix="), handle_command(config,[{variable, "exact_prefix"}]),
io:format("bin="), handle_command(config,[{variable, "bin"}]);
handle_command(config, [{variable, "prefix"}]) ->
io:format("~s~n",[os:getenv("AGNER_PREFIX")]);
+handle_command(config, [{variable, "exact_prefix"}]) ->
+ io:format("~s~n",[os:getenv("AGNER_EXACT_PREFIX")]);
handle_command(config, [{variable, "bin"}]) ->
io:format("~s~n",[os:getenv("AGNER_BIN")]).

0 comments on commit b1339d9

Please sign in to comment.
Something went wrong with that request. Please try again.