2022-01-17 18:45:21 +00:00
|
|
|
#include "command.hh"
|
|
|
|
#include "shared.hh"
|
|
|
|
#include "store-api.hh"
|
|
|
|
#include "sync.hh"
|
|
|
|
#include "thread-pool.hh"
|
|
|
|
|
|
|
|
#include <atomic>
|
|
|
|
|
|
|
|
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<Store> srcStore) override
|
|
|
|
{
|
|
|
|
auto dstStore = getDstStore();
|
|
|
|
|
2022-01-18 16:28:18 +00:00
|
|
|
StorePathSet drvPaths;
|
|
|
|
|
|
|
|
for (auto & i : installables)
|
|
|
|
for (auto & drvPath : i->toDrvPaths(getEvalStore()))
|
|
|
|
drvPaths.insert(drvPath);
|
|
|
|
|
|
|
|
for (auto & drvPath : drvPaths) {
|
|
|
|
if (auto log = srcStore->getBuildLog(drvPath))
|
|
|
|
dstStore->addBuildLog(drvPath, *log);
|
2022-01-17 18:45:21 +00:00
|
|
|
else
|
2022-01-18 16:28:18 +00:00
|
|
|
throw Error("build log for '%s' is not available", srcStore->printStorePath(drvPath));
|
2022-01-17 18:45:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static auto rCmdCopyLog = registerCommand2<CmdCopyLog>({"store", "copy-log"});
|