From 8a590bc34dd4d03c8b86207dc8ce42d647431573 Mon Sep 17 00:00:00 2001 From: Bryan Paxton Date: Tue, 4 Feb 2020 12:31:17 -0600 Subject: [PATCH] address PR feedback --- src/rebar_config.erl | 6 +++--- src/rebar_pkg_resource.erl | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rebar_config.erl b/src/rebar_config.erl index 4494ec5ba..aa5c0ca9d 100644 --- a/src/rebar_config.erl +++ b/src/rebar_config.erl @@ -161,7 +161,7 @@ read_attrs(_Vsn, Locks, Attrs) -> expand_locks(Locks, OldHashes, NewHashes). %% @private extract the package hashes from lockfile attributes, if any. --spec extract_pkg_hashes(list()) -> [binary()]. +-spec extract_pkg_hashes(list()) -> {[binary()], [binary()]}. extract_pkg_hashes(Attrs) -> Props = case Attrs of [First|_] -> First; @@ -190,8 +190,8 @@ write_attrs(Locks) -> %% No attribute known that needs to be taken out of the structure, %% just return terms as is. {NewLocks, OldHashes, NewHashes} = split_locks(Locks, [], [], []), - case OldHashes ++ NewHashes of - [] -> {NewLocks, []}; + case {OldHashes, NewHashes} of + {[], []} -> {NewLocks, []}; _ -> {NewLocks, [{pkg_hash, lists:sort(OldHashes)}, {pkg_hash_ext, lists:sort(NewHashes)}]} end. diff --git a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl index 59c448aa7..54688424b 100644 --- a/src/rebar_pkg_resource.erl +++ b/src/rebar_pkg_resource.erl @@ -260,7 +260,7 @@ serve_from_memory(TmpDir, Binary, {pkg, _Name, _Vsn, OldHash, Hash, _RepoConfig} ?DEBUG("Expected hash ~64.16.0B does not match outer checksum of fetched package ~64.16.0B, but matches inner checksum ~64.16.0B", [RegistryChecksum, Checksum, OldChecksum]), - ok; + {bad_registry_checksum, RegistryChecksum, OldChecksum}; false -> ?DEBUG("Expected hash ~64.16.0B does not match outer checksum or inner checksum of fetched package ~64.16.0B / ~64.16.0B", [RegistryChecksum, Checksum, OldChecksum]),