Handle attrsets in meta.license (i.e. lib.licenses)

This commit is contained in:
Eelco Dolstra 2015-10-08 11:56:30 +02:00
parent b8ff29f0db
commit 4b31b23c04

View file

@ -71,25 +71,27 @@ static void tryJobAlts(EvalState & state, JSONObject & top,
static string queryMetaStrings(EvalState & state, DrvInfo & drv, const string & name) static string queryMetaStrings(EvalState & state, DrvInfo & drv, const string & name)
{ {
Value * v = drv.queryMeta(name); Strings res;
if (v) { std::function<void(Value & v)> rec;
state.forceValue(*v);
if (v->type == tString) rec = [&](Value & v) {
return v->string.s; state.forceValue(v);
else if (v->isList()) { if (v.type == tString)
string res = ""; res.push_back(v.string.s);
for (unsigned int n = 0; n < v->listSize(); ++n) { else if (v.isList())
Value v2(*v->listElems()[n]); for (unsigned int n = 0; n < v.listSize(); ++n)
state.forceValue(v2); rec(*v.listElems()[n]);
if (v2.type == tString) { else if (v.type == tAttrs) {
if (res.size() != 0) res += ", "; auto a = v.attrs->find(state.symbols.create("shortName"));
res += v2.string.s; if (a != v.attrs->end())
} res.push_back(state.forceString(*a->value));
}
return res;
} }
} };
return "";
Value * v = drv.queryMeta(name);
if (v) rec(*v);
return concatStringsSep(", ", res);
} }