forked from lix-project/hydra
hydra-eval-jobs: Support meta.license being a list
TODO: PostgreSQL has an array column type, we should use it for the license and maintainers columns.
This commit is contained in:
parent
484bcd10e2
commit
32b6ddf772
1 changed files with 18 additions and 13 deletions
|
@ -109,6 +109,22 @@ static int queryMetaFieldInt(MetaInfo & meta, const string & name, int def)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static string queryMetaField(MetaInfo & meta, const string & name)
|
||||||
|
{
|
||||||
|
string res;
|
||||||
|
MetaValue value = meta[name];
|
||||||
|
if (value.type == MetaValue::tpString)
|
||||||
|
res = value.stringValue;
|
||||||
|
else if (value.type == MetaValue::tpStrings) {
|
||||||
|
foreach (Strings::const_iterator, i, value.stringValues) {
|
||||||
|
if (res.size() != 0) res += ", ";
|
||||||
|
res += *i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void findJobsWrapped(EvalState & state, XMLWriter & doc,
|
static void findJobsWrapped(EvalState & state, XMLWriter & doc,
|
||||||
const ArgsUsed & argsUsed, const AutoArgs & argsLeft,
|
const ArgsUsed & argsUsed, const AutoArgs & argsLeft,
|
||||||
Value & v, const string & attrPath)
|
Value & v, const string & attrPath)
|
||||||
|
@ -136,8 +152,9 @@ static void findJobsWrapped(EvalState & state, XMLWriter & doc,
|
||||||
MetaInfo meta = drv.queryMetaInfo(state);
|
MetaInfo meta = drv.queryMetaInfo(state);
|
||||||
xmlAttrs["description"] = queryMetaFieldString(meta, "description");
|
xmlAttrs["description"] = queryMetaFieldString(meta, "description");
|
||||||
xmlAttrs["longDescription"] = queryMetaFieldString(meta, "longDescription");
|
xmlAttrs["longDescription"] = queryMetaFieldString(meta, "longDescription");
|
||||||
xmlAttrs["license"] = queryMetaFieldString(meta, "license");
|
xmlAttrs["license"] = queryMetaField(meta, "license");
|
||||||
xmlAttrs["homepage"] = queryMetaFieldString(meta, "homepage");
|
xmlAttrs["homepage"] = queryMetaFieldString(meta, "homepage");
|
||||||
|
xmlAttrs["maintainers"] = queryMetaField(meta, "maintainers");
|
||||||
|
|
||||||
int prio = queryMetaFieldInt(meta, "schedulingPriority", 100);
|
int prio = queryMetaFieldInt(meta, "schedulingPriority", 100);
|
||||||
xmlAttrs["schedulingPriority"] = int2String(prio);
|
xmlAttrs["schedulingPriority"] = int2String(prio);
|
||||||
|
@ -148,18 +165,6 @@ static void findJobsWrapped(EvalState & state, XMLWriter & doc,
|
||||||
int maxsilent = queryMetaFieldInt(meta, "maxSilent", 3600);
|
int maxsilent = queryMetaFieldInt(meta, "maxSilent", 3600);
|
||||||
xmlAttrs["maxSilent"] = int2String(maxsilent);
|
xmlAttrs["maxSilent"] = int2String(maxsilent);
|
||||||
|
|
||||||
string maintainers;
|
|
||||||
MetaValue value = meta["maintainers"];
|
|
||||||
if (value.type == MetaValue::tpString)
|
|
||||||
maintainers = value.stringValue;
|
|
||||||
else if (value.type == MetaValue::tpStrings) {
|
|
||||||
foreach (Strings::const_iterator, i, value.stringValues) {
|
|
||||||
if (maintainers.size() != 0) maintainers += ", ";
|
|
||||||
maintainers += *i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
xmlAttrs["maintainers"] = maintainers;
|
|
||||||
|
|
||||||
/* If this is an aggregate, then get its constituents. */
|
/* If this is an aggregate, then get its constituents. */
|
||||||
Bindings::iterator a = v.attrs->find(state.symbols.create("_hydraAggregate"));
|
Bindings::iterator a = v.attrs->find(state.symbols.create("_hydraAggregate"));
|
||||||
if (a != v.attrs->end() && state.forceBool(*a->value)) {
|
if (a != v.attrs->end() && state.forceBool(*a->value)) {
|
||||||
|
|
Loading…
Reference in a new issue