diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-07-11T14·14-0400 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-07-11T14·14-0400 |
commit | 6586414bc70c8373faefd49afc5172881f3aad53 (patch) | |
tree | bd47b84d0e36b3ef264d410646bb9def4610d816 /src/nix-env/nix-env.cc | |
parent | 5ee8944155f21a0ab5a100a184163d7bd0e72679 (diff) |
nix-env: Determine which paths have substitutes in parallel
Diffstat (limited to 'src/nix-env/nix-env.cc')
-rw-r--r-- | src/nix-env/nix-env.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 7aa6276e3a0a..2fd4246dd297 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -929,6 +929,21 @@ static void opQuery(Globals & globals, installed.insert(i->queryOutPath(globals.state)); } + + /* Query which paths have substitutes. */ + SubstitutablePathInfos subs; + if (printStatus) { + PathSet paths; + foreach (vector<DrvInfo>::iterator, i, elems2) + try { + paths.insert(i->queryOutPath(globals.state)); + } catch (AssertionError & e) { + printMsg(lvlTalkative, format("skipping derivation named `%1%' which gives an assertion failure") % i->name); + i->setFailed(); + } + store->querySubstitutablePathInfos(paths, subs); + } + /* Print the desired columns, or XML output. */ Table table; @@ -938,6 +953,8 @@ static void opQuery(Globals & globals, foreach (vector<DrvInfo>::iterator, i, elems2) { try { + if (i->hasFailed()) continue; + startNest(nest, lvlDebug, format("outputting query result `%1%'") % i->attrPath); if (globals.prebuiltOnly && !isPrebuilt(globals.state, *i)) continue; @@ -949,7 +966,7 @@ static void opQuery(Globals & globals, XMLAttrs attrs; if (printStatus) { - bool hasSubs = store->hasSubstitutes(i->queryOutPath(globals.state)); + bool hasSubs = subs.find(i->queryOutPath(globals.state)) != subs.end(); bool isInstalled = installed.find(i->queryOutPath(globals.state)) != installed.end(); bool isValid = store->isValidPath(i->queryOutPath(globals.state)); if (xmlOutput) { |