From 09a6321aeb7393cdb4b5af62d2e4106d83124fdf Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 11 Jul 2012 17:52:18 -0400 Subject: Replace hasSubstitutes() with querySubstitutablePaths() querySubstitutablePaths() takes a set of paths, so this greatly reduces daemon <-> client latency. --- src/nix-env/nix-env.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/nix-env/nix-env.cc') diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 91b82c0d09e6..f06f23dad523 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -211,9 +211,12 @@ static int comparePriorities(EvalState & state, static bool isPrebuilt(EvalState & state, const DrvInfo & elem) { + assert(false); +#if 0 return store->isValidPath(elem.queryOutPath(state)) || store->hasSubstitutes(elem.queryOutPath(state)); +#endif } @@ -931,8 +934,7 @@ static void opQuery(Globals & globals, /* Query which paths have substitutes. */ - SubstitutablePathInfos subs; - PathSet validPaths; + PathSet validPaths, substitutablePaths; if (printStatus) { PathSet paths; foreach (vector::iterator, i, elems2) @@ -943,7 +945,7 @@ static void opQuery(Globals & globals, i->setFailed(); } validPaths = store->queryValidPaths(paths); - store->querySubstitutablePathInfos(paths, subs); + substitutablePaths = store->querySubstitutablePaths(paths); } @@ -969,7 +971,7 @@ static void opQuery(Globals & globals, if (printStatus) { Path outPath = i->queryOutPath(globals.state); - bool hasSubs = subs.find(outPath) != subs.end(); + bool hasSubs = substitutablePaths.find(outPath) != substitutablePaths.end(); bool isInstalled = installed.find(outPath) != installed.end(); bool isValid = validPaths.find(outPath) != validPaths.end(); if (xmlOutput) { -- cgit 1.4.1