* Allow unprivileged users to do `nix-store --clear-failed-paths' and

`nix-store --query-failed-paths'.
This commit is contained in:
Eelco Dolstra 2010-05-04 10:45:10 +00:00
parent 7fa338f4ba
commit f92c9a0ac5
7 changed files with 51 additions and 5 deletions

View file

@ -184,11 +184,8 @@ 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();
/* Clear the "failed" status of the given paths. The special
value `*' causes all failed paths to be cleared. */
void clearFailedPaths(const PathSet & paths);
private:

View file

@ -451,6 +451,25 @@ void RemoteStore::collectGarbage(const GCOptions & options, GCResults & results)
}
PathSet RemoteStore::queryFailedPaths()
{
openConnection();
writeInt(wopQueryFailedPaths, to);
processStderr();
return readStorePaths(from);
}
void RemoteStore::clearFailedPaths(const PathSet & paths)
{
openConnection();
writeInt(wopClearFailedPaths, to);
writeStringSet(paths, to);
processStderr();
readInt(from);
}
void RemoteStore::processStderr(Sink * sink, Source * source)
{
unsigned int msg;

View file

@ -70,6 +70,10 @@ public:
void collectGarbage(const GCOptions & options, GCResults & results);
PathSet queryFailedPaths();
void clearFailedPaths(const PathSet & paths);
private:
AutoCloseFD fdSocket;
FdSink to;

View file

@ -209,6 +209,13 @@ public:
/* Perform a garbage collection. */
virtual void collectGarbage(const GCOptions & options, GCResults & results) = 0;
/* Return the set of paths that have failed to build.*/
virtual PathSet queryFailedPaths() = 0;
/* Clear the "failed" status of the given paths. The special
value `*' causes all failed paths to be cleared. */
virtual void clearFailedPaths(const PathSet & paths) = 0;
};

View file

@ -36,6 +36,8 @@ typedef enum {
wopQuerySubstitutablePathInfo = 21,
wopQueryDerivationOutputs = 22,
wopQueryValidPaths = 23,
wopQueryFailedPaths = 24,
wopClearFailedPaths = 25,
} WorkerOp;