aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-04-26 12:43:42 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-04-26 12:43:42 +0000
commit2398af13c53217b5de5821bac0f0c44e9081c23d (patch)
tree21edf49a39d9a0471b480c3754cce50b33ea4cd2 /src/libstore
parentd66ea83a763a36e7e7b9558b90abcfe09bec1b85 (diff)
* Add an command `nix-store --query-failed-paths' to list the cached
failed paths (when using the `build-cache-failure' option).
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/local-store.cc21
-rw-r--r--src/libstore/local-store.hh4
2 files changed, 25 insertions, 0 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 4d82547c6..f93ba3639 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -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(':');
diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh
index 0c5f04158..70fc64fdc 100644
--- a/src/libstore/local-store.hh
+++ b/src/libstore/local-store.hh
@@ -184,6 +184,9 @@ public:
/* Query whether `path' previously failed to build. */
bool hasPathFailed(const Path & path);
+ /* Return the set of paths that have failed to build.*/
+ PathSet queryFailedPaths();
+
private:
Path schemaPath;
@@ -203,6 +206,7 @@ private:
SQLiteStmt stmtInvalidatePath;
SQLiteStmt stmtRegisterFailedPath;
SQLiteStmt stmtHasPathFailed;
+ SQLiteStmt stmtQueryFailedPaths;
SQLiteStmt stmtAddDerivationOutput;
SQLiteStmt stmtQueryValidDerivers;
SQLiteStmt stmtQueryDerivationOutputs;