From 73874629ef59dc3b237a2c316179e722f971bb5e Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Fri, 7 Feb 2014 16:17:52 -0500 Subject: [PATCH] nix-store --serve: Use dump instead of export Also remove signing support Signed-off-by: Shea Levy --- src/libstore/store-api.cc | 5 +++-- src/libstore/store-api.hh | 2 +- src/nix-store/nix-store.cc | 12 +++--------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 082c2c4d9..bd9559075 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -1,6 +1,7 @@ #include "store-api.hh" #include "globals.hh" #include "util.hh" +#include "archive.hh" #include @@ -258,7 +259,7 @@ string StoreAPI::makeValidityRegistration(const PathSet & paths, } -void StoreAPI::serve(Source & in, Sink & out, bool sign) +void StoreAPI::serve(Source & in, Sink & out) { string cmd = readString(in); if (cmd == "query") { @@ -284,7 +285,7 @@ void StoreAPI::serve(Source & in, Sink & out, bool sign) throw Error(format("Unknown serve query `%1%'") % cmd); } } else if (cmd == "substitute") - exportPath(readString(in), sign, out); + dumpPath(readString(in), out); else throw Error(format("Unknown serve command `%1%'") % cmd); } diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 57cf51794..edab6ea5a 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -251,7 +251,7 @@ public: /* Serve the store for ssh substituters by taking commands * from in and printing results to out */ - void serve(Source & in, Sink & out, bool sign); + void serve(Source & in, Sink & out); }; diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index fb1d3f541..e3f27820f 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -837,18 +837,12 @@ static void opClearFailedPaths(Strings opFlags, Strings opArgs) // Serve the nix store in a way usable by a restricted ssh user static void opServe(Strings opFlags, Strings opArgs) { - if (!opArgs.empty()) - throw UsageError("no arguments expected"); - // Could eventually take a username argument? - bool sign; - foreach (Strings::iterator, i, opFlags) - if (*i == "--sign") sign = true; - else throw UsageError(format("unknown flag `%1%'") % *i); - + if (!opArgs.empty() || !opFlags.empty()) + throw UsageError("no arguments or flags expected"); FdSource in(STDIN_FILENO); FdSink out(STDOUT_FILENO); - store->serve(in, out, sign); + store->serve(in, out); }