aboutsummaryrefslogtreecommitdiff
path: root/src/nix/log.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-04-25 11:20:37 +0200
committerEelco Dolstra <edolstra@gmail.com>2017-04-25 11:20:37 +0200
commitbcecc990071fd36bb88c8fd29cb009ed4c04d6a2 (patch)
treec3f2fa86b2d751418efe7727bc345d0557c3786c /src/nix/log.cc
parent1bb87c0487ba2a10f20c07dfd828b5d043249e31 (diff)
Restructure installables handling in the "nix" command
Diffstat (limited to 'src/nix/log.cc')
-rw-r--r--src/nix/log.cc35
1 files changed, 13 insertions, 22 deletions
diff --git a/src/nix/log.cc b/src/nix/log.cc
index d8a3830e9..75f3c1ab0 100644
--- a/src/nix/log.cc
+++ b/src/nix/log.cc
@@ -6,7 +6,7 @@
using namespace nix;
-struct CmdLog : StoreCommand, MixInstallables
+struct CmdLog : MixInstallables
{
CmdLog()
{
@@ -24,32 +24,23 @@ struct CmdLog : StoreCommand, MixInstallables
void run(ref<Store> store) override
{
- auto elems = evalInstallables(store);
-
- PathSet paths;
-
- for (auto & elem : elems) {
- if (elem.isDrv)
- paths.insert(elem.drvPath);
- else
- paths.insert(elem.outPaths.begin(), elem.outPaths.end());
- }
-
auto subs = getDefaultSubstituters();
subs.push_front(store);
- for (auto & path : paths) {
- bool found = false;
- for (auto & sub : subs) {
- auto log = sub->getBuildLog(path);
- if (!log) continue;
- std::cout << *log;
- found = true;
- break;
+ for (auto & inst : installables) {
+ for (auto & path : inst->toBuildable()) {
+ 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);
}
- if (!found)
- throw Error("build log of path ā€˜%sā€™ is not available", path);
}
}
};