2498 Commits

Author SHA1 Message Date
Mike McQuaid
0a9fec107e
Merge pull request #20396 from Homebrew/more_pathname_types
extend/pathname: fix another type error.
2025-08-07 08:47:07 +00:00
Mike McQuaid
0a881b9a0d
extend/pathname: fix another type error.
Let's make this consistent with the rest of this file.
2025-08-07 09:32:22 +01:00
Mike McQuaid
31e12d68e3
extend/pathname: fix type error.
`install_p` is sometimes called with a `Pathname` for `new_basename`.
2025-08-07 09:05:40 +01:00
Ruoyu Zhong
10e2c2b298
extend/pathname: accept String as target in write_env_script
There is too much existing usage outside of Homebrew for us to break
[1].

[1]: https://github.com/search?q=%22write_env_script%20%5C%22%22%20NOT%20org%3AHomebrew%20NOT%20is%3Afork&type=code

Closes https://github.com/Homebrew/homebrew-core/pull/232573.
2025-08-07 08:13:15 +08:00
Mike McQuaid
e6ba71c5b1
Add rustc wrapper shim to fix RUSTFLAGS conflicts
Fixes #18556 by using RUSTC_WRAPPER instead of setting RUSTFLAGS directly.
This allows Homebrew's optimization flags to coexist with .cargo/config.toml
settings, preventing build failures when projects have their own Rust
configuration.

- Add rustc_wrapper shim that clears RUSTFLAGS and prepends HOMEBREW_RUSTFLAGS
- Update both std and super environments to use RUSTC_WRAPPER
- Store Homebrew's rustflags in HOMEBREW_RUSTFLAGS instead of RUSTFLAGS

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Carlo Cabrera <github@carlo.cab>
2025-08-06 17:06:25 +01:00
Eric Knibbe
626b6aca2d
RubyDoc output fixes 2025-08-05 17:13:42 -04:00
Mike McQuaid
31150c1951
extend/kernel: remove ensure_formula_installed!
This was a private API so there's no need to deprecate it.
2025-08-04 17:07:31 +01:00
Eric Knibbe
6255263b51
output: express environment variables consistently 2025-08-04 09:50:06 -04:00
Alexander Bayandin
358291e841 extend/kernel: allow exec_editor to open multiple files at once 2025-08-03 16:44:19 +01:00
Daeho Ro
af7966cb2a
pathname: add type to 2025-08-03 18:23:47 +09:00
Carlo Cabrera
a29a643c66
Merge pull request #20359 from Homebrew/replace-ensure_formula_installed!
Replace `ensure_formula_installed!` with `Formula#ensure_installed!`
2025-08-01 21:13:59 +00:00
Carlo Cabrera
0fd3b8e4af
Uncomment odeprecated
This is close enough to #20331 to do now.
2025-08-02 04:00:52 +08:00
Carlo Cabrera
fb35add3b6
Replace ensure_formula_installed! with Formula#ensure_installed!
`ensure_formula_installed!` requires the `Formula` class to be loaded
before being called to work properly.

Let's guarantee that instead by implementing it as an instance method of
the `Formula` class.

See discussion at #20358.
2025-08-02 03:43:37 +08:00
Carlo Cabrera
9dc111247f
Merge pull request #20358 from Homebrew/require-formula-ensure-formula-installed
Ensure we `require "formula"` before doing `ensure_formula_installed!`
2025-08-01 19:21:35 +00:00
Carlo Cabrera
cc5df09845
Ensure we require "formula" before doing ensure_formula_installed!
This is needed to avoid Sorbet runtime errors. See #20352.
2025-08-02 02:46:38 +08:00
Carlo Cabrera
1fc4225850
Merge pull request #20357 from Homebrew/more-extend-kernel-sigs
extend/kernel: tighten type sig for `ensure_formula_installed!`
2025-08-01 18:44:44 +00:00
Carlo Cabrera
f2c32156e8
Merge pull request #20356 from Homebrew/kernel-sigs
extend/kernel: tighten up some type signatures
2025-08-01 18:32:48 +00:00
Carlo Cabrera
cf6c5acce0
extend/kernel: tighten type sig for ensure_formula_installed!
This does the same as #20356 for `ensure_formula_installed!`. See
discussion at #20352.

Unfortunately, one must still `require "formula"` before using this
method because of the `returns(Formula)`, but tightening the type
signature is generally a good idea anyway.

Closes #20352.
2025-08-02 02:23:47 +08:00
Carlo Cabrera
a0a78e6c6c
Remove support for passing Formulae to pretty_*ed methods
It doesn't look like these are even needed.
2025-08-02 02:11:12 +08:00
Carlo Cabrera
a76c33f7bb
extend/kernel: tighten up some type signatures
Allowing either `Formula`e or `String`s in these methods leads to errors
at runtime when one hasn't done `require "formula"` yet.

Let's tighten these up so that they only accept `Formula` arguments to
guarantee that `require "formula"` has been done before they are called.
For callers that need to pass a `String`, we update them to call a
version of these methods that accepts only `String`s.

See discussion at #20352.
2025-08-02 01:59:46 +08:00
Mike McQuaid
d1a33283c6
observer_pathname_extension: add strict Sorbet types. 2025-08-01 17:11:50 +01:00
Mike McQuaid
ea53fdc096
extend/pathname: fix type signature for write_env_script.
It needs to be more permissive.
2025-08-01 15:28:53 +01:00
Mike McQuaid
f405f7316c
extend/kernel: fix odisabled call.
This must set `disable` to `true` to have correct behaviour.
Also, don't allow setting it to `false` to avoid confusion as
that's what `odeprecated` is for.
2025-08-01 08:47:38 +01:00
Mike McQuaid
ec56bbf289
Improve extend/* Sorbet typing 2025-07-31 17:31:27 +01:00
Mike McQuaid
e3c3f5a356
Deprecate/disable/remove code for Homebrew 4.6
The next minor release will be Homebrew 4.6.0 so let's do the usual
deprecation/disable/remove code cycle.
2025-07-31 12:13:01 +01:00
Mike McQuaid
e75d54cbff
linux/development_tools: add undocumented environment variables.
This makes it easier to test the automatic installation of the libc and
compiler formulae without having to change the code.

This is particularly useful now we don't have any official Docker images
for this.
2025-07-25 15:56:33 +00:00
Mike McQuaid
e10d4c43c2
Optionally use DownloadQueue for reinstall, upgrade.
Follow up on `DownloadQueue` for download concurrency on `brew fetch`
and `brew install` to also add support for `brew reinstall` and
`brew upgrade`.

This required a fair bit of refactoring to make this work so I've also
made `install.rb`, `reinstall.rb` and `upgrade.rb` `typed: strict` to
add some extra guardrails from Sorbet here.

Co-authored-by: Carlo Cabrera <github@carlo.cab>
2025-07-24 15:41:03 +01:00
Adrian Ho
8a0a887056 env_script_all_files: don't overwrite existing stuff
Overwriting upstream content potentially causes major confusion at best, major breakage at worst.
2025-07-21 12:41:42 +08:00
Patrick Linnane
4513a43d53
Fix RuboCop failures.
Co-authored-by: Patrick Linnane <patrick@linnane.io>
Co-authored-by: Carlo Cabrera <github@carlo.cab>
Co-authored-by: Thierry Moisan <thierry.moisan@gmail.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2025-07-14 19:12:38 +01:00
Mike McQuaid
6a5a48de29
extend/kernel: fix failures with differing filenames. 2025-07-14 19:12:37 +01:00
Mike McQuaid
d57efd9ea2
Improve some Pathname instance variable handling
Will fix or at least partly address:
```
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/os/linux/elf.rb:225: warning: The class Pathname reached 8 shape variations, instance variables accesses will be slower and memory usage increased.
35
It is recommended to define instance variables in a consistent order, for instance by eagerly defining them all in the #initialize method.
```
2025-07-11 08:02:27 +00:00
Issy Long
990c1efc16
bundle: Rename "brews" to "formulae" for consistency
- Homebrew Bundle referred to formulae as "brews". But it referred to
  casks as "casks" and taps as "taps".
- Let's use the same terminology everywhere.
- (I know that `brew "hello"` is the formula syntax in the Brewfile, so
  I'm not changing that (though would be up for it, in a backwards
  compatible manner), just making the code more consistent.)
2025-07-04 21:08:37 +01:00
Issy Long
019a799fae
Merge pull request #20128 from Homebrew/some-bundle-files-werent-typed-at-all
Make the remaining `bundle` files `typed: true`
2025-06-29 23:10:59 +00:00
Douglas Eichelberger
004c0a2a6c
Refactor exec.rb type fixes 2025-06-29 09:02:24 -07:00
Branch Vincent
ba178a8f10
extend/ENV/super: set MATURIN_NO_INSTALL_RUST 2025-06-27 21:49:56 -07:00
Rylan Polster
f238d3b494
Merge pull request #20151 from Homebrew/fix-doctor-linux
Fix `brew doctor` cask handling on Linux
2025-06-22 10:10:28 +00:00
Rylan Polster
431d8f1ff7
Consistently use ClassMethods sub-module for prepending class methods 2025-06-21 21:40:57 -04:00
Rylan Polster
267afac198
Remove more monkey-patching in extend/os 2025-06-21 21:34:20 -04:00
Rylan Polster
508c8b606c
Fix DevelopmentTools::ld64_version on macOS 2025-06-21 21:13:38 -04:00
Rylan Polster
2a7fbd00a9
Fix Cask::Quarantine class methods on Linux 2025-06-21 21:07:08 -04:00
Rylan Polster
ff79015373
Fix Hardware::CPU::features on macOS 2025-06-21 21:01:44 -04:00
Rylan Polster
e1873d30d4
Run deprecated cask tap check on all systems 2025-06-21 13:59:58 -04:00
Rylan Polster
031160936f
Split out os-specific cask software version checks 2025-06-21 13:59:57 -04:00
Mike McQuaid
9ac306e464
Remove alias generic_* definitions in favour of using super
This is the pattern we've been adopting for a while and it's a bit
cleaner. Let's remove all of the existing usage of the existing pattern
to avoid confusion when adopting the new one.
2025-06-16 08:10:08 +00:00
Mike McQuaid
f234423913
dev-cmd/tests: fix require ordering.
This needs to happen after `setup_environment!` so that
`HOMEBREW_TEST_GENERIC_OS` is set and `OS.linux?` and `OS.mac?` both
`return false`.
2025-06-12 16:43:50 +01:00
Rylan Polster
ce72e34b19
Filter brew tests spec files appropriately for each OS 2025-06-11 15:59:21 -04:00
Mike McQuaid
dc71b7c8f6
Cleanup extend/ directory usage.
- move some things out of `extend` that don't really fit there e.g.
  `Module`s that are included but not doing any
  overriding/monkeypatching
- move some code into `extend/os` to fix all remaining
  `rubocop:todo Homebrew/MoveToExtendOS`s
- remove some unneeded `bundle` skipper code that doesn't really make
  sense given our current bottling strategy
- extract some `Pathname` extensions to `extend/pathname` for separate
  files
- move a `ENV` `Kernel` extension into `kernel.rb`
- `odeprecate` a seemingly unused backwards compatibility method
- move `readline_nonblock` from a monkeypatch to a
  `ReadlineNonblock.read` method as its only used in one place
- fix up a link in documentation
2025-06-09 19:06:16 +01:00
Mike McQuaid
cc03340af3
Reduce Homebrew/brew CI warnings
- Remove a bunch of non-actionable/unnecessary noise in GitHub Actions
  CI.
- Limit number of threads used to generate analytics API data to avoid
  reproducible failures producing errors and requiring retries.
- Move to Debian Old Stable for testing non-system `glibc`.
- Remove unneeded core taps/updates.
- Improve naming of CI jobs to clarify purpose i.e. we're testing
  things work on Linux, not Ubuntu specifically.
- Remove dedicated non-online/non-generic Linux `brew tests` jobs from
  3 to 1.

Co-authored-by: Rylan Polster <rslpolster@gmail.com>
2025-06-09 12:47:22 +01:00
Rylan Polster
73b64390b3
Use existing Utils::Bottles::Collector#specification_for method 2025-06-05 12:38:15 -04:00
Rylan Polster
c03f70f1dc
Refactor OnSystem and SimulateSystem bottle tag handling 2025-06-03 11:57:17 -04:00