sub showTime { my ($x) = @_; return strftime('%Y-%m-%d %H:%M:%S', localtime($x)); }
my $infoTable = Text::Table->new({ align => "left" }, \" | ", { align => "left" });
my @lines = (
[ "Build ID:", $build->id ],
[ "Nix name:", $build->nixname ],
[ "Short description:", $build->description || '(not given)' ],
[ "Maintainer(s):", $build->maintainers ],
[ "System:", $build->system ],
[ "Derivation store path:", $build->drvpath ],
[ "Output store path:", $build->outpath ],
[ "Time added:", showTime $build->timestamp ],
);
push @lines, (
[ "Build started:", showTime $build->resultInfo->starttime ],
[ "Build finished:", showTime $build->resultInfo->stoptime ],
[ "Duration:", $build->resultInfo->stoptime - $build->resultInfo->starttime . "s" ],
) if $build->resultInfo->starttime;
$infoTable->load(@lines);
my $inputsTable = Text::Table->new(
{ title => "Name", align => "left" }, \" | ",
{ title => "Type", align => "left" }, \" | ",
{ title => "Value", align => "left" });
@lines = ();
foreach my $input ($build->inputs) {
my $type = $input->type;
push @lines,
[ $input->name
, $input->type
, $input->type eq "build"
? $input->dependency->id
: ($input->type eq "string" || $input->type eq "boolean")
? $input->value : ($input->uri . ':' . $input->revision)
];
}
$inputsTable->load(@lines);