about summary refs log tree commit diff
path: root/src/nix-store
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-07-24T14·00+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-07-24T14·19+0200
commit03103c0a36cc94238542de2bdf6eedcb679cca49 (patch)
tree04ab7ba5b8568937df7331f2347ab5c982517cef /src/nix-store
parent62309a2c56206821370b87285fcacacba1cb3566 (diff)
Implement nix-copy-closure --from via nix-store --serve
Diffstat (limited to 'src/nix-store')
-rw-r--r--src/nix-store/nix-store.cc13
-rw-r--r--src/nix-store/serve-protocol.hh1
2 files changed, 13 insertions, 1 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index f874ffeadc3e..f2621a9954bf 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -993,9 +993,10 @@ static void opServe(Strings opFlags, Strings opArgs)
             }
 
             case cmdExportPaths: {
+                bool sign = readInt(in);
                 Paths sorted = topoSortPaths(*store, readStorePaths<PathSet>(in));
                 reverse(sorted.begin(), sorted.end());
-                exportPaths(*store, sorted, false, out);
+                exportPaths(*store, sorted, sign, out);
                 break;
             }
 
@@ -1025,6 +1026,16 @@ static void opServe(Strings opFlags, Strings opArgs)
                 break;
             }
 
+            case cmdQueryClosure: {
+                bool includeOutputs = readInt(in);
+                PathSet paths = readStorePaths<PathSet>(in);
+                PathSet closure;
+                for (auto & i : paths)
+                    computeFSClosure(*store, i, closure, false, includeOutputs);
+                writeStrings(closure, out);
+                break;
+            }
+
             default:
                 throw Error(format("unknown serve command %1%") % cmd);
         }
diff --git a/src/nix-store/serve-protocol.hh b/src/nix-store/serve-protocol.hh
index eb13b46e51bd..741b622beb17 100644
--- a/src/nix-store/serve-protocol.hh
+++ b/src/nix-store/serve-protocol.hh
@@ -16,6 +16,7 @@ typedef enum {
     cmdImportPaths = 4,
     cmdExportPaths = 5,
     cmdBuildPaths = 6,
+    cmdQueryClosure = 7,
 } ServeCommand;
 
 }