From 6aa9a0e57b4bd17c82a68db9c41960a8abe53038 Mon Sep 17 00:00:00 2001 From: Robin Ury <1146921+binury@users.noreply.github.com> Date: Tue, 16 May 2023 18:45:37 -0500 Subject: [PATCH 1/4] Add brew deps `--skip-installed` arg --- Library/Homebrew/cmd/deps.rb | 3 +++ Library/Homebrew/dependencies_helpers.rb | 3 +++ Library/Homebrew/dependency.rb | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index 56a0db6dca..47c1dec6d7 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -49,6 +49,8 @@ module Homebrew switch "--installed", description: "List dependencies for formulae that are currently installed. If is " \ "specified, list only its dependencies that are currently installed." + switch "--skip-installed", + description: "Skip dependencies for formulae that are currently installed." switch "--eval-all", description: "Evaluate all available formulae and casks, whether installed or not, to list " \ "their dependencies." @@ -64,6 +66,7 @@ module Homebrew description: "Treat all named arguments as casks." conflicts "--tree", "--graph" + conflicts "--installed", "--skip-installed" conflicts "--installed", "--eval-all" conflicts "--installed", "--all" conflicts "--formula", "--cask" diff --git a/Library/Homebrew/dependencies_helpers.rb b/Library/Homebrew/dependencies_helpers.rb index 4d5f1a312a..02965a446a 100644 --- a/Library/Homebrew/dependencies_helpers.rb +++ b/Library/Homebrew/dependencies_helpers.rb @@ -30,6 +30,7 @@ module DependenciesHelpers end ignores << "recommended?" if args.skip_recommended? + ignores << "satisfied?" if args.skip_installed? [includes, ignores] end @@ -44,6 +45,8 @@ module DependenciesHelpers klass.prune if ignores.include?("recommended?") || dependent.build.without?(dep) elsif dep.optional? klass.prune if includes.exclude?("optional?") && !dependent.build.with?(dep) + elsif dep.satisfied? + klass.prune if ignores.include?("satisfied?") elsif dep.build? || dep.test? keep = false keep ||= dep.test? && includes.include?("test?") && dependent == root_dependent diff --git a/Library/Homebrew/dependency.rb b/Library/Homebrew/dependency.rb index 0879cf268e..8464d8aea7 100644 --- a/Library/Homebrew/dependency.rb +++ b/Library/Homebrew/dependency.rb @@ -48,7 +48,7 @@ class Dependency to_formula.latest_version_installed? end - def satisfied?(inherited_options) + def satisfied?(inherited_options = []) installed? && missing_options(inherited_options).empty? end From db84725c7bc6ec8a23280ee2568d3065a602a1ea Mon Sep 17 00:00:00 2001 From: Robin Ury <1146921+binury@users.noreply.github.com> Date: Tue, 16 May 2023 23:46:00 -0500 Subject: [PATCH 2/4] Fix: strict args exception for uses --- Library/Homebrew/cmd/uses.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index 451eb6d447..bf24461107 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -27,6 +27,8 @@ module Homebrew description: "Resolve more than one level of dependencies." switch "--installed", description: "Only list formulae and casks that are currently installed." + switch "--skip-installed", + description: "Skip dependencies that are currently installed." switch "--eval-all", description: "Evaluate all available formulae and casks, whether installed or not, to show " \ "their dependents." @@ -47,6 +49,7 @@ module Homebrew conflicts "--formula", "--cask" conflicts "--installed", "--all" + conflicts "--installed", "--skip-installed" named_args :formula, min: 1 end From 9b884942d763b107c3c6011cad49d0c9482f0aba Mon Sep 17 00:00:00 2001 From: Robin Ury <1146921+binury@users.noreply.github.com> Date: Wed, 17 May 2023 13:59:38 -0500 Subject: [PATCH 3/4] Change: skip-installed description for clarity --- Library/Homebrew/cmd/uses.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index bf24461107..61ccdf64da 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -28,7 +28,7 @@ module Homebrew switch "--installed", description: "Only list formulae and casks that are currently installed." switch "--skip-installed", - description: "Skip dependencies that are currently installed." + description: "Only list formulae and casks that are not currently installed." switch "--eval-all", description: "Evaluate all available formulae and casks, whether installed or not, to show " \ "their dependents." From dddec94fd70c7d2ef55e7f1991aef6fea302f643 Mon Sep 17 00:00:00 2001 From: Robin Ury <1146921+binury@users.noreply.github.com> Date: Wed, 17 May 2023 14:53:19 -0500 Subject: [PATCH 4/4] Change: --skip-installed to --missing --- Library/Homebrew/cmd/deps.rb | 6 +++--- Library/Homebrew/cmd/uses.rb | 4 ++-- Library/Homebrew/dependencies_helpers.rb | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index 47c1dec6d7..09736b135d 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -49,8 +49,8 @@ module Homebrew switch "--installed", description: "List dependencies for formulae that are currently installed. If is " \ "specified, list only its dependencies that are currently installed." - switch "--skip-installed", - description: "Skip dependencies for formulae that are currently installed." + switch "--missing", + description: "Show only missing dependencies." switch "--eval-all", description: "Evaluate all available formulae and casks, whether installed or not, to list " \ "their dependencies." @@ -66,7 +66,7 @@ module Homebrew description: "Treat all named arguments as casks." conflicts "--tree", "--graph" - conflicts "--installed", "--skip-installed" + conflicts "--installed", "--missing" conflicts "--installed", "--eval-all" conflicts "--installed", "--all" conflicts "--formula", "--cask" diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index 61ccdf64da..9e835fb28a 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -27,7 +27,7 @@ module Homebrew description: "Resolve more than one level of dependencies." switch "--installed", description: "Only list formulae and casks that are currently installed." - switch "--skip-installed", + switch "--missing", description: "Only list formulae and casks that are not currently installed." switch "--eval-all", description: "Evaluate all available formulae and casks, whether installed or not, to show " \ @@ -49,7 +49,7 @@ module Homebrew conflicts "--formula", "--cask" conflicts "--installed", "--all" - conflicts "--installed", "--skip-installed" + conflicts "--missing", "--installed" named_args :formula, min: 1 end diff --git a/Library/Homebrew/dependencies_helpers.rb b/Library/Homebrew/dependencies_helpers.rb index 02965a446a..7646402026 100644 --- a/Library/Homebrew/dependencies_helpers.rb +++ b/Library/Homebrew/dependencies_helpers.rb @@ -30,7 +30,7 @@ module DependenciesHelpers end ignores << "recommended?" if args.skip_recommended? - ignores << "satisfied?" if args.skip_installed? + ignores << "satisfied?" if args.missing? [includes, ignores] end