Fix the ‘--prebuilt-only’ flag
This commit is contained in:
parent
4bb4d5479a
commit
d62fc71b85
1 changed files with 11 additions and 8 deletions
|
@ -212,14 +212,14 @@ static int comparePriorities(EvalState & state,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// FIXME: this function is rather slow since it checks a single path
|
||||||
|
// at a time.
|
||||||
static bool isPrebuilt(EvalState & state, const DrvInfo & elem)
|
static bool isPrebuilt(EvalState & state, const DrvInfo & elem)
|
||||||
{
|
{
|
||||||
assert(false);
|
Path path = elem.queryOutPath(state);
|
||||||
#if 0
|
if (store->isValidPath(path)) return true;
|
||||||
return
|
PathSet ps = store->querySubstitutablePaths(singleton<PathSet>(path));
|
||||||
store->isValidPath(elem.queryOutPath(state)) ||
|
return ps.find(path) != ps.end();
|
||||||
store->hasSubstitutes(elem.queryOutPath(state));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -938,7 +938,7 @@ static void opQuery(Globals & globals,
|
||||||
|
|
||||||
/* Query which paths have substitutes. */
|
/* Query which paths have substitutes. */
|
||||||
PathSet validPaths, substitutablePaths;
|
PathSet validPaths, substitutablePaths;
|
||||||
if (printStatus) {
|
if (printStatus || globals.prebuiltOnly) {
|
||||||
PathSet paths;
|
PathSet paths;
|
||||||
foreach (vector<DrvInfo>::iterator, i, elems2)
|
foreach (vector<DrvInfo>::iterator, i, elems2)
|
||||||
try {
|
try {
|
||||||
|
@ -964,7 +964,10 @@ static void opQuery(Globals & globals,
|
||||||
|
|
||||||
startNest(nest, lvlDebug, format("outputting query result `%1%'") % i->attrPath);
|
startNest(nest, lvlDebug, format("outputting query result `%1%'") % i->attrPath);
|
||||||
|
|
||||||
if (globals.prebuiltOnly && !isPrebuilt(globals.state, *i)) continue;
|
if (globals.prebuiltOnly &&
|
||||||
|
validPaths.find(i->queryOutPath(globals.state)) == validPaths.end() &&
|
||||||
|
substitutablePaths.find(i->queryOutPath(globals.state)) == substitutablePaths.end())
|
||||||
|
continue;
|
||||||
|
|
||||||
/* For table output. */
|
/* For table output. */
|
||||||
Strings columns;
|
Strings columns;
|
||||||
|
|
Loading…
Reference in a new issue