2016-07-19 01:50:27 +03:00
|
|
|
|
#include <cstdlib>
|
|
|
|
|
#include <cstring>
|
|
|
|
|
#include <algorithm>
|
2017-01-10 17:29:06 +02:00
|
|
|
|
#include <set>
|
2016-07-19 01:50:27 +03:00
|
|
|
|
#include <memory>
|
|
|
|
|
#include <tuple>
|
|
|
|
|
#include <iomanip>
|
2017-01-24 14:57:26 +02:00
|
|
|
|
#if __APPLE__
|
2017-01-24 13:22:02 +02:00
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
#endif
|
2016-07-19 01:50:27 +03:00
|
|
|
|
|
2017-05-02 14:17:37 +03:00
|
|
|
|
#include "machines.hh"
|
2016-07-19 01:50:27 +03:00
|
|
|
|
#include "shared.hh"
|
|
|
|
|
#include "pathlocks.hh"
|
|
|
|
|
#include "globals.hh"
|
|
|
|
|
#include "serialise.hh"
|
|
|
|
|
#include "store-api.hh"
|
|
|
|
|
#include "derivations.hh"
|
2017-10-23 20:06:55 +03:00
|
|
|
|
#include "local-store.hh"
|
2021-01-26 13:22:24 +02:00
|
|
|
|
#include "legacy.hh"
|
2021-10-25 16:53:01 +03:00
|
|
|
|
#include "experimental-features.hh"
|
2016-07-19 01:50:27 +03:00
|
|
|
|
|
|
|
|
|
using namespace nix;
|
|
|
|
|
using std::cin;
|
|
|
|
|
|
2017-03-03 17:18:49 +02:00
|
|
|
|
static void handleAlarm(int sig) {
|
2016-07-19 01:50:27 +03:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-01 18:35:30 +03:00
|
|
|
|
std::string escapeUri(std::string uri)
|
|
|
|
|
{
|
|
|
|
|
std::replace(uri.begin(), uri.end(), '/', '_');
|
|
|
|
|
return uri;
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-25 17:00:00 +02:00
|
|
|
|
static std::string currentLoad;
|
2016-07-19 01:50:27 +03:00
|
|
|
|
|
2020-07-30 14:10:49 +03:00
|
|
|
|
static AutoCloseFD openSlotLock(const Machine & m, uint64_t slot)
|
2017-01-24 16:28:50 +02:00
|
|
|
|
{
|
2017-05-01 18:35:30 +03:00
|
|
|
|
return openLockFile(fmt("%s/%s-%d", currentLoad, escapeUri(m.storeUri), slot), true);
|
2016-07-19 01:50:27 +03:00
|
|
|
|
}
|
|
|
|
|
|
2020-08-12 19:32:36 +03:00
|
|
|
|
static bool allSupportedLocally(Store & store, const std::set<std::string>& requiredFeatures) {
|
2019-03-06 07:03:25 +02:00
|
|
|
|
for (auto & feature : requiredFeatures)
|
2020-08-12 19:32:36 +03:00
|
|
|
|
if (!store.systemFeatures.get().count(feature)) return false;
|
2019-03-06 07:03:25 +02:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-06 14:36:55 +03:00
|
|
|
|
static int main_build_remote(int argc, char * * argv)
|
2016-07-19 01:50:27 +03:00
|
|
|
|
{
|
2018-10-26 12:35:46 +03:00
|
|
|
|
{
|
2017-10-24 14:41:52 +03:00
|
|
|
|
logger = makeJSONLogger(*logger);
|
|
|
|
|
|
2016-07-19 01:50:27 +03:00
|
|
|
|
/* Ensure we don't get any SSH passphrase or host key popups. */
|
2017-05-01 18:35:30 +03:00
|
|
|
|
unsetenv("DISPLAY");
|
|
|
|
|
unsetenv("SSH_ASKPASS");
|
2016-07-19 01:50:27 +03:00
|
|
|
|
|
2021-01-28 16:37:43 +02:00
|
|
|
|
/* If we ever use the common args framework, make sure to
|
|
|
|
|
remove initPlugins below and initialize settings first.
|
|
|
|
|
*/
|
2017-10-23 21:43:04 +03:00
|
|
|
|
if (argc != 2)
|
2016-07-19 01:50:27 +03:00
|
|
|
|
throw UsageError("called without required arguments");
|
|
|
|
|
|
2017-10-23 21:43:04 +03:00
|
|
|
|
verbosity = (Verbosity) std::stoll(argv[1]);
|
|
|
|
|
|
|
|
|
|
FdSource source(STDIN_FILENO);
|
|
|
|
|
|
|
|
|
|
/* Read the parent's settings. */
|
|
|
|
|
while (readInt(source)) {
|
|
|
|
|
auto name = readString(source);
|
|
|
|
|
auto value = readString(source);
|
|
|
|
|
settings.set(name, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
settings.maxBuildJobs.set("1"); // hack to make tests with local?root= work
|
2016-07-19 01:50:27 +03:00
|
|
|
|
|
2018-02-08 18:26:18 +02:00
|
|
|
|
initPlugins();
|
|
|
|
|
|
2020-12-20 19:07:28 +02:00
|
|
|
|
auto store = openStore();
|
2016-07-19 01:50:27 +03:00
|
|
|
|
|
2017-05-01 16:46:47 +03:00
|
|
|
|
/* It would be more appropriate to use $XDG_RUNTIME_DIR, since
|
2017-07-30 13:28:50 +03:00
|
|
|
|
that gets cleared on reboot, but it wouldn't work on macOS. */
|
2021-01-22 17:21:12 +02:00
|
|
|
|
auto currentLoadName = "/current-load";
|
2020-12-20 19:07:28 +02:00
|
|
|
|
if (auto localStore = store.dynamic_pointer_cast<LocalFSStore>())
|
2021-01-22 17:21:12 +02:00
|
|
|
|
currentLoad = std::string { localStore->stateDir } + currentLoadName;
|
2020-12-20 19:07:28 +02:00
|
|
|
|
else
|
2021-01-22 17:21:12 +02:00
|
|
|
|
currentLoad = settings.nixStateDir + currentLoadName;
|
2016-07-19 01:50:27 +03:00
|
|
|
|
|
|
|
|
|
std::shared_ptr<Store> sshStore;
|
|
|
|
|
AutoCloseFD bestSlotLock;
|
|
|
|
|
|
2017-05-02 14:44:10 +03:00
|
|
|
|
auto machines = getMachines();
|
2017-05-01 15:43:14 +03:00
|
|
|
|
debug("got %d remote builders", machines.size());
|
|
|
|
|
|
2017-05-02 13:16:29 +03:00
|
|
|
|
if (machines.empty()) {
|
|
|
|
|
std::cerr << "# decline-permanently\n";
|
2018-10-26 12:35:46 +03:00
|
|
|
|
return 0;
|
2017-05-02 13:16:29 +03:00
|
|
|
|
}
|
|
|
|
|
|
2019-12-05 20:11:09 +02:00
|
|
|
|
std::optional<StorePath> drvPath;
|
2022-02-25 17:00:00 +02:00
|
|
|
|
std::string storeUri;
|
2017-10-23 21:43:04 +03:00
|
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
auto s = readString(source);
|
2018-10-26 12:35:46 +03:00
|
|
|
|
if (s != "try") return 0;
|
|
|
|
|
} catch (EndOfFile &) { return 0; }
|
2017-10-23 21:43:04 +03:00
|
|
|
|
|
|
|
|
|
auto amWilling = readInt(source);
|
|
|
|
|
auto neededSystem = readString(source);
|
2019-12-05 20:11:09 +02:00
|
|
|
|
drvPath = store->parseStorePath(readString(source));
|
2017-10-23 21:43:04 +03:00
|
|
|
|
auto requiredFeatures = readStrings<std::set<std::string>>(source);
|
|
|
|
|
|
2020-08-05 19:58:00 +03:00
|
|
|
|
auto canBuildLocally = amWilling
|
2019-03-06 07:03:25 +02:00
|
|
|
|
&& ( neededSystem == settings.thisSystem
|
|
|
|
|
|| settings.extraPlatforms.get().count(neededSystem) > 0)
|
2020-08-12 19:32:36 +03:00
|
|
|
|
&& allSupportedLocally(*store, requiredFeatures);
|
2016-07-19 01:50:27 +03:00
|
|
|
|
|
|
|
|
|
/* Error ignored here, will be caught later */
|
|
|
|
|
mkdir(currentLoad.c_str(), 0777);
|
|
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
|
bestSlotLock = -1;
|
|
|
|
|
AutoCloseFD lock = openLockFile(currentLoad + "/main-lock", true);
|
|
|
|
|
lockFile(lock.get(), ltWrite, true);
|
|
|
|
|
|
|
|
|
|
bool rightType = false;
|
|
|
|
|
|
2017-03-03 17:18:49 +02:00
|
|
|
|
Machine * bestMachine = nullptr;
|
2020-07-30 14:10:49 +03:00
|
|
|
|
uint64_t bestLoad = 0;
|
2016-07-19 01:50:27 +03:00
|
|
|
|
for (auto & m : machines) {
|
2017-10-23 21:43:04 +03:00
|
|
|
|
debug("considering building on remote machine '%s'", m.storeUri);
|
2017-05-01 18:35:30 +03:00
|
|
|
|
|
2021-10-27 15:25:13 +03:00
|
|
|
|
if (m.enabled
|
|
|
|
|
&& (neededSystem == "builtin"
|
|
|
|
|
|| std::find(m.systemTypes.begin(),
|
|
|
|
|
m.systemTypes.end(),
|
|
|
|
|
neededSystem) != m.systemTypes.end()) &&
|
2016-07-19 01:50:27 +03:00
|
|
|
|
m.allSupported(requiredFeatures) &&
|
2021-10-27 15:25:13 +03:00
|
|
|
|
m.mandatoryMet(requiredFeatures))
|
|
|
|
|
{
|
2016-07-19 01:50:27 +03:00
|
|
|
|
rightType = true;
|
|
|
|
|
AutoCloseFD free;
|
2020-07-30 14:10:49 +03:00
|
|
|
|
uint64_t load = 0;
|
|
|
|
|
for (uint64_t slot = 0; slot < m.maxJobs; ++slot) {
|
2017-01-25 13:51:35 +02:00
|
|
|
|
auto slotLock = openSlotLock(m, slot);
|
2016-07-19 01:50:27 +03:00
|
|
|
|
if (lockFile(slotLock.get(), ltWrite, false)) {
|
|
|
|
|
if (!free) {
|
|
|
|
|
free = std::move(slotLock);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
++load;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!free) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
bool best = false;
|
|
|
|
|
if (!bestSlotLock) {
|
|
|
|
|
best = true;
|
|
|
|
|
} else if (load / m.speedFactor < bestLoad / bestMachine->speedFactor) {
|
|
|
|
|
best = true;
|
|
|
|
|
} else if (load / m.speedFactor == bestLoad / bestMachine->speedFactor) {
|
|
|
|
|
if (m.speedFactor > bestMachine->speedFactor) {
|
|
|
|
|
best = true;
|
|
|
|
|
} else if (m.speedFactor == bestMachine->speedFactor) {
|
|
|
|
|
if (load < bestLoad) {
|
|
|
|
|
best = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (best) {
|
|
|
|
|
bestLoad = load;
|
|
|
|
|
bestSlotLock = std::move(free);
|
|
|
|
|
bestMachine = &m;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!bestSlotLock) {
|
2017-03-03 17:18:49 +02:00
|
|
|
|
if (rightType && !canBuildLocally)
|
|
|
|
|
std::cerr << "# postpone\n";
|
|
|
|
|
else
|
2020-08-05 19:58:00 +03:00
|
|
|
|
{
|
|
|
|
|
// build the hint template.
|
2022-02-25 17:00:00 +02:00
|
|
|
|
std::string errorText =
|
2021-01-21 01:27:36 +02:00
|
|
|
|
"Failed to find a machine for remote build!\n"
|
|
|
|
|
"derivation: %s\nrequired (system, features): (%s, %s)";
|
|
|
|
|
errorText += "\n%s available machines:";
|
|
|
|
|
errorText += "\n(systems, maxjobs, supportedFeatures, mandatoryFeatures)";
|
2020-08-05 19:58:00 +03:00
|
|
|
|
|
2021-01-21 01:27:36 +02:00
|
|
|
|
for (unsigned int i = 0; i < machines.size(); ++i)
|
|
|
|
|
errorText += "\n(%s, %s, %s, %s)";
|
2020-08-05 19:58:00 +03:00
|
|
|
|
|
|
|
|
|
// add the template values.
|
2022-02-25 17:00:00 +02:00
|
|
|
|
std::string drvstr;
|
2020-08-05 20:26:06 +03:00
|
|
|
|
if (drvPath.has_value())
|
|
|
|
|
drvstr = drvPath->to_string();
|
|
|
|
|
else
|
|
|
|
|
drvstr = "<unknown>";
|
|
|
|
|
|
2021-01-21 01:27:36 +02:00
|
|
|
|
auto error = hintformat(errorText);
|
|
|
|
|
error
|
|
|
|
|
% drvstr
|
|
|
|
|
% neededSystem
|
|
|
|
|
% concatStringsSep<StringSet>(", ", requiredFeatures)
|
|
|
|
|
% machines.size();
|
|
|
|
|
|
|
|
|
|
for (auto & m : machines)
|
|
|
|
|
error
|
2022-02-25 17:00:00 +02:00
|
|
|
|
% concatStringsSep<std::vector<std::string>>(", ", m.systemTypes)
|
2021-01-21 01:27:36 +02:00
|
|
|
|
% m.maxJobs
|
|
|
|
|
% concatStringsSep<StringSet>(", ", m.supportedFeatures)
|
|
|
|
|
% concatStringsSep<StringSet>(", ", m.mandatoryFeatures);
|
2020-08-05 19:58:00 +03:00
|
|
|
|
|
2021-01-21 01:27:36 +02:00
|
|
|
|
printMsg(canBuildLocally ? lvlChatty : lvlWarn, error);
|
2020-08-05 19:58:00 +03:00
|
|
|
|
|
2017-03-03 17:18:49 +02:00
|
|
|
|
std::cerr << "# decline\n";
|
2020-08-05 19:58:00 +03:00
|
|
|
|
}
|
2016-07-19 01:50:27 +03:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-24 13:22:02 +02:00
|
|
|
|
#if __APPLE__
|
|
|
|
|
futimes(bestSlotLock.get(), NULL);
|
|
|
|
|
#else
|
2016-07-19 01:50:27 +03:00
|
|
|
|
futimens(bestSlotLock.get(), NULL);
|
2017-01-24 13:22:02 +02:00
|
|
|
|
#endif
|
2016-07-19 01:50:27 +03:00
|
|
|
|
|
|
|
|
|
lock = -1;
|
|
|
|
|
|
|
|
|
|
try {
|
2017-05-01 18:35:30 +03:00
|
|
|
|
|
2017-10-24 14:41:52 +03:00
|
|
|
|
Activity act(*logger, lvlTalkative, actUnknown, fmt("connecting to '%s'", bestMachine->storeUri));
|
|
|
|
|
|
2020-08-12 19:32:36 +03:00
|
|
|
|
sshStore = bestMachine->openStore();
|
2017-05-02 15:18:46 +03:00
|
|
|
|
sshStore->connect();
|
2017-05-01 18:35:30 +03:00
|
|
|
|
storeUri = bestMachine->storeUri;
|
|
|
|
|
|
2016-07-19 01:50:27 +03:00
|
|
|
|
} catch (std::exception & e) {
|
2018-03-20 16:17:59 +02:00
|
|
|
|
auto msg = chomp(drainFD(5, false));
|
2021-01-21 01:27:36 +02:00
|
|
|
|
printError("cannot build on '%s': %s%s",
|
|
|
|
|
bestMachine->storeUri, e.what(),
|
|
|
|
|
msg.empty() ? "" : ": " + msg);
|
2016-07-19 01:50:27 +03:00
|
|
|
|
bestMachine->enabled = false;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2017-05-01 18:35:30 +03:00
|
|
|
|
|
2016-07-19 01:50:27 +03:00
|
|
|
|
goto connected;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-03 17:18:49 +02:00
|
|
|
|
|
2016-07-19 01:50:27 +03:00
|
|
|
|
connected:
|
2018-03-20 16:17:59 +02:00
|
|
|
|
close(5);
|
|
|
|
|
|
2020-08-12 06:47:36 +03:00
|
|
|
|
assert(sshStore);
|
|
|
|
|
|
2017-10-24 15:24:57 +03:00
|
|
|
|
std::cerr << "# accept\n" << storeUri << "\n";
|
2017-05-01 18:35:30 +03:00
|
|
|
|
|
2017-10-23 21:43:04 +03:00
|
|
|
|
auto inputs = readStrings<PathSet>(source);
|
2021-01-26 11:48:41 +02:00
|
|
|
|
auto wantedOutputs = readStrings<StringSet>(source);
|
2017-05-01 18:35:30 +03:00
|
|
|
|
|
2017-10-24 15:47:23 +03:00
|
|
|
|
AutoCloseFD uploadLock = openLockFile(currentLoad + "/" + escapeUri(storeUri) + ".upload-lock", true);
|
|
|
|
|
|
2017-10-24 14:41:52 +03:00
|
|
|
|
{
|
|
|
|
|
Activity act(*logger, lvlTalkative, actUnknown, fmt("waiting for the upload lock to '%s'", storeUri));
|
2017-05-01 18:35:30 +03:00
|
|
|
|
|
2017-10-24 14:41:52 +03:00
|
|
|
|
auto old = signal(SIGALRM, handleAlarm);
|
|
|
|
|
alarm(15 * 60);
|
|
|
|
|
if (!lockFile(uploadLock.get(), ltWrite, true))
|
|
|
|
|
printError("somebody is hogging the upload lock for '%s', continuing...");
|
|
|
|
|
alarm(0);
|
|
|
|
|
signal(SIGALRM, old);
|
2017-10-24 15:47:23 +03:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-09 23:40:07 +02:00
|
|
|
|
auto substitute = settings.buildersUseSubstitutes ? Substitute : NoSubstitute;
|
|
|
|
|
|
2021-10-14 23:07:20 +03:00
|
|
|
|
auto copyStorePathImpl = sshStore->isTrusting ? copyStorePathAdapter : copyOrBuildStorePath;
|
2021-01-22 19:56:28 +02:00
|
|
|
|
|
2017-10-24 15:47:23 +03:00
|
|
|
|
{
|
|
|
|
|
Activity act(*logger, lvlTalkative, actUnknown, fmt("copying dependencies to '%s'", storeUri));
|
2021-10-14 23:07:20 +03:00
|
|
|
|
copyPaths(*store, *sshStore, store->parseStorePathSet(inputs), NoRepair, NoCheckSigs, substitute, copyStorePathImpl);
|
2017-10-24 14:41:52 +03:00
|
|
|
|
}
|
2016-07-19 01:50:27 +03:00
|
|
|
|
|
2017-10-24 15:47:23 +03:00
|
|
|
|
uploadLock = -1;
|
|
|
|
|
|
2020-06-12 14:04:52 +03:00
|
|
|
|
auto drv = store->readDerivation(*drvPath);
|
2017-05-01 16:00:39 +03:00
|
|
|
|
|
2021-02-27 05:53:22 +02:00
|
|
|
|
std::optional<BuildResult> optResult;
|
2021-10-14 23:07:20 +03:00
|
|
|
|
if (sshStore->isTrusting || derivationIsCA(drv.type())) {
|
|
|
|
|
// Hijack the inputs paths of the derivation to include all the paths
|
|
|
|
|
// that come from the `inputDrvs` set.
|
|
|
|
|
// We don’t do that for the derivations whose `inputDrvs` is empty
|
|
|
|
|
// because
|
|
|
|
|
// 1. It’s not needed
|
|
|
|
|
// 2. Changing the `inputSrcs` set changes the associated output ids,
|
|
|
|
|
// which break CA derivations
|
|
|
|
|
if (!drv.inputDrvs.empty())
|
|
|
|
|
drv.inputSrcs = store->parseStorePathSet(inputs);
|
|
|
|
|
optResult = sshStore->buildDerivation(*drvPath, (const BasicDerivation &) drv);
|
2021-02-27 05:53:22 +02:00
|
|
|
|
auto & result = *optResult;
|
2020-08-12 06:47:36 +03:00
|
|
|
|
if (!result.success())
|
|
|
|
|
throw Error("build of '%s' on '%s' failed: %s", store->printStorePath(*drvPath), storeUri, result.errorMsg);
|
|
|
|
|
} else {
|
2021-10-14 23:07:20 +03:00
|
|
|
|
copyPaths(*store, *sshStore, StorePathSet {*drvPath}, NoRepair, NoCheckSigs, substitute, copyStorePathImpl);
|
|
|
|
|
sshStore->buildPaths({ DerivedPath::Built { *drvPath, {} } });
|
2020-08-12 06:47:36 +03:00
|
|
|
|
}
|
2017-05-08 15:27:12 +03:00
|
|
|
|
|
2016-07-19 01:50:27 +03:00
|
|
|
|
|
2021-02-27 05:53:22 +02:00
|
|
|
|
auto outputHashes = staticOutputHashes(*store, drv);
|
2021-01-26 11:48:41 +02:00
|
|
|
|
std::set<Realisation> missingRealisations;
|
|
|
|
|
StorePathSet missingPaths;
|
2021-10-25 16:53:01 +03:00
|
|
|
|
if (settings.isExperimentalFeatureEnabled(Xp::CaDerivations) && !derivationHasKnownOutputPaths(drv.type())) {
|
2021-01-26 11:48:41 +02:00
|
|
|
|
for (auto & outputName : wantedOutputs) {
|
|
|
|
|
auto thisOutputHash = outputHashes.at(outputName);
|
|
|
|
|
auto thisOutputId = DrvOutput{ thisOutputHash, outputName };
|
|
|
|
|
if (!store->queryRealisation(thisOutputId)) {
|
2021-02-26 17:29:30 +02:00
|
|
|
|
debug("missing output %s", outputName);
|
2021-02-27 05:53:22 +02:00
|
|
|
|
assert(optResult);
|
|
|
|
|
auto & result = *optResult;
|
2021-01-26 11:48:41 +02:00
|
|
|
|
assert(result.builtOutputs.count(thisOutputId));
|
|
|
|
|
auto newRealisation = result.builtOutputs.at(thisOutputId);
|
|
|
|
|
missingRealisations.insert(newRealisation);
|
|
|
|
|
missingPaths.insert(newRealisation.outPath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
auto outputPaths = drv.outputsAndOptPaths(*store);
|
|
|
|
|
for (auto & [outputName, hopefullyOutputPath] : outputPaths) {
|
|
|
|
|
assert(hopefullyOutputPath.second);
|
|
|
|
|
if (!store->isValidPath(*hopefullyOutputPath.second))
|
|
|
|
|
missingPaths.insert(*hopefullyOutputPath.second);
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-16 14:50:01 +02:00
|
|
|
|
|
2021-01-26 11:48:41 +02:00
|
|
|
|
if (!missingPaths.empty()) {
|
2017-10-24 15:47:23 +03:00
|
|
|
|
Activity act(*logger, lvlTalkative, actUnknown, fmt("copying outputs from '%s'", storeUri));
|
2020-12-20 19:07:28 +02:00
|
|
|
|
if (auto localStore = store.dynamic_pointer_cast<LocalStore>())
|
2021-01-26 11:48:41 +02:00
|
|
|
|
for (auto & path : missingPaths)
|
|
|
|
|
localStore->locksHeld.insert(store->printStorePath(path)); /* FIXME: ugly */
|
2021-01-22 19:56:28 +02:00
|
|
|
|
/* No `copyStorePathImpl` because we always trust ourselves. */
|
2021-07-19 13:01:06 +03:00
|
|
|
|
copyPaths(*sshStore, *store, missingPaths, NoRepair, NoCheckSigs, NoSubstitute);
|
2016-07-19 01:50:27 +03:00
|
|
|
|
}
|
2021-02-26 17:29:37 +02:00
|
|
|
|
// XXX: Should be done as part of `copyPaths`
|
2021-01-26 10:36:24 +02:00
|
|
|
|
for (auto & realisation : missingRealisations) {
|
|
|
|
|
// Should hold, because if the feature isn't enabled the set
|
|
|
|
|
// of missing realisations should be empty
|
2021-10-25 16:53:01 +03:00
|
|
|
|
settings.requireExperimentalFeature(Xp::CaDerivations);
|
2021-01-26 10:36:24 +02:00
|
|
|
|
store->registerDrvOutput(realisation);
|
2016-07-19 01:50:27 +03:00
|
|
|
|
}
|
2017-03-16 14:50:01 +02:00
|
|
|
|
|
2018-10-26 12:35:46 +03:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2016-07-19 01:50:27 +03:00
|
|
|
|
}
|
2018-10-26 12:35:46 +03:00
|
|
|
|
|
2020-10-06 14:36:55 +03:00
|
|
|
|
static RegisterLegacyCommand r_build_remote("build-remote", main_build_remote);
|