1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-21 01:39:36 +01:00

* Revert r19650 (implement gc-keep-outputs by looking for derivations

with the same name as the output) and instead use the
  DerivationOutputs table in the database, which is the correct way to
  to do things.
This commit is contained in:
Eelco Dolstra 2010-02-22 11:44:17 +00:00
parent 299ff64812
commit 103cfee056
5 changed files with 34 additions and 74 deletions

View file

@ -297,6 +297,8 @@ void LocalStore::prepareStatements()
"select time from FailedPaths where path = ?;");
stmtAddDerivationOutput.create(db,
"insert or replace into DerivationOutputs (drv, id, path) values (?, ?, ?);");
stmtQueryValidDerivers.create(db,
"select v.id, v.path from DerivationOutputs d join ValidPaths v on d.drv = v.id where d.path = ?;");
}
@ -599,6 +601,28 @@ Path LocalStore::queryDeriver(const Path & path)
}
PathSet LocalStore::queryValidDerivers(const Path & path)
{
assertStorePath(path);
SQLiteStmtUse use(stmtQueryValidDerivers);
stmtQueryValidDerivers.bind(path);
PathSet derivers;
int r;
while ((r = sqlite3_step(stmtQueryValidDerivers)) == SQLITE_ROW) {
const char * s = (const char *) sqlite3_column_text(stmtQueryValidDerivers, 1);
assert(s);
derivers.insert(s);
}
if (r != SQLITE_DONE)
throw SQLiteError(db, format("error getting valid derivers of `%1%'") % path);
return derivers;
}
void LocalStore::startSubstituter(const Path & substituter, RunningSubstituter & run)
{
if (run.pid != -1) return;