about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-05-04T10·45+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-05-04T10·45+0000
commitf92c9a0ac585d30e245c6667cbce4b035659cb11 (patch)
tree4c9d10130d3ce67a4ca724170614f09a404e16aa /src/libstore
parent7fa338f4bac16f83b65b95fb0397b534d5ba5d5b (diff)
* Allow unprivileged users to do `nix-store --clear-failed-paths' and
  `nix-store --query-failed-paths'.

Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/local-store.hh3
-rw-r--r--src/libstore/remote-store.cc19
-rw-r--r--src/libstore/remote-store.hh4
-rw-r--r--src/libstore/store-api.hh7
-rw-r--r--src/libstore/worker-protocol.hh2
5 files changed, 32 insertions, 3 deletions
diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh
index 2fd640e398c4..c1e0e335f225 100644
--- a/src/libstore/local-store.hh
+++ b/src/libstore/local-store.hh
@@ -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:
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index c5d7975b521b..334ad95cf9df 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -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;
diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh
index 8bab1d8c4857..02a1c475252d 100644
--- a/src/libstore/remote-store.hh
+++ b/src/libstore/remote-store.hh
@@ -70,6 +70,10 @@ public:
 
     void collectGarbage(const GCOptions & options, GCResults & results);
     
+    PathSet queryFailedPaths();
+
+    void clearFailedPaths(const PathSet & paths);
+    
 private:
     AutoCloseFD fdSocket;
     FdSink to;
diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh
index 095fdd24bb28..fbe0cce81e94 100644
--- a/src/libstore/store-api.hh
+++ b/src/libstore/store-api.hh
@@ -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;
 };
 
 
diff --git a/src/libstore/worker-protocol.hh b/src/libstore/worker-protocol.hh
index c3096010b6c4..392a69acf654 100644
--- a/src/libstore/worker-protocol.hh
+++ b/src/libstore/worker-protocol.hh
@@ -36,6 +36,8 @@ typedef enum {
     wopQuerySubstitutablePathInfo = 21,
     wopQueryDerivationOutputs = 22,
     wopQueryValidPaths = 23,
+    wopQueryFailedPaths = 24,
+    wopClearFailedPaths = 25,
 } WorkerOp;