Skip to content

Commit

Permalink
Bump hex_core to 0.8.4 to support licenses validations (#267)
Browse files Browse the repository at this point in the history
* Bump hex_core to 0.8.4 to support license validations
  • Loading branch information
starbelly authored Dec 21, 2021
1 parent 71cb75c commit b863f6a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

{project_plugins, [covertool, {rebar3_hank, "~> 0.3.0"}]}.

{deps, [{hex_core, "0.7.1"}, {verl, "1.0.2"}]}.
{deps, [{hex_core, "0.8.4"}, {verl, "1.0.2"}]}.

{profiles, [
{test, [
{extra_src_dirs, ["test/support"]},
{overrides, [{override, rebar3,[{deps, [{erlware_commons, "1.3.1"}]}]}]},
{deps, [{hex_core, "0.8.2"},
{deps, [{hex_core, "0.8.4"},
{erlware_commons, "1.5.0"}, {elli, "3.3.0"},
{jsone, "1.5.3"}, {meck, "0.9.0"}]},
{erl_opts, [nowarn_export_all]}
Expand Down
6 changes: 3 additions & 3 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{"1.2.0",
[{<<"hex_core">>,{pkg,<<"hex_core">>,<<"0.7.1">>},0},
[{<<"hex_core">>,{pkg,<<"hex_core">>,<<"0.8.4">>},0},
{<<"verl">>,{pkg,<<"verl">>,<<"1.0.2">>},0}]}.
[
{pkg_hash,[
{<<"hex_core">>, <<"0051B25995C86B513FDBB7608DA5466D3C0A33273A25A5981F52A84F77043F8C">>},
{<<"hex_core">>, <<"FF38B56D164D5987962232C28D769661907B55CE1F058CAECA8E0C8CA5BD85C8">>},
{<<"verl">>, <<"02ECD8E074E247C762383A6FE85533D6D07007529B86E47AAA6A80A9C1BB6629">>}]},
{pkg_hash_ext,[
{<<"hex_core">>, <<"05C60411511B6DC79AFFCD99A93E67D71E1B9D6ABCB28BA75CD4EBC8585B8D02">>},
{<<"hex_core">>, <<"4B8C21FA049515D778395E38B0D0E5D48B7ECDC703BBA1F7007E2651292CE61A">>},
{<<"verl">>, <<"7A3A0A827C6C2400B26DBC87CA9231D45294ABAA95D80A2AEDC3310213A93139">>}]}
].
14 changes: 13 additions & 1 deletion src/rebar3_hex_publish.erl
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ format_error({no_description, AppName}) ->
format_error({no_license, AppName}) ->
Err = "~ts.app.src : missing or empty licenses property",
io_lib:format(Err, [AppName]);
format_error({invalid_licenses, Invalids, AppName}) ->
InvalidLicenses = string:join([ "'" ++ L ++ "'" || L <- Invalids], ", "),
Url = "See https://spdx.org/licenses/ for a list of valid license identifiers",
Err = "~ts.app.src : invalid license types detected - ~ts~n~5c~ts",
io_lib:format(Err, [AppName, InvalidLicenses, 32, Url]);
format_error({has_maintainers, AppName}) ->
Err = "~ts.app.src : deprecated field maintainers found",
io_lib:format(Err, [AppName]);
Expand Down Expand Up @@ -407,7 +412,14 @@ validate_app(has_licenses, {_, Name, _, AppDetails, _}) ->
true ->
{error, {no_license, Name}};
_ ->
ok
Licenses = proplists:get_value(licenses, AppDetails),
case lists:filter(fun(L) -> not hex_licenses:valid(rebar_utils:to_binary(L)) end, Licenses) of
[] ->
ok;
[_|_] = Invalids ->
rebar_log:log(warn, format_error({invalid_licenses, Invalids, Name}), []),
ok
end
end.

is_empty_prop(K, PropList) ->
Expand Down

0 comments on commit b863f6a

Please sign in to comment.