summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2015-11-17 20:03:29 -0500
committerFred Hebert <mononcqc@ferd.ca>2015-11-17 20:03:29 -0500
commitb11c49691413da012206b90196b701f700ce690f (patch)
treeffa53df448580ce604e91cfb46b795bd5df82584
parent2ad29faaf9e2f4247d1b142f39fb20ea002e0a42 (diff)
parentd4e876500772657a5a6339905d82424c81d73d2a (diff)
Merge pull request #924 from tsloughter/pgks_fix
only add package list of versions to registry if it has the right build tool support
-rw-r--r--src/rebar_prv_update.erl16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl
index 6637ebe..33d757a 100644
--- a/src/rebar_prv_update.erl
+++ b/src/rebar_prv_update.erl
@@ -92,12 +92,24 @@ hex_to_index(State) ->
false ->
true
end;
- ({Pkg, [Vsns]}, _) when is_binary(Pkg) ->
- ets:insert(?PACKAGE_TABLE, {Pkg, Vsns});
(_, _) ->
true
end, true, Registry),
+ ets:foldl(fun({Pkg, [[]]}, _) when is_binary(Pkg) ->
+ true;
+ ({Pkg, [Vsns=[Vsn | _Rest]]}, _) when is_binary(Pkg) ->
+ %% Verify the package is of the right build tool by checking if the first
+ %% version exists in the table from the foldl above
+ case ets:member(?PACKAGE_TABLE, {Pkg, Vsn}) of
+ true ->
+ ets:insert(?PACKAGE_TABLE, {Pkg, Vsns});
+ false ->
+ true
+ end;
+ (_, _) ->
+ true
+ end, true, Registry),
ets:insert(?PACKAGE_TABLE, {package_index_version, ?PACKAGE_INDEX_VERSION}),
?INFO("Writing index to ~s", [PackageIndex]),
ets:tab2file(?PACKAGE_TABLE, PackageIndex),