mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 19:46:02 +01:00
Merge pull request #14263 from NixOS/hydra-import-paths
Restore `ServeProto::Command::ImportPaths`
This commit is contained in:
commit
721f5572a6
4 changed files with 29 additions and 0 deletions
|
|
@ -82,6 +82,8 @@ struct ServeProto::BasicClientConnection
|
|||
BuildResult getBuildDerivationResponse(const StoreDirConfig & store);
|
||||
|
||||
void narFromPath(const StoreDirConfig & store, const StorePath & path, std::function<void(Source &)> fun);
|
||||
|
||||
void importPaths(const StoreDirConfig & store, std::function<void(Sink &)> fun);
|
||||
};
|
||||
|
||||
struct ServeProto::BasicServerConnection
|
||||
|
|
|
|||
|
|
@ -108,6 +108,13 @@ enum struct ServeProto::Command : uint64_t {
|
|||
QueryValidPaths = 1,
|
||||
QueryPathInfos = 2,
|
||||
DumpStorePath = 3,
|
||||
/**
|
||||
* @note This is no longer used by Nix (as a client), but it is used
|
||||
* by Hydra. We should therefore not remove it until Hydra no longer
|
||||
* uses it either.
|
||||
*/
|
||||
ImportPaths = 4,
|
||||
// ExportPaths = 5,
|
||||
BuildPaths = 6,
|
||||
QueryClosure = 7,
|
||||
BuildDerivation = 8,
|
||||
|
|
|
|||
|
|
@ -93,4 +93,14 @@ void ServeProto::BasicClientConnection::narFromPath(
|
|||
fun(from);
|
||||
}
|
||||
|
||||
void ServeProto::BasicClientConnection::importPaths(const StoreDirConfig & store, std::function<void(Sink &)> fun)
|
||||
{
|
||||
to << ServeProto::Command::ImportPaths;
|
||||
fun(to);
|
||||
to.flush();
|
||||
|
||||
if (readInt(from) != 1)
|
||||
throw Error("remote machine failed to import closure");
|
||||
}
|
||||
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -986,6 +986,16 @@ static void opServe(Strings opFlags, Strings opArgs)
|
|||
store->narFromPath(store->parseStorePath(readString(in)), out);
|
||||
break;
|
||||
|
||||
case ServeProto::Command::ImportPaths: {
|
||||
if (!writeAllowed)
|
||||
throw Error("importing paths is not allowed");
|
||||
// FIXME: should we skip sig checking?
|
||||
importPaths(*store, in, NoCheckSigs);
|
||||
// indicate success
|
||||
out << 1;
|
||||
break;
|
||||
}
|
||||
|
||||
case ServeProto::Command::BuildPaths: {
|
||||
|
||||
if (!writeAllowed)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue