From 101d964a59d5c9098845d3109ea1eba99b5f31df Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 8 Apr 2019 16:11:17 +0200 Subject: nix: Make -f work for compatibility --- src/nix/why-depends.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nix/why-depends.cc') diff --git a/src/nix/why-depends.cc b/src/nix/why-depends.cc index 325a2be0a..32ba5a1ad 100644 --- a/src/nix/why-depends.cc +++ b/src/nix/why-depends.cc @@ -74,9 +74,9 @@ struct CmdWhyDepends : SourceExprCommand void run(ref store) override { - auto package = parseInstallable(*this, store, _package, false); + auto package = parseInstallable(store, _package); auto packagePath = toStorePath(store, Build, package); - auto dependency = parseInstallable(*this, store, _dependency, false); + auto dependency = parseInstallable(store, _dependency); auto dependencyPath = toStorePath(store, NoBuild, dependency); auto dependencyPathHash = storePathToHash(dependencyPath); -- cgit v1.2.3 From a0de58f471c9087d8e6cc60a6078f9940a125b15 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 18 Jun 2019 16:01:35 +0200 Subject: Make subcommand construction in MultiCommand lazy --- src/nix/why-depends.cc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/nix/why-depends.cc') diff --git a/src/nix/why-depends.cc b/src/nix/why-depends.cc index 32ba5a1ad..3d13a77e4 100644 --- a/src/nix/why-depends.cc +++ b/src/nix/why-depends.cc @@ -44,11 +44,6 @@ struct CmdWhyDepends : SourceExprCommand .set(&all, true); } - std::string name() override - { - return "why-depends"; - } - std::string description() override { return "show why a package has another package in its closure"; @@ -264,4 +259,4 @@ struct CmdWhyDepends : SourceExprCommand } }; -static RegisterCommand r1(make_ref()); +static auto r1 = registerCommand("why-depends"); -- cgit v1.2.3 From 678301072f05b650dc15c5edb4c25f08f0d6cace Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 31 Jan 2020 14:01:46 +0100 Subject: nix flake list-inputs: Pretty-print the tree --- src/nix/why-depends.cc | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/nix/why-depends.cc') diff --git a/src/nix/why-depends.cc b/src/nix/why-depends.cc index c539adb7f..fb12d5380 100644 --- a/src/nix/why-depends.cc +++ b/src/nix/why-depends.cc @@ -143,11 +143,6 @@ struct CmdWhyDepends : SourceExprCommand and `dependency`. */ std::function printNode; - const string treeConn = "╠═══"; - const string treeLast = "╚═══"; - const string treeLine = "║ "; - const string treeNull = " "; - struct BailOut { }; printNode = [&](Node & node, const string & firstPad, const string & tailPad) { -- cgit v1.2.3 From e91f32f2b58eda31fa8d8206ce9d0a8aef52ad13 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 31 Jan 2020 14:06:26 +0100 Subject: Use light box drawing symbols --- src/nix/why-depends.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nix/why-depends.cc') diff --git a/src/nix/why-depends.cc b/src/nix/why-depends.cc index fb12d5380..900466538 100644 --- a/src/nix/why-depends.cc +++ b/src/nix/why-depends.cc @@ -152,7 +152,7 @@ struct CmdWhyDepends : SourceExprCommand std::cout << fmt("%s%s%s%s" ANSI_NORMAL "\n", firstPad, node.visited ? "\e[38;5;244m" : "", - firstPad != "" ? "=> " : "", + firstPad != "" ? "→ " : "", pathS); if (node.path == dependencyPath && !all -- cgit v1.2.3 From 8f41847394524fcac40d3b5620139ca7e94a18e3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 16 Apr 2020 13:46:37 +0200 Subject: Use Logger::stdout() --- src/nix/why-depends.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nix/why-depends.cc') diff --git a/src/nix/why-depends.cc b/src/nix/why-depends.cc index a9a5ec8f8..6037f37fe 100644 --- a/src/nix/why-depends.cc +++ b/src/nix/why-depends.cc @@ -149,7 +149,7 @@ struct CmdWhyDepends : SourceExprCommand auto pathS = store->printStorePath(node.path); assert(node.dist != inf); - std::cout << fmt("%s%s%s%s" ANSI_NORMAL "\n", + logger->stdout("%s%s%s%s" ANSI_NORMAL, firstPad, node.visited ? "\e[38;5;244m" : "", firstPad != "" ? "→ " : "", -- cgit v1.2.3 From 94eb5fad76cd086e3f49329532f81083726f89b3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 15 Jul 2020 20:05:42 +0200 Subject: Clean up RealiseMode --- src/nix/why-depends.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nix/why-depends.cc') diff --git a/src/nix/why-depends.cc b/src/nix/why-depends.cc index a208e0081..c39a0435d 100644 --- a/src/nix/why-depends.cc +++ b/src/nix/why-depends.cc @@ -73,9 +73,9 @@ struct CmdWhyDepends : SourceExprCommand void run(ref store) override { auto package = parseInstallable(store, _package); - auto packagePath = toStorePath(store, Build, package); + auto packagePath = toStorePath(store, Realise::Outputs, package); auto dependency = parseInstallable(store, _dependency); - auto dependencyPath = toStorePath(store, NoBuild, dependency); + auto dependencyPath = toStorePath(store, Realise::Derivation, dependency); auto dependencyPathHash = dependencyPath.hashPart(); StorePathSet closure; -- cgit v1.2.3 From dfe8f3ebc6c5a3d96528794b8822536aac718046 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 15 Jul 2020 20:09:50 +0200 Subject: nix why-depends: Fix misleading message --- src/nix/why-depends.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/nix/why-depends.cc') diff --git a/src/nix/why-depends.cc b/src/nix/why-depends.cc index c39a0435d..55bb43f95 100644 --- a/src/nix/why-depends.cc +++ b/src/nix/why-depends.cc @@ -82,7 +82,9 @@ struct CmdWhyDepends : SourceExprCommand store->computeFSClosure({packagePath}, closure, false, false); if (!closure.count(dependencyPath)) { - printError("'%s' does not depend on '%s'", package->what(), dependency->what()); + printError("'%s' does not depend on '%s'", + store->printStorePath(packagePath), + store->printStorePath(dependencyPath)); return; } -- cgit v1.2.3 From 3624c042ace05db88794e87ee37f3296bab19bc8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 15 Jul 2020 20:22:52 +0200 Subject: nix: Add --derivation flag to operate on .drv paths For instance, 'nix why-depends --use-derivation nixpkgs#hello nixpkgs#glibc' shows why hello's .drv depends on glibc's .drv. --- src/nix/why-depends.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nix/why-depends.cc') diff --git a/src/nix/why-depends.cc b/src/nix/why-depends.cc index 55bb43f95..f854bedb2 100644 --- a/src/nix/why-depends.cc +++ b/src/nix/why-depends.cc @@ -73,9 +73,9 @@ struct CmdWhyDepends : SourceExprCommand void run(ref store) override { auto package = parseInstallable(store, _package); - auto packagePath = toStorePath(store, Realise::Outputs, package); + auto packagePath = toStorePath(store, Realise::Outputs, operateOn, package); auto dependency = parseInstallable(store, _dependency); - auto dependencyPath = toStorePath(store, Realise::Derivation, dependency); + auto dependencyPath = toStorePath(store, Realise::Derivation, operateOn, dependency); auto dependencyPathHash = dependencyPath.hashPart(); StorePathSet closure; -- cgit v1.2.3 From 2d6d53bc87ef7468ad73431cf76123316f4c82bf Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 15 Jul 2020 20:28:16 +0200 Subject: nix: Fix examples --- src/nix/why-depends.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nix/why-depends.cc') diff --git a/src/nix/why-depends.cc b/src/nix/why-depends.cc index f854bedb2..7d6ef9be0 100644 --- a/src/nix/why-depends.cc +++ b/src/nix/why-depends.cc @@ -55,15 +55,15 @@ struct CmdWhyDepends : SourceExprCommand return { Example{ "To show one path through the dependency graph leading from Hello to Glibc:", - "nix why-depends nixpkgs.hello nixpkgs.glibc" + "nix why-depends nixpkgs#hello nixpkgs#glibc" }, Example{ "To show all files and paths in the dependency graph leading from Thunderbird to libX11:", - "nix why-depends --all nixpkgs.thunderbird nixpkgs.xorg.libX11" + "nix why-depends --all nixpkgs#thunderbird nixpkgs#xorg.libX11" }, Example{ "To show why Glibc depends on itself:", - "nix why-depends nixpkgs.glibc nixpkgs.glibc" + "nix why-depends nixpkgs#glibc nixpkgs#glibc" }, }; } -- cgit v1.2.3