diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-22T00·58+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-22T00·59+0100 |
commit | 986a8f6b75ffa51682cbe730c5c2907296082cd4 (patch) | |
tree | 32c266920223bbfbf0beb49689dc05cb8eb1f2b7 /third_party/nix/src/nix-prefetch-url | |
parent | 42205f27fc820ddc64616d55c04e2ffde1948043 (diff) |
fix(3p/nix): Update for usage of new attribute set API r/802
The new attribute set API uses the iterators of the btree_map directly. This requires changes in various files because the internals of libexpr are very entangled. This code runs and compiles, but there is a bug causing empty attribute sets to be assigned incorrectly.
Diffstat (limited to 'third_party/nix/src/nix-prefetch-url')
-rw-r--r-- | third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc b/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc index 17341e382d1a..fa88dc9bc67e 100644 --- a/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc +++ b/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc @@ -43,13 +43,13 @@ string resolveMirrorUri(EvalState& state, string uri) { if (mirrorList == vMirrors.attrs->end()) { throw Error(format("unknown mirror name '%1%'") % mirrorName); } - state.forceList(*mirrorList->value); + state.forceList(*mirrorList->second.value); - if (mirrorList->value->listSize() < 1) { + if (mirrorList->second.value->listSize() < 1) { throw Error(format("mirror URI '%1%' did not expand to anything") % uri); } - string mirror = state.forceString(*mirrorList->value->listElems()[0]); + string mirror = state.forceString(*mirrorList->second.value->listElems()[0]); return mirror + (hasSuffix(mirror, "/") ? "" : "/") + string(s, p + 1); } @@ -130,25 +130,25 @@ static int _main(int argc, char** argv) { if (attr == v.attrs->end()) { throw Error("attribute set does not contain a 'urls' attribute"); } - state->forceList(*attr->value); - if (attr->value->listSize() < 1) { + state->forceList(*attr->second.value); + if (attr->second.value->listSize() < 1) { throw Error("'urls' list is empty"); } - uri = state->forceString(*attr->value->listElems()[0]); + uri = state->forceString(*attr->second.value->listElems()[0]); /* Extract the hash mode. */ attr = v.attrs->find(state->symbols.Create("outputHashMode")); if (attr == v.attrs->end()) { LOG(WARNING) << "this does not look like a fetchurl call"; } else { - unpack = state->forceString(*attr->value) == "recursive"; + unpack = state->forceString(*attr->second.value) == "recursive"; } /* Extract the name. */ if (name.empty()) { attr = v.attrs->find(state->symbols.Create("name")); if (attr != v.attrs->end()) { - name = state->forceString(*attr->value); + name = state->forceString(*attr->second.value); } } } |