nix-store --serve: Use dump instead of export

Also remove signing support

Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
Shea Levy 2014-02-07 16:17:52 -05:00
parent 188f96500b
commit 73874629ef
3 changed files with 7 additions and 12 deletions

View file

@ -1,6 +1,7 @@
#include "store-api.hh" #include "store-api.hh"
#include "globals.hh" #include "globals.hh"
#include "util.hh" #include "util.hh"
#include "archive.hh"
#include <climits> #include <climits>
@ -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); string cmd = readString(in);
if (cmd == "query") { if (cmd == "query") {
@ -284,7 +285,7 @@ void StoreAPI::serve(Source & in, Sink & out, bool sign)
throw Error(format("Unknown serve query `%1%'") % cmd); throw Error(format("Unknown serve query `%1%'") % cmd);
} }
} else if (cmd == "substitute") } else if (cmd == "substitute")
exportPath(readString(in), sign, out); dumpPath(readString(in), out);
else else
throw Error(format("Unknown serve command `%1%'") % cmd); throw Error(format("Unknown serve command `%1%'") % cmd);
} }

View file

@ -251,7 +251,7 @@ public:
/* Serve the store for ssh substituters by taking commands /* Serve the store for ssh substituters by taking commands
* from in and printing results to out */ * from in and printing results to out */
void serve(Source & in, Sink & out, bool sign); void serve(Source & in, Sink & out);
}; };

View file

@ -837,18 +837,12 @@ static void opClearFailedPaths(Strings opFlags, Strings opArgs)
// Serve the nix store in a way usable by a restricted ssh user // Serve the nix store in a way usable by a restricted ssh user
static void opServe(Strings opFlags, Strings opArgs) static void opServe(Strings opFlags, Strings opArgs)
{ {
if (!opArgs.empty()) if (!opArgs.empty() || !opFlags.empty())
throw UsageError("no arguments expected"); throw UsageError("no arguments or flags 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);
FdSource in(STDIN_FILENO); FdSource in(STDIN_FILENO);
FdSink out(STDOUT_FILENO); FdSink out(STDOUT_FILENO);
store->serve(in, out, sign); store->serve(in, out);
} }