summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPierre Fenoll <pierrefenoll@gmail.com>2019-03-17 18:06:28 +0100
committerPierre Fenoll <pierrefenoll@gmail.com>2019-05-06 17:30:38 +0200
commit2c5f95aceb74d1600953e45d3939682010f171ad (patch)
tree342ca54e1976e04cdcb3dbc5e47a0d0f504e9a36 /src
parentec224b7921cda1f9a1ef4373e80e706c173bf75f (diff)
format hex packages in a nice/human way
Signed-off-by: Pierre Fenoll <pierrefenoll@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/rebar_prv_install_deps.erl15
-rw-r--r--src/rebar_resource_v2.erl12
2 files changed, 15 insertions, 12 deletions
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl
index 0187b4f..4bd5805 100644
--- a/src/rebar_prv_install_deps.erl
+++ b/src/rebar_prv_install_deps.erl
@@ -283,7 +283,7 @@ update_seen_dep(AppInfo, _Profile, _Level, Deps, Apps, State, Upgrade, Seen, Loc
%% meaning there is no conflict, so don't warn about it.
skip;
_ ->
- warn_skip_deps(Name, Source, State)
+ warn_skip_deps(AppInfo, State)
end;
true ->
ok
@@ -395,8 +395,7 @@ make_relative_to_root(State, Path) when is_list(Path) ->
rebar_dir:make_relative_path(Path, Root).
fetch_app(AppInfo, State) ->
- ?INFO("Fetching ~ts (~p)", [rebar_app_info:name(AppInfo),
- rebar_resource_v2:format_source(rebar_app_info:source(AppInfo))]),
+ ?INFO("Fetching ~ts", [rebar_resource_v2:format_source(AppInfo)]),
rebar_fetch:download_source(AppInfo, State).
maybe_upgrade(AppInfo, _AppDir, Upgrade, State) ->
@@ -404,8 +403,7 @@ maybe_upgrade(AppInfo, _AppDir, Upgrade, State) ->
true ->
case rebar_fetch:needs_update(AppInfo, State) of
true ->
- ?INFO("Upgrading ~ts (~p)", [rebar_app_info:name(AppInfo),
- rebar_resource_v2:format_source(rebar_app_info:source(AppInfo))]),
+ ?INFO("Upgrading ~ts", [rebar_resource_v2:format_source(AppInfo)]),
rebar_fetch:download_source(AppInfo, State);
false ->
case Upgrade of
@@ -420,11 +418,10 @@ maybe_upgrade(AppInfo, _AppDir, Upgrade, State) ->
AppInfo
end.
-warn_skip_deps(Name, Source, State) ->
- Msg = "Skipping ~ts (from ~p) as an app of the same name "
+warn_skip_deps(AppInfo, State) ->
+ Msg = "Skipping ~ts as an app of the same name "
"has already been fetched",
- Args = [Name,
- rebar_resource_v2:format_source(Source)],
+ Args = [rebar_resource_v2:format_source(AppInfo)],
case rebar_state:get(State, deps_error_on_conflict, false) of
false ->
case rebar_state:get(State, deps_warning_on_conflict, true) of
diff --git a/src/rebar_resource_v2.erl b/src/rebar_resource_v2.erl
index f032f6e..b7ee760 100644
--- a/src/rebar_resource_v2.erl
+++ b/src/rebar_resource_v2.erl
@@ -61,14 +61,20 @@ find_resource(Type, Resources) ->
find_resource_state(Type, Resources) ->
case lists:keyfind(Type, #resource.type, Resources) of
- false ->
+ false ->
{error, not_found};
#resource{state=State} ->
State
end.
-format_source({pkg, Name, Vsn, _Hash, _}) -> {pkg, Name, Vsn};
-format_source(Source) -> Source.
+format_source(AppInfo) ->
+ Name = rebar_app_info:name(AppInfo),
+ case rebar_app_info:source(AppInfo) of
+ {pkg, _Name, Vsn, _Hash, _} ->
+ io_lib:format("~ts v~s", [Name, Vsn]);
+ Source ->
+ io_lib:format("~ts (from ~p)", [Name, Source])
+ end.
lock(AppInfo, State) ->
resource_run(lock, rebar_app_info:source(AppInfo), [AppInfo], State).