3183 Commits

Author SHA1 Message Date
Douglas Eichelberger
cb71938fff Enable strict typing in CLI::Parser 2024-04-21 14:16:25 -07:00
Ruoyu Zhong
ea37708591
dev-cmd/tap-new: simplify 2024-04-19 23:14:35 +08:00
Ruoyu Zhong
82ad03fe28
dev-cmd/tap-new: various improvements
1. Update `actions/cache` to `v4`.
2. Unset GitHub Packages tokens if unused.
3. Quote shell variables.
2024-04-19 11:10:29 +08:00
Ruoyu Zhong
7e43853216
dev-cmd/tap-new: fix GitHub Packages user
It should be `github.repository_owner` rather than `github.actor`.
2024-04-19 11:09:58 +08:00
Ruoyu Zhong
adbe6edc84
dev-cmd/tap-new: use actions/upload-artifact@v4 2024-04-19 11:09:56 +08:00
Ruoyu Zhong
54a5690391
dev-cmd/tap-new: throw an error when tap is installed 2024-04-19 11:02:25 +08:00
Issy Long
4c64193b9b
Set HOMEBREW_DEBUG when running brew tests --debug
- This will cause the "debug" gem to be required in `spec_helper.rb`, so we can do interactive debugging.
2024-04-17 23:26:40 +01:00
Issy Long
073e739005
Use the debug gem from portable Ruby
- This is cleaner than vendoring a whole bunch of new gems and pinning `psych`.
- Thanks for the pointer, Bo!
- It doesn't work, though?

```
❯ brew tests --only=migrator --debug
Error: cannot load such file -- debug/debug.so
Warning: Removed Sorbet lines from backtrace!
Rerun with `--verbose` to see the original backtrace
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/frame_info.rb:16:in `require'
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/frame_info.rb:16:in `rescue in <module:DEBUGGER__>'
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/frame_info.rb:13:in `<module:DEBUGGER__>'
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/frame_info.rb:3:in `<top (required)>'
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/session.rb:31:in `require_relative'
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/session.rb:31:in `<top (required)>'
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug.rb:3:in `require_relative'
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug.rb:3:in `<top (required)>'
/opt/homebrew/Library/Homebrew/dev-cmd/tests.rb:48:in `require'
/opt/homebrew/Library/Homebrew/dev-cmd/tests.rb:48:in `run'
/opt/homebrew/Library/Homebrew/brew.rb:89:in `<main>'
```
2024-04-17 23:26:40 +01:00
Issy Long
621e51a6c9
Don't require "debug" in brew tests - it's in our RSpec config 2024-04-17 22:25:12 +01:00
Issy Long
1daeb5bee0
Set up the debug gem for test debugging
- This processed that we'd requested a debugger, but didn't drop us into
  a debugging console until I
  [stopped the stdin disablement](https://github.com/Homebrew/brew/issues/16708#issuecomment-1953483970).

Usage:

```
❯ git diff
diff --git a/Library/Homebrew/test/migrator_spec.rb b/Library/Homebrew/test/migrator_spec.rb
index 87fadd5e95..db4700810a 100644
--- a/Library/Homebrew/test/migrator_spec.rb
+++ b/Library/Homebrew/test/migrator_spec.rb
@@ -69,6 +69,8 @@ RSpec.describe Migrator do
       tab.source["tap"] = "homebrew/core"
       tab.write

+      binding.break
+
       expect do
         described_class.new(new_formula, "oldname")
       end.to raise_error(Migrator::MigratorDifferentTapsError)

issyl0 at pictor in /opt/homebrew on bye-byebug
❯ brew tests --only=migrator --debug
Randomized with seed 59158
1 process for 1 spec, ~ 1 spec per process
.==> Relinking newname
.==> Unlinking oldname
...==> Moving oldname versions to /private/tmp/homebrew-tests-20240403-85464-3uogqr/cellar/newname
....==> Migrating formula oldname to newname
==> Unlinking oldname
==> Moving oldname versions to /private/tmp/homebrew-tests-20240403-85464-3uogqr/cellar/newname
==> Relinking newname
....[67, 76] in ~/migrator_spec.rb
    67|       tab = Tab.empty
    68|       tab.tabfile = HOMEBREW_CELLAR/"oldname/0.1/INSTALL_RECEIPT.json"
    69|       tab.source["tap"] = "homebrew/core"
    70|       tab.write
    71|
=>  72|       binding.break
    73|
    74|       expect do
    75|         described_class.new(new_formula, "oldname")
    76|       end.to raise_error(Migrator::MigratorDifferentTapsError)
=>#0    block in <top (required)> (3 levels) at ~/migrator_spec.rb:72
  #1    [C] BasicObject#instance_exec at /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/example.rb:263
  # and 68 frames (use `bt' command for all frames)
(rdbg@/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/bin/rspec#85464) p tab
(rdbg@/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/bin/rspec#85464) p    # command(rdbg@/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/bin/rspec#85464) p     # command t    # command ta    # command tab    # command(rdbg@/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/bin/rspec#85464) p tab    # command
=> #<Tab:0x0000000107156be0 @aliases=[], @arch=nil, @built_as_bottle=false, @built_on={"os"=>"Macintosh", "os_version"=>"macOS 14", "cpu_family"=>"arm_firestorm_icestorm"}, @compiler=:clang, @homebrew_version="4.2.16-55-gc8f60ec-dirty", @installed_as_dependency=false, @installed_on_request=false, @loaded_from_api=false, @poured_from_bottle=false, @runtime_dependencies=nil, @source={"path"=>nil, "tap"=>"homebrew/core", "tap_git_head"=>nil, "spec"=>"stable", "versions"=>{"stable"=>nil, "head"=>nil, "version_scheme"=>0}}, @source_modified_time=0, @stdlib=nil, @tabfile=#<Pathname:/private/tmp/homebrew-tests-20240403-85464-3uogqr/cellar/oldname/0.1/INSTALL_RECEIPT.json>, @time=nil, @unused_options=[], @used_options=[]>
(rdbg@/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/bin/rspec#85464)
```
2024-04-17 22:25:12 +01:00
Issy Long
11c1960729
Remove byebug since it doesn't work in tests anymore
- Byebug was introduced in [2020](https://github.com/Homebrew/brew/pull/7577) for hooking into tests for debugging.
- It does not work anymore in so far as it does not stop at breakpoints when following the instructions to trigger them in tests.
2024-04-17 22:24:21 +01:00
Ruoyu Zhong
4cf42f7c18
pr-pull: simplify 2024-04-17 07:37:02 +08:00
Ruoyu Zhong
dd92ad8e1b
Update default artifact pattern to avoid migration problems 2024-04-17 06:15:14 +08:00
Ruoyu Zhong
1a1a466e9d
pr-pull: support globbing artifacts
Artifact actions v3 is deprecated and will soon be unavailable [^1].
This adds support for v4 by allowing `brew pr-pull` to accept a glob
pattern for artifact names, like actions/download-artifact does [^2].

[^1]: https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/
[^2]: https://github.com/actions/download-artifact/tree/v4/#usage
2024-04-17 03:36:43 +08:00
Mike McQuaid
c4f2f06675
dev-cmd/tests: fix when euid != uid.
Otherwise you get:
`ruby: no -r allowed while running setuid (SecurityError)`
2024-04-11 17:26:38 +01:00
Bo Anderson
073e35d4ba
dev-cmd/generate-*-api: ensure title is a string 2024-04-10 04:51:23 +01:00
Douglas Eichelberger
c404dd9a05 Update tapioca config 2024-04-08 11:58:34 -07:00
Mike McQuaid
27f47bafbc
dev-cmd/bump-cask-pr: use FromContentLoader when relevant.
When loading from `tmp_contents` in `bump-cask-pr` we're always loading
from the contents and not from a e.g. filename etc. As a result, skip
the detection of the correct loader (as the regex can be a bit flaky)
and instead use `FromContentLoader` directly.
2024-04-08 13:25:59 +01:00
Douglas Eichelberger
351f14f9f4 Add IRB H = Homebrew alias 2024-04-04 19:15:59 -07:00
Mike McQuaid
a1e24eeb5e
Merge pull request #17023 from Homebrew/bump_skip_repology
dev-cmd/bump: unconditionally skip Repology queries for now.
2024-04-04 09:55:29 +01:00
Mike McQuaid
acb7f45cfd
dev-cmd/bump: unconditionally skip Repology queries for now.
We've been blocked by Repology so let's stop querying them for now.

Fixes #17021.
2024-04-04 09:43:44 +01:00
Bo Anderson
27ca946c06
dev-cmd/typecheck: use EUID with sorbet 2024-04-04 08:47:32 +01:00
Douglas Eichelberger
6d716a7d69 Missed one 2024-04-01 12:09:20 -07:00
Mike McQuaid
df2c914b42
Merge pull request #16989 from cho-m/livecheck-throttle-audit-updates
formula_auditor: check livecheck throttle
2024-04-01 13:55:50 +01:00
Michael Cho
4b65052b22
dev-cmd/bump-formula-pr: deprecate throttled_formulae.json
Signed-off-by: Michael Cho <michael@michaelcho.dev>
2024-04-01 00:54:36 -04:00
Sam Ford
a4134125f2
livecheck: Clarify --extract-plist behavior
From the description of the `--extract-plist` option, it would seem
that the `ExtractPlist` strategy is only enabled when the option is
used. Instead, livecheck automatically enables the strategy if the
command is run on only one cask. This rewords descriptions of the
option to clarify the behavior.
2024-03-31 21:01:40 -04:00
Mike McQuaid
21dd3c263f
Merge pull request #16975 from Homebrew/ported-cmds
Begin porting non-dev commands to use AbstractCommand
2024-03-31 19:28:30 +01:00
Douglas Eichelberger
65f8420232 Make things private 2024-03-30 16:43:11 -07:00
Issy Long
9dfe11870e
Convert the EnvConfig RBI generator to a Tapioca compiler 2024-03-30 18:30:20 +00:00
Issy Long
a3932b44c0
Merge pull request #16899 from Homebrew/tapioca-compiler-for-tty-rbi
Convert the `utils/tty` RBI generator to a Tapioca compiler
2024-03-30 18:10:41 +00:00
Douglas Eichelberger
c50fb2dbd2 Remove redundant cli/parser requires 2024-03-29 18:53:07 -07:00
Mike McQuaid
ec74bad6d3
Merge pull request #16962 from Homebrew/bump_15_prs
dev-cmd/bump*: limit the number of open PRs to 15.
2024-03-29 08:16:39 +00:00
Issy Long
05b716613b
Convert the utils/tty RBI generator to a Tapioca compiler
- The preferred way of doing RBI generation is via Tapioca. So I am
  trying to stop being intimidated by it, by learning how it works.
- This is very WIP still, currently failing with the following message
  because the `module` name is missing in the generated RBI file.

```
There are parse errors in the generated RBI files.

Errors:
  sorbet/rbi/dsl/tty.rbi:8: unexpected token tNL (2001)
  sorbet/rbi/dsl/tty.rbi:64: unexpected token "end" (2001)
```
2024-03-29 00:41:56 +00:00
Bo Anderson
2f05b47242
Fix setup-ruby/rubocop issues when euid != uid 2024-03-28 15:39:07 +00:00
Mike McQuaid
fe16b14479
dev-cmd/bump*: limit the number of open PRs to 15.
Don't let users open more than 15 PRs at a time. We have other tooling
to nudge them to not do this but let's put it in the worst offenders:
the `bump*` commands.
2024-03-28 11:56:25 +00:00
Bo Anderson
28a80a6ebf
Avoid writable_real? 2024-03-27 06:26:32 +00:00
Douglas Eichelberger
7f9748bd03 Port Homebrew::DevCmd::VendorGems 2024-03-22 09:33:28 -07:00
Douglas Eichelberger
084f63ef22 Port Homebrew::DevCmd::UpdateTest 2024-03-22 09:33:28 -07:00
Douglas Eichelberger
c789bf4475 Port Homebrew::DevCmd::UpdateSponsors 2024-03-22 09:33:28 -07:00
Douglas Eichelberger
7bef4b010c Port Homebrew::DevCmd::UpdatePythonResources 2024-03-22 09:33:28 -07:00
Douglas Eichelberger
46d758d5cf Port Homebrew::DevCmd::UpdateLicenseData 2024-03-22 09:33:28 -07:00
Douglas Eichelberger
bdf8fbc1ad Port Homebrew::DevCmd::Unpack 2024-03-22 09:33:28 -07:00
Douglas Eichelberger
ba5f392d4c Port Homebrew::DevCmd::Typecheck 2024-03-22 09:33:28 -07:00
Douglas Eichelberger
445d81db2e Port Homebrew::DevCmd::Tests 2024-03-22 09:33:28 -07:00
Douglas Eichelberger
827e943803 Port Homebrew::DevCmd::Test 2024-03-22 09:33:28 -07:00
Douglas Eichelberger
e0519d736a Port Homebrew::DevCmd::TapNew 2024-03-22 09:33:28 -07:00
Douglas Eichelberger
0d04f198d2 Port Homebrew::DevCmd::StyleCmd 2024-03-22 09:33:28 -07:00
Douglas Eichelberger
1436b06e90 Port Homebrew::DevCmd::Sh 2024-03-22 09:33:28 -07:00
Douglas Eichelberger
177bab38c7 Port Homebrew::DevCmd::Release 2024-03-22 09:33:28 -07:00
Douglas Eichelberger
6d362ccb3b Port Homebrew::DevCmd::PrUpload 2024-03-22 09:33:28 -07:00