From 200452e23dd9a7cc9ab739bbd4fdd0e56966488d Mon Sep 17 00:00:00 2001 From: apainintheneck Date: Mon, 14 Oct 2024 20:49:04 -0700 Subject: [PATCH] cmd/upgrade: required named args when upgrading from source The --build-from-source flag can currently be used without specifying a formula by name but it doesn't behave the way you'd expect it to. It will upgrade everything using bottles if they are available and skip building things from source. This is intentional because we want to discourage non-developers from building packages from source since the result is less predictable. The change here is to error out in that case. It might be smarter to go through the entire deprecation cycle here just in case someone is using this in scripts. --- Library/Homebrew/cmd/upgrade.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 80a6a019a7..cf17914f10 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -120,6 +120,10 @@ module Homebrew sig { override.void } def run + if args.build_from_source? && args.named.empty? + raise ArgumentError, "--build-from-source requires at least one formula" + end + formulae, casks = args.named.to_resolved_formulae_to_casks # If one or more formulae are specified, but no casks were # specified, we want to make note of that so we don't