This commit is contained in:
Eelco Dolstra 2009-07-07 13:20:00 +00:00
parent 3e192cbb90
commit 6bcdfc8a1f
2 changed files with 31 additions and 9 deletions

View file

@ -2,4 +2,4 @@ NIX = /home/eelco/Dev/nix/inst
ATERM = /home/eelco/Dev/nix/externals/inst-aterm
hydra_eval_jobs: hydra_eval_jobs.cc
libtool --mode=link g++ -o hydra_eval_jobs hydra_eval_jobs.cc -I$(NIX)/include/nix -I$(ATERM)/include -L$(NIX)/lib/nix/ -lmain -lexpr -L$(ATERM)/lib -lATerm
libtool --mode=link g++ -o hydra_eval_jobs hydra_eval_jobs.cc -I$(NIX)/include/nix -I$(ATERM)/include -L$(NIX)/lib/nix/ -lmain -lexpr -L$(ATERM)/lib -lATerm -Wall

View file

@ -44,7 +44,7 @@ static void tryJobAlts(EvalState & state, XMLWriter & doc,
return;
}
Expr name, def; ATerm def2; ATermList values;
Expr name; ATerm def2; ATermList values;
if (!matchFormal(ATgetFirst(formals), name, def2)) abort();
if ((values = (ATermList) argsLeft.get(name))) {
@ -78,6 +78,26 @@ static void showArgsUsed(XMLWriter & doc, const ATermMap & argsUsed)
}
static string queryMetaFieldString(MetaInfo & meta, const string & name)
{
MetaValue value = meta[name];
if (value.type != MetaValue::tpString) return "";
return value.stringValue;
}
static int queryMetaFieldInt(MetaInfo & meta, const string & name, int def)
{
MetaValue value = meta[name];
if (value.type == MetaValue::tpInt) return value.intValue;
if (value.type == MetaValue::tpString) {
int n;
if (string2Int(value.stringValue, n)) return n;
}
return def;
}
static void findJobsWrapped(EvalState & state, XMLWriter & doc,
const ATermMap & argsUsed, const ATermMap & argsLeft,
Expr e, const string & attrPath)
@ -86,7 +106,7 @@ static void findJobsWrapped(EvalState & state, XMLWriter & doc,
e = evalExpr(state, e);
ATermList as, es, formals;
ATermList as, formals;
ATermBool ellipsis;
ATerm pat, body, pos;
string s;
@ -107,11 +127,13 @@ static void findJobsWrapped(EvalState & state, XMLWriter & doc,
xmlAttrs["system"] = drv.system;
xmlAttrs["drvPath"] = drvPath = drv.queryDrvPath(state);
xmlAttrs["outPath"] = drv.queryOutPath(state);
xmlAttrs["description"] = drv.queryMetaInfo(state, "description");
xmlAttrs["longDescription"] = drv.queryMetaInfo(state, "longDescription");
xmlAttrs["license"] = drv.queryMetaInfo(state, "license");
xmlAttrs["homepage"] = drv.queryMetaInfo(state, "homepage");
xmlAttrs["schedulingPriority"] = drv.queryMetaInfo(state, "schedulingPriority");
MetaInfo meta = drv.queryMetaInfo(state);
xmlAttrs["description"] = queryMetaFieldString(meta, "description");
xmlAttrs["longDescription"] = queryMetaFieldString(meta, "longDescription");
xmlAttrs["license"] = queryMetaFieldString(meta, "license");
xmlAttrs["homepage"] = queryMetaFieldString(meta, "homepage");
int prio = queryMetaFieldInt(meta, "schedulingPriority", 100);
xmlAttrs["schedulingPriority"] = int2String(prio);
/* Register the derivation as a GC root. !!! This
registers roots for jobs that we may have already