about summary refs log tree commit diff
path: root/third_party/nix/src/nix-env
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-22T00·58+0100
committerVincent Ambo <tazjin@google.com>2020-05-22T00·59+0100
commit986a8f6b75ffa51682cbe730c5c2907296082cd4 (patch)
tree32c266920223bbfbf0beb49689dc05cb8eb1f2b7 /third_party/nix/src/nix-env
parent42205f27fc820ddc64616d55c04e2ffde1948043 (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-env')
-rw-r--r--third_party/nix/src/nix-env/nix-env.cc5
-rw-r--r--third_party/nix/src/nix-env/user-env.cc4
2 files changed, 4 insertions, 5 deletions
diff --git a/third_party/nix/src/nix-env/nix-env.cc b/third_party/nix/src/nix-env/nix-env.cc
index 93a8e4c1ec..a645fa3148 100644
--- a/third_party/nix/src/nix-env/nix-env.cc
+++ b/third_party/nix/src/nix-env/nix-env.cc
@@ -1209,13 +1209,12 @@ static void opQuery(Globals& globals, Strings opFlags, Strings opArgs) {
                   attrs2["type"] = "strings";
                   XMLOpenElement m(xml, "meta", attrs2);
                   Bindings& attrs = *v->attrs;
-                  for (auto& i : attrs) {
-                    Attr& a(*attrs.find(i.name));
+                  for (auto& [name, a] : attrs) {
                     if (a.value->type != tString) {
                       continue;
                     }
                     XMLAttrs attrs3;
-                    attrs3["type"] = i.name;
+                    attrs3["type"] = name;
                     attrs3["value"] = a.value->string.s;
                     xml.writeEmptyElement("string", attrs3);
                   }
diff --git a/third_party/nix/src/nix-env/user-env.cc b/third_party/nix/src/nix-env/user-env.cc
index adff263ff4..21e7d42e88 100644
--- a/third_party/nix/src/nix-env/user-env.cc
+++ b/third_party/nix/src/nix-env/user-env.cc
@@ -129,11 +129,11 @@ bool createUserEnv(EvalState& state, DrvInfos& elems, const Path& profile,
   DLOG(INFO) << "evaluating user environment builder";
   state.forceValue(topLevel);
   PathSet context;
-  Attr& aDrvPath(*topLevel.attrs->find(state.sDrvPath));
+  Attr& aDrvPath(topLevel.attrs->find(state.sDrvPath)->second);
   Path topLevelDrv =
       state.coerceToPath(aDrvPath.pos != nullptr ? *(aDrvPath.pos) : noPos,
                          *(aDrvPath.value), context);
-  Attr& aOutPath(*topLevel.attrs->find(state.sOutPath));
+  Attr& aOutPath(topLevel.attrs->find(state.sOutPath)->second);
   Path topLevelOut =
       state.coerceToPath(aOutPath.pos != nullptr ? *(aOutPath.pos) : noPos,
                          *(aOutPath.value), context);