This commit is contained in:
Eelco Dolstra 2013-09-03 11:04:21 +00:00
parent 6f809194d7
commit 06bb2d95b4

View file

@ -39,44 +39,46 @@ void processExpr(EvalState & state, const Strings & attrPaths,
bool parseOnly, bool strict, Bindings & autoArgs, bool parseOnly, bool strict, Bindings & autoArgs,
bool evalOnly, bool xmlOutput, bool location, Expr * e) bool evalOnly, bool xmlOutput, bool location, Expr * e)
{ {
if (parseOnly) if (parseOnly) {
std::cout << format("%1%\n") % *e; std::cout << format("%1%\n") % *e;
else return;
foreach (Strings::const_iterator, i, attrPaths) { }
Value v;
findAlongAttrPath(state, *i, autoArgs, e, v);
state.forceValue(v);
PathSet context; foreach (Strings::const_iterator, i, attrPaths) {
if (evalOnly) Value v;
if (xmlOutput) findAlongAttrPath(state, *i, autoArgs, e, v);
printValueAsXML(state, strict, location, v, std::cout, context); state.forceValue(v);
else {
if (strict) state.strictForceValue(v); PathSet context;
std::cout << v << std::endl; if (evalOnly)
} if (xmlOutput)
printValueAsXML(state, strict, location, v, std::cout, context);
else { else {
DrvInfos drvs; if (strict) state.strictForceValue(v);
getDerivations(state, v, "", autoArgs, drvs, false); std::cout << v << std::endl;
foreach (DrvInfos::iterator, i, drvs) { }
Path drvPath = i->queryDrvPath(state); else {
DrvInfos drvs;
getDerivations(state, v, "", autoArgs, drvs, false);
foreach (DrvInfos::iterator, i, drvs) {
Path drvPath = i->queryDrvPath(state);
/* What output do we want? */ /* What output do we want? */
string outputName = i->queryOutputName(state); string outputName = i->queryOutputName(state);
if (outputName == "") if (outputName == "")
throw Error(format("derivation `%1%' lacks an `outputName' attribute ") % drvPath); throw Error(format("derivation `%1%' lacks an `outputName' attribute ") % drvPath);
if (gcRoot == "") if (gcRoot == "")
printGCWarning(); printGCWarning();
else { else {
Path rootName = gcRoot; Path rootName = gcRoot;
if (++rootNr > 1) rootName += "-" + int2String(rootNr); if (++rootNr > 1) rootName += "-" + int2String(rootNr);
drvPath = addPermRoot(*store, drvPath, rootName, indirectRoot); drvPath = addPermRoot(*store, drvPath, rootName, indirectRoot);
}
std::cout << format("%1%%2%\n") % drvPath % (outputName != "out" ? "!" + outputName : "");
} }
std::cout << format("%1%%2%\n") % drvPath % (outputName != "out" ? "!" + outputName : "");
} }
} }
}
} }