From 986a8f6b75ffa51682cbe730c5c2907296082cd4 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 22 May 2020 01:58:12 +0100 Subject: fix(3p/nix): Update for usage of new attribute set API 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. --- third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'third_party/nix/src/nix-prefetch-url') 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 17341e382d..fa88dc9bc6 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); } } } -- cgit 1.4.1