mirror of
https://github.com/correl/rebar.git
synced 2024-11-27 11:09:55 +00:00
Merge pull request #418 from tuncer/fix-415
Fix #415 (reltool vsn check)
This commit is contained in:
commit
3288afa5c1
1 changed files with 35 additions and 2 deletions
|
@ -117,7 +117,7 @@ check_vsn() ->
|
||||||
?ABORT("Reltool support requires the reltool application "
|
?ABORT("Reltool support requires the reltool application "
|
||||||
"to be installed!", []);
|
"to be installed!", []);
|
||||||
Path ->
|
Path ->
|
||||||
ReltoolVsn = filename:basename(Path),
|
ReltoolVsn = reltool_vsn(Path),
|
||||||
case ReltoolVsn < "reltool-0.5.2" of
|
case ReltoolVsn < "reltool-0.5.2" of
|
||||||
true ->
|
true ->
|
||||||
?ABORT("Reltool support requires at least reltool-0.5.2; "
|
?ABORT("Reltool support requires at least reltool-0.5.2; "
|
||||||
|
@ -127,6 +127,39 @@ check_vsn() ->
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
reltool_vsn(ReltoolPath) ->
|
||||||
|
AppFile = filename:join([ReltoolPath, "ebin", "reltool.app"]),
|
||||||
|
case filelib:is_regular(AppFile) of
|
||||||
|
true ->
|
||||||
|
reltool_vsn_from_app();
|
||||||
|
false ->
|
||||||
|
reltool_vsn_from_path(ReltoolPath)
|
||||||
|
end.
|
||||||
|
|
||||||
|
reltool_vsn_from_app() ->
|
||||||
|
ok = case application:load(reltool) of
|
||||||
|
ok ->
|
||||||
|
ok;
|
||||||
|
{error, {already_loaded, reltool}} ->
|
||||||
|
ok
|
||||||
|
end,
|
||||||
|
{ok, Vsn} = application:get_key(reltool, vsn),
|
||||||
|
"reltool-" ++ Vsn.
|
||||||
|
|
||||||
|
%% NOTE: OTP releases prior to R14B did not install
|
||||||
|
%% lib/reltool-x.y.z/ebin/reltool.app. Therefore, if we cannot find the app
|
||||||
|
%% file, we have to resort to getting the version string from reltool's lib_dir
|
||||||
|
%% path. This usually works, but as reported in
|
||||||
|
%% https://github.com/rebar/rebar/issues/415 there can be installations without
|
||||||
|
%% version strings in lib_dir paths. Given R13's age and that it's unusual to
|
||||||
|
%% have vsn-less lib_dir paths, this shouldn't be a problem.
|
||||||
|
%%
|
||||||
|
%% TODO: Once we require at least R14B04 (didn't check for existence of
|
||||||
|
%% ebin/reltool.app in R14 releases older than R14B04), simplify reltool_vsn/1
|
||||||
|
%% to get the version string only from the app key.
|
||||||
|
reltool_vsn_from_path(ReltoolPath) ->
|
||||||
|
filename:basename(ReltoolPath).
|
||||||
|
|
||||||
process_overlay(Config, ReltoolConfig) ->
|
process_overlay(Config, ReltoolConfig) ->
|
||||||
TargetDir = rebar_rel_utils:get_target_dir(Config, ReltoolConfig),
|
TargetDir = rebar_rel_utils:get_target_dir(Config, ReltoolConfig),
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue