#include "command.hh" #include "shared.hh" #include "store-api.hh" #include "store-cast.hh" #include "log-store.hh" #include "sync.hh" #include "thread-pool.hh" #include using namespace nix; struct CmdCopyLog : virtual CopyCommand, virtual InstallablesCommand { std::string description() override { return "copy build logs between Nix stores"; } std::string doc() override { return #include "store-copy-log.md" ; } Category category() override { return catUtility; } void run(ref srcStore, Installables && installables) override { auto & srcLogStore = require(*srcStore); auto dstStore = getDstStore(); auto & dstLogStore = require(*dstStore); for (auto & drvPath : Installable::toDerivations(getEvalStore(), installables, true)) { if (auto log = srcLogStore.getBuildLog(drvPath)) dstLogStore.addBuildLog(drvPath, *log); else throw Error("build log for '%s' is not available", srcStore->printStorePath(drvPath)); } } }; static auto rCmdCopyLog = registerCommand2({"store", "copy-log"});