Merge remote-tracking branch 'origin/master' into flake
This commit is contained in:
commit
7c6fd83dda
|
@ -48,7 +48,7 @@ static void openConnection(Machine::ptr machine, Path tmpDir, int stderrFD, Chil
|
||||||
throw SysError("cannot dup stderr");
|
throw SysError("cannot dup stderr");
|
||||||
|
|
||||||
Strings argv;
|
Strings argv;
|
||||||
if (machine->sshName == "localhost") {
|
if (machine->isLocalhost()) {
|
||||||
pgmName = "nix-store";
|
pgmName = "nix-store";
|
||||||
argv = {"nix-store", "--serve", "--write"};
|
argv = {"nix-store", "--serve", "--write"};
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,11 @@ void State::buildRemote(ref<Store> destStore,
|
||||||
remoteVersion = readInt(from);
|
remoteVersion = readInt(from);
|
||||||
if (GET_PROTOCOL_MAJOR(remoteVersion) != 0x200)
|
if (GET_PROTOCOL_MAJOR(remoteVersion) != 0x200)
|
||||||
throw Error(format("unsupported ‘nix-store --serve’ protocol version on ‘%1%’") % machine->sshName);
|
throw Error(format("unsupported ‘nix-store --serve’ protocol version on ‘%1%’") % machine->sshName);
|
||||||
if (GET_PROTOCOL_MINOR(remoteVersion) >= 1)
|
// Always send the derivation to localhost, since it's a
|
||||||
|
// no-op anyway but we might not be privileged to use
|
||||||
|
// cmdBuildDerivation (e.g. if we're running in a NixOS
|
||||||
|
// container).
|
||||||
|
if (GET_PROTOCOL_MINOR(remoteVersion) >= 1 && !machine->isLocalhost())
|
||||||
sendDerivation = false;
|
sendDerivation = false;
|
||||||
if (GET_PROTOCOL_MINOR(remoteVersion) < 3 && repeats > 0)
|
if (GET_PROTOCOL_MINOR(remoteVersion) < 3 && repeats > 0)
|
||||||
throw Error("machine ‘%1%’ does not support repeating a build; please upgrade it to Nix 1.12", machine->sshName);
|
throw Error("machine ‘%1%’ does not support repeating a build; please upgrade it to Nix 1.12", machine->sshName);
|
||||||
|
@ -236,10 +240,11 @@ void State::buildRemote(ref<Store> destStore,
|
||||||
a no-op for regular stores, but for the binary cache store,
|
a no-op for regular stores, but for the binary cache store,
|
||||||
this will copy the inputs to the binary cache from the local
|
this will copy the inputs to the binary cache from the local
|
||||||
store. */
|
store. */
|
||||||
copyClosure(ref<Store>(localStore), destStore, step->drv.inputSrcs, NoRepair, NoCheckSigs);
|
if (localStore != std::shared_ptr<Store>(destStore))
|
||||||
|
copyClosure(ref<Store>(localStore), destStore, step->drv.inputSrcs, NoRepair, NoCheckSigs);
|
||||||
|
|
||||||
/* Copy the input closure. */
|
/* Copy the input closure. */
|
||||||
if (/* machine->sshName != "localhost" */ true) {
|
if (!machine->isLocalhost()) {
|
||||||
auto mc1 = std::make_shared<MaintainCount<counter>>(nrStepsWaiting);
|
auto mc1 = std::make_shared<MaintainCount<counter>>(nrStepsWaiting);
|
||||||
mc1.reset();
|
mc1.reset();
|
||||||
MaintainCount<counter> mc2(nrStepsCopyingTo);
|
MaintainCount<counter> mc2(nrStepsCopyingTo);
|
||||||
|
@ -381,7 +386,9 @@ void State::buildRemote(ref<Store> destStore,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the output paths. */
|
/* Copy the output paths. */
|
||||||
if (/* machine->sshName != "localhost" */ true) {
|
result.accessor = destStore->getFSAccessor();
|
||||||
|
|
||||||
|
if (!machine->isLocalhost() || localStore != std::shared_ptr<Store>(destStore)) {
|
||||||
updateStep(ssReceivingOutputs);
|
updateStep(ssReceivingOutputs);
|
||||||
|
|
||||||
MaintainCount<counter> mc(nrStepsCopyingFrom);
|
MaintainCount<counter> mc(nrStepsCopyingFrom);
|
||||||
|
@ -427,8 +434,6 @@ void State::buildRemote(ref<Store> destStore,
|
||||||
printMsg(lvlError, format("warning: had to wait %d ms for %d memory tokens for %s")
|
printMsg(lvlError, format("warning: had to wait %d ms for %d memory tokens for %s")
|
||||||
% resMs % totalNarSize % step->drvPath);
|
% resMs % totalNarSize % step->drvPath);
|
||||||
|
|
||||||
result.accessor = destStore->getFSAccessor();
|
|
||||||
|
|
||||||
to << cmdExportPaths << 0 << outputs;
|
to << cmdExportPaths << 0 << outputs;
|
||||||
to.flush();
|
to.flush();
|
||||||
destStore->importPaths(from, result.accessor, NoCheckSigs);
|
destStore->importPaths(from, result.accessor, NoCheckSigs);
|
||||||
|
|
|
@ -862,6 +862,9 @@ int main(int argc, char * * argv)
|
||||||
signal(SIGTERM, SIG_DFL);
|
signal(SIGTERM, SIG_DFL);
|
||||||
signal(SIGHUP, SIG_DFL);
|
signal(SIGHUP, SIG_DFL);
|
||||||
|
|
||||||
|
// FIXME: do this in the child environment in openConnection().
|
||||||
|
unsetenv("IN_SYSTEMD");
|
||||||
|
|
||||||
bool unlock = false;
|
bool unlock = false;
|
||||||
bool status = false;
|
bool status = false;
|
||||||
BuildID buildOne = 0;
|
BuildID buildOne = 0;
|
||||||
|
|
|
@ -274,6 +274,11 @@ struct Machine
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isLocalhost()
|
||||||
|
{
|
||||||
|
return sshName == "localhost";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue