Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
41.64k stars 9.79k forks source link

bump-formula-pr fails with `Parameter 'version': Expected type T.nilable(String), got type Version with value #<Version:0x0000000107fe472...0.2"` #16917

Closed raulcd closed 8 months ago

raulcd commented 8 months ago

brew doctor output

% brew doctor                                        
Your system is ready to brew.

Verification

brew config output

% brew config
HOMEBREW_VERSION: 4.2.13-38-ge3797d3
ORIGIN: https://github.com/Homebrew/brew
HEAD: e3797d39bde3fe4c4b9c5c3b17dfd653dc592dc9
Last commit: 7 hours ago
Core tap HEAD: 28ac0e2cb51cc6dea310adf56d3db33ea8d25940
Core tap last commit: 4 minutes ago
Core tap JSON: 19 Mar 13:26 UTC
Core cask tap JSON: 19 Mar 13:26 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.1.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: octa-core 64-bit arm_blizzard_avalanche
Clang: 15.0.0 build 1500
Git: 2.44.0 => /opt/homebrew/bin/git
Curl: 8.4.0 => /usr/bin/curl
macOS: 14.4-arm64
CLT: 15.3.0.0.1.1708646388
Xcode: 15.2
Rosetta 2: false

What were you trying to do (and why)?

I was trying to bump the Apache Arrow formula for the new 15.0.2 version.

https://github.com/apache/arrow/blob/ed47ad22c8537b32abf27580e75fcf514be11f7e/dev/release/post-13-homebrew.sh#L50-L57

What happened (include all command output)?

Switched to a new branch 'apache-arrow-15.0.2'
Updating apache-arrow formulae
Warning: bump-formula-pr is a developer command, so Homebrew's
developer mode has been automatically turned on.
To turn developer mode off, run:
  brew developer off

Error: Parameter 'version': Expected type T.nilable(String), got type Version with value #<Version:0x0000000107fe472...0.2", @detected_from_url=true>
Caller: /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/sorbet-runtime-0.5.11294/lib/types/private/methods/call_validation.rb:133
Definition: /opt/homebrew/Library/Homebrew/utils/github.rb:523
Please report this issue:
  https://docs.brew.sh/Troubleshooting
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/sorbet-runtime-0.5.11294/lib/types/configuration.rb:296:in `call_validation_error_handler_default'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/sorbet-runtime-0.5.11294/lib/types/configuration.rb:303:in `call_validation_error_handler'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/sorbet-runtime-0.5.11294/lib/types/private/methods/call_validation.rb:300:in `report_error'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/sorbet-runtime-0.5.11294/lib/types/private/methods/call_validation.rb:136:in `block in validate_call_skip_block_type'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/sorbet-runtime-0.5.11294/lib/types/private/methods/signature.rb:234:in `block in each_args_value_type'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/sorbet-runtime-0.5.11294/lib/types/private/methods/signature.rb:228:in `each'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/sorbet-runtime-0.5.11294/lib/types/private/methods/signature.rb:228:in `each_args_value_type'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/sorbet-runtime-0.5.11294/lib/types/private/methods/call_validation.rb:133:in `validate_call_skip_block_type'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/sorbet-runtime-0.5.11294/lib/types/private/methods/call_validation.rb:109:in `block in create_validator_slow_skip_block_type'
/opt/homebrew/Library/Homebrew/utils/github.rb:628:in `check_for_duplicate_pull_requests'
/opt/homebrew/Library/Homebrew/dev-cmd/bump-formula-pr.rb:474:in `check_closed_pull_requests'
/opt/homebrew/Library/Homebrew/dev-cmd/bump-formula-pr.rb:459:in `check_new_version'
/opt/homebrew/Library/Homebrew/dev-cmd/bump-formula-pr.rb:164:in `bump_formula_pr'
/opt/homebrew/Library/Homebrew/brew.rb:86:in `<main>'

What did you expect to happen?

The bump-formula-pr succeeds.

Step-by-step reproduction instructions (by running brew commands)

brew bump-formula-pr \ 
      --commit \ 
      --no-audit \ 
      --sha256="abbf97176db6a9e8186fe005e93320dac27c64562755c77de50a882eb6179ac6" \ 
      --url="https://www.apache.org/dyn/closer.lua?path=arrow/arrow-15.0.2/apache-arrow-15.0.2.tar.gz" \ 
      --verbose \ 
      --write-only \ 
      apache-arrow
raulcd commented 8 months ago

Arrow issue related: https://github.com/apache/arrow/issues/40663 As suggested by @kou this might be needed for the fix:

diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb
index 4ed5dbb345..e3c853eb1b 100644
--- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb
+++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb
@@ -464,6 +464,7 @@ module Homebrew
       specs[:tag] = tag if tag.present?
       version = Version.detect(url, **specs)
       return if version.null?
+      version = version.to_s
     end

     check_throttle(formula, version)
EricFromCanada commented 8 months ago

Thanks for the report!