aboutsummaryrefslogtreecommitdiff
path: root/src/nix/log.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-07-23 19:02:57 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-07-23 19:02:57 +0000
commite1de1fe0d82d8ba702947dcad3b678cbb9ce9333 (patch)
tree45d4dd012208464ca7e311e276b50b5ccb39e33a /src/nix/log.cc
parenta7b8f799380da911908cf20d95c9cd644e25ab10 (diff)
Make `Buildable` a `std::variant`
I think this better captures the intent of what's going on: we either have an opaque store path, or a drv path with some outputs. Having this structure will also help us support CA derivations: we'll have to allow the outpath paths to be optional, so the structure we gain now makes up for the structure we loose then.
Diffstat (limited to 'src/nix/log.cc')
-rw-r--r--src/nix/log.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/nix/log.cc b/src/nix/log.cc
index 7e10d373a..33380dcf5 100644
--- a/src/nix/log.cc
+++ b/src/nix/log.cc
@@ -45,11 +45,14 @@ struct CmdLog : InstallableCommand
RunPager pager;
for (auto & sub : subs) {
- auto log = b.drvPath ? sub->getBuildLog(*b.drvPath) : nullptr;
- for (auto & output : b.outputs) {
- if (log) break;
- log = sub->getBuildLog(output.second);
- }
+ auto log = std::visit(overloaded {
+ [&](BuildableOpaque bo) {
+ return sub->getBuildLog(bo.path);
+ },
+ [&](BuildableFromDrv bfd) {
+ return sub->getBuildLog(bfd.drvPath);
+ },
+ }, b);
if (!log) continue;
stopProgressBar();
printInfo("got build log for '%s' from '%s'", installable->what(), sub->getUri());