2017-03-13 12:38:29 +00:00
|
|
|
|
#include "command.hh"
|
|
|
|
|
#include "common-args.hh"
|
|
|
|
|
#include "shared.hh"
|
|
|
|
|
#include "store-api.hh"
|
|
|
|
|
|
|
|
|
|
using namespace nix;
|
|
|
|
|
|
2017-04-25 10:06:32 +00:00
|
|
|
|
struct CmdLog : InstallablesCommand
|
2017-03-13 12:38:29 +00:00
|
|
|
|
{
|
|
|
|
|
CmdLog()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string name() override
|
|
|
|
|
{
|
|
|
|
|
return "log";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string description() override
|
|
|
|
|
{
|
|
|
|
|
return "show the build log of the specified packages or paths";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void run(ref<Store> store) override
|
|
|
|
|
{
|
|
|
|
|
auto subs = getDefaultSubstituters();
|
|
|
|
|
|
|
|
|
|
subs.push_front(store);
|
|
|
|
|
|
2017-04-25 09:20:37 +00:00
|
|
|
|
for (auto & inst : installables) {
|
2017-07-14 15:10:13 +00:00
|
|
|
|
for (auto & b : inst->toBuildable()) {
|
|
|
|
|
auto path = b.second.drvPath != "" ? b.second.drvPath : b.first;
|
2017-04-25 09:20:37 +00:00
|
|
|
|
bool found = false;
|
|
|
|
|
for (auto & sub : subs) {
|
|
|
|
|
auto log = sub->getBuildLog(path);
|
|
|
|
|
if (!log) continue;
|
|
|
|
|
std::cout << *log;
|
|
|
|
|
found = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!found)
|
|
|
|
|
throw Error("build log of path ‘%s’ is not available", path);
|
2017-03-13 12:38:29 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static RegisterCommand r1(make_ref<CmdLog>());
|