forked from lix-project/hydra
Handle attrsets in meta.license (i.e. lib.licenses)
This commit is contained in:
parent
b8ff29f0db
commit
4b31b23c04
|
@ -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)
|
||||||
{
|
{
|
||||||
|
Strings res;
|
||||||
|
std::function<void(Value & v)> rec;
|
||||||
|
|
||||||
|
rec = [&](Value & v) {
|
||||||
|
state.forceValue(v);
|
||||||
|
if (v.type == tString)
|
||||||
|
res.push_back(v.string.s);
|
||||||
|
else if (v.isList())
|
||||||
|
for (unsigned int n = 0; n < v.listSize(); ++n)
|
||||||
|
rec(*v.listElems()[n]);
|
||||||
|
else if (v.type == tAttrs) {
|
||||||
|
auto a = v.attrs->find(state.symbols.create("shortName"));
|
||||||
|
if (a != v.attrs->end())
|
||||||
|
res.push_back(state.forceString(*a->value));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Value * v = drv.queryMeta(name);
|
Value * v = drv.queryMeta(name);
|
||||||
if (v) {
|
if (v) rec(*v);
|
||||||
state.forceValue(*v);
|
|
||||||
if (v->type == tString)
|
return concatStringsSep(", ", res);
|
||||||
return v->string.s;
|
|
||||||
else if (v->isList()) {
|
|
||||||
string res = "";
|
|
||||||
for (unsigned int n = 0; n < v->listSize(); ++n) {
|
|
||||||
Value v2(*v->listElems()[n]);
|
|
||||||
state.forceValue(v2);
|
|
||||||
if (v2.type == tString) {
|
|
||||||
if (res.size() != 0) res += ", ";
|
|
||||||
res += v2.string.s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue