Update for Nix Value::type API changes

This updates hydra to be compatible with Nix https://github.com/NixOS/nix/pull/4355.

Along with https://github.com/NixOS/hydra/pull/840 needed for https://github.com/NixOS/nixpkgs/pull/107909

/cc @edolstra
This commit is contained in:
Matthew Bauer 2020-12-29 17:25:51 -06:00
parent bde8d81876
commit d38ef4492e

View file

@ -78,12 +78,12 @@ static std::string queryMetaStrings(EvalState & state, DrvInfo & drv, const stri
rec = [&](Value & v) { rec = [&](Value & v) {
state.forceValue(v); state.forceValue(v);
if (v.type == tString) if (v.type() == nString)
res.push_back(v.string.s); res.push_back(v.string.s);
else if (v.isList()) else if (v.isList())
for (unsigned int n = 0; n < v.listSize(); ++n) for (unsigned int n = 0; n < v.listSize(); ++n)
rec(*v.listElems()[n]); rec(*v.listElems()[n]);
else if (v.type == tAttrs) { else if (v.type() == nAttrs) {
auto a = v.attrs->find(state.symbols.create(subAttribute)); auto a = v.attrs->find(state.symbols.create(subAttribute));
if (a != v.attrs->end()) if (a != v.attrs->end())
res.push_back(state.forceString(*a->value)); res.push_back(state.forceString(*a->value));
@ -201,7 +201,7 @@ static void worker(
for (unsigned int n = 0; n < a->value->listSize(); ++n) { for (unsigned int n = 0; n < a->value->listSize(); ++n) {
auto v = a->value->listElems()[n]; auto v = a->value->listElems()[n];
state.forceValue(*v); state.forceValue(*v);
if (v->type == tString) if (v->type() == nString)
job["namedConstituents"].push_back(state.forceStringNoCtx(*v)); job["namedConstituents"].push_back(state.forceStringNoCtx(*v));
} }
} }
@ -224,7 +224,7 @@ static void worker(
reply["job"] = std::move(job); reply["job"] = std::move(job);
} }
else if (v->type == tAttrs) { else if (v->type() == nAttrs) {
auto attrs = nlohmann::json::array(); auto attrs = nlohmann::json::array();
StringSet ss; StringSet ss;
for (auto & i : v->attrs->lexicographicOrder()) { for (auto & i : v->attrs->lexicographicOrder()) {
@ -238,7 +238,7 @@ static void worker(
reply["attrs"] = std::move(attrs); reply["attrs"] = std::move(attrs);
} }
else if (v->type == tNull) else if (v->type() == nNull)
; ;
else throw TypeError("attribute '%s' is %s, which is not supported", attrPath, showType(*v)); else throw TypeError("attribute '%s' is %s, which is not supported", attrPath, showType(*v));