summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rebar_prv_update.erl18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl
index ff7194a..75c609e 100644
--- a/src/rebar_prv_update.erl
+++ b/src/rebar_prv_update.erl
@@ -104,7 +104,8 @@ hex_to_index(State) ->
case lists:any(fun is_supported/1, BuildTools) of
true ->
DepsList = update_deps_list(Pkg, PkgVsn, Deps, Registry, State),
- ets:insert(?PACKAGE_TABLE, {{Pkg, PkgVsn}, DepsList, Checksum});
+ HashedDeps = update_deps_hashes(DepsList),
+ ets:insert(?PACKAGE_TABLE, {{Pkg, PkgVsn}, HashedDeps, Checksum});
false ->
true
end;
@@ -176,6 +177,21 @@ update_deps_list(Pkg, PkgVsn, Deps, HexRegistry, State) ->
DepsListAcc
end, [], Deps).
+update_deps_hashes(List) ->
+ [{Name, {pkg, PkgName, Vsn, lookup_hash(PkgName, Vsn, Hash)}}
+ || {Name, {pkg, PkgName, Vsn, Hash}} <- List].
+
+lookup_hash(Name, Vsn, undefined) ->
+ try
+ ets:lookup_element(?PACKAGE_TABLE, {Name, Vsn}, 3)
+ catch
+ _:_ ->
+ undefined
+ end;
+lookup_hash(_, _, Hash) ->
+ Hash.
+
+
rm_ws(<<" ", R/binary>>) ->
rm_ws(R);
rm_ws(R) ->