From a9d99ab55fdaa1c9dde87eaa8d289ecdb8cf9068 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 14 Feb 2014 12:31:10 +0100 Subject: [PATCH] download-via-ssh: Use readStorePath --- src/download-via-ssh/download-via-ssh.cc | 13 ++++++++++--- src/nix-store/nix-store.cc | 5 +++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/download-via-ssh/download-via-ssh.cc b/src/download-via-ssh/download-via-ssh.cc index 86cbb2057..6361e71e9 100644 --- a/src/download-via-ssh/download-via-ssh.cc +++ b/src/download-via-ssh/download-via-ssh.cc @@ -5,6 +5,8 @@ #include "affinity.hh" #include "globals.hh" #include "serve-protocol.hh" +#include "worker-protocol.hh" +#include "store-api.hh" #include #include @@ -82,10 +84,15 @@ static void query(std::pair & pipes) writeInt(qCmdInfo, pipes.first); writeStrings(tokenized, pipes.first); pipes.first.flush(); - for (Path path = readString(pipes.second); !path.empty(); path = readString(pipes.second)) { + while (1) { + Path path = readString(pipes.second); + if (path.empty()) break; + assertStorePath(path); std::cout << path << std::endl; - std::cout << readString(pipes.second) << std::endl; - PathSet references = readStrings(pipes.second); + string deriver = readString(pipes.second); + if (!deriver.empty()) assertStorePath(deriver); + std::cout << deriver << std::endl; + PathSet references = readStorePaths(pipes.second); std::cout << references.size() << std::endl; foreach (PathSet::iterator, i, references) std::cout << *i << std::endl; diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index f017b9ead..365ffa19a 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -7,6 +7,7 @@ #include "local-store.hh" #include "util.hh" #include "serve-protocol.hh" +#include "worker-protocol.hh" #include #include @@ -864,12 +865,12 @@ static void opServe(Strings opFlags, Strings opArgs) } switch (qCmd) { case qCmdHave: { - PathSet paths = readStrings(in); + PathSet paths = readStorePaths(in); writeStrings(store->queryValidPaths(paths), out); break; } case qCmdInfo: { - PathSet paths = readStrings(in); + PathSet paths = readStorePaths(in); // !!! Maybe we want a queryPathInfos? foreach (PathSet::iterator, i, paths) { if (!store->isValidPath(*i))