Skip to content

Commit

Permalink
Merge branch 'master' of github.com:crownedgrouse/geas
Browse files Browse the repository at this point in the history
  • Loading branch information
crownedgrouse committed Dec 23, 2023
2 parents a0b531d + f3ad588 commit c58ffa5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/geas_api.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ compat(RootDir, print, Config) ->
lists:foreach(fun({LD, AD, RD, FD}) -> io:format(" ~-10s ~-10s ~-10s ~-20s ~20s~n",[LD, AD, RD, FD, get_version(FD)]) end, D),
io:format("~80s~n",[string:copies("-",80)]),
io:format(" ~-10s ~-10s ~-10s ~-20s ~20s~n",[MinGlob , ArchGlob, MaxGlob, "Global project", get_version(Project)]),
Rels = w2l({?GEAS_MIN_REL, MinGlob, MaxGlob, ?GEAS_MAX_REL}),
Rels = w2l({?GEAS_MIN_REL, MinGlob, MaxGlob, ?GEAS_MAX_REL}), % Might return empty list, if MinGlob is "higher" than MaxGlob.
io:format("~n",[]),
% Always display current version detected and patches found
Current = get_current_erlang_version(),
Expand Down Expand Up @@ -706,6 +706,8 @@ get_erlang_compat_beam(File) ->
%% @doc Check current Erlang release against project release window
%% @end
%%-------------------------------------------------------------------------
check_current_rel_vs_window(_Current, [] = _Window) ->
throw(5);
check_current_rel_vs_window(Current, Window)
->
Start = hd(Window),
Expand Down Expand Up @@ -766,9 +768,9 @@ check_window_vs_semver_frame(_Window, _Frame) % No frame set
%% @end
%%-------------------------------------------------------------------------
format_error(0) -> "Success" ;
format_error(1) -> "Current Erlang/OTP release is incompatible with project release window" ;
format_error(1) -> "The Erlang/OTP version used for analysis (" ++ get_current_erlang_version() ++ ") is incompatible with the project's release window" ;
format_error(2) -> "Release window do not match the required semver version range" ;
format_error(3) -> "Beam files are incompatible with current Erlang/OTP release (May need recompilation)" ;
format_error(4) -> "Maximum opcode is higher in Beam files (May need recompilation)" ;
format_error(5) -> "Release window do not match the required semver version frame" ;
format_error(5) -> "The release window does not match the required SemVer version frame" ;
format_error(_) -> "Unexpected exit code".
15 changes: 13 additions & 2 deletions src/geas_beam.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ is_native_from_file(File) ->
Bn = filename:rootname(File, ".beam"),
case filelib:is_regular(File) of
true -> {ok,{_,[{compile_info, L}]}} = beam_lib:chunks(Bn, [compile_info]),
{options, O} = lists:keyfind(options, 1, L),
case lists:member(native, O) of
case is_native_from_compile_info(lists:keyfind(options, 1, L)) of
true -> true ;
false -> % rebar3 does not add 'native' in compile option
case get_arch_from_chunks(File) of
Expand All @@ -116,6 +115,18 @@ is_native_from_file(File) ->
end
end.

%%-------------------------------------------------------------------------
%% @doc If a module's `compile_info` has `options` check if they contain
%% `native`. Return `false` otherwise.
%% @end
%%-------------------------------------------------------------------------
-spec is_native_from_compile_info(false | {options, [term()]}) -> boolean().

is_native_from_compile_info(false) ->
false;
is_native_from_compile_info({options, O}) ->
lists:member(native, O).

%%-------------------------------------------------------------------------
%% @doc Get compile module version
%% @end
Expand Down
2 changes: 2 additions & 0 deletions src/geas_semver.erl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ versionize(V) -> samovar:versionize(V).
%%-------------------------------------------------------------------------
-spec l2s(list()) -> {ok, list()} | {error, atom()}.

l2s([]) ->
{ok, []};
l2s(L) when is_list(L)
->
try
Expand Down

0 comments on commit c58ffa5

Please sign in to comment.