* Add an command `nix-store --query-failed-paths' to list the cached

failed paths (when using the `build-cache-failure' option).
This commit is contained in:
Eelco Dolstra 2010-04-26 12:43:42 +00:00
parent d66ea83a76
commit 2398af13c5
3 changed files with 39 additions and 3 deletions

View file

@ -327,6 +327,8 @@ void LocalStore::openDB(bool create)
"insert into FailedPaths (path, time) values (?, ?);");
stmtHasPathFailed.create(db,
"select time from FailedPaths where path = ?;");
stmtQueryFailedPaths.create(db,
"select path from FailedPaths;");
stmtAddDerivationOutput.create(db,
"insert or replace into DerivationOutputs (drv, id, path) values (?, ?, ?);");
stmtQueryValidDerivers.create(db,
@ -508,6 +510,25 @@ bool LocalStore::hasPathFailed(const Path & path)
}
PathSet LocalStore::queryFailedPaths()
{
SQLiteStmtUse use(stmtQueryFailedPaths);
PathSet res;
int r;
while ((r = sqlite3_step(stmtQueryFailedPaths)) == SQLITE_ROW) {
const char * s = (const char *) sqlite3_column_text(stmtQueryFailedPaths, 0);
assert(s);
res.insert(s);
}
if (r != SQLITE_DONE)
throw SQLiteError(db, "error querying failed paths");
return res;
}
Hash parseHashField(const Path & path, const string & s)
{
string::size_type colon = s.find(':');