475 Commits

Author SHA1 Message Date
Sam Ford
3df8f70511
OnSystem: Add UsesOnSystem class
This adds a `UsesOnSystem` class to `OnSystem`, containing boolean
instance variables to indicate which types of on_system methods are
used in a formula or cask. This is intended as a replacement for
`@on_system_blocks_exist`, which doesn't allow us to determine what
kinds of on_system calls were used. This provides more granularity
but we can still use `@uses_on_system.present?` to determine whether
any on_system calls were used (and this doubles as a `nil` check in
`Formula`, as the `self.class` instance variable has to use a nilable
type).

The `UsesOnSystem` instance variables cover the current
`ARCH_OPTIONS` and `BASE_OS_OPTIONS`. At the moment, we mostly need
to tell whether there are macOS/Linux or Intel/ARM on_system calls,
so I've omitted instance variables for specific macOS version until
we have a need for them.

As a practical example, if you wanted to determine whether a cask
uses Linux on_system calls, you can call
`cask.uses_on_system.linux?`. The `linux` boolean will be `true` if
the cask has an `on_linux` block, an `on_system` block (which requires
Linux), or uses `os linux: ...`. This is something that would be
challenging to determine from outside of `OnSystem` but it's
relatively easy to collect the information in `OnSystem` methods and
make it available like this.
2025-06-07 17:58:12 -04:00
botantony
91f328950f test/fixtures: fix cask JSON fixture
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-29 18:04:59 +02:00
botantony
9ff2abbcdf no_autobump!: rename no_autobump_msg field to no_autobump_message
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-29 18:04:59 +02:00
botantony
1fcacdc2dc formula/cask DSL: add no_autobump! method
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-29 18:04:59 +02:00
botantony
4fa1355be0 deprecate!/disable!: remove non-typed replacement field
Signed-off-by: botantony <antonsm21@gmail.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2025-04-21 21:13:25 +02:00
botantony
d3cfc3d193
unpack .dmg: ignore .HFS+ Private* metadata directories
Signed-off-by: botantony <antonsm21@gmail.com>
2025-03-18 12:59:21 +01:00
Issy Long
089680c76f
rubocops/cask/stanza_order: Ensure arch and os are adjacent
- Because Patrick wanted this to be codified.
2025-03-16 21:36:07 +00:00
Sean Molenaar
756ba2ba59 Add Linux dependency check in cask.rb 2025-03-13 21:47:17 +01:00
thibhero
99fad7797c modifying files with brew style 2025-03-06 21:27:13 -05:00
thibhero
f4d93e19b8 refactoring testball case to make it more readable 2025-03-06 20:59:56 -05:00
thibhero
fa4e2bad6e updating testball5-0.1.tbz to make it work 2025-03-06 20:59:33 -05:00
thibhero
e5e647d950 refactoring testball 2025-03-06 19:58:32 -05:00
thibhero
4651b961fa removing attributes from macOS 2025-03-06 19:57:44 -05:00
thibhero
16599b6e05 tests for install_spec.rb 2025-03-06 19:34:46 -05:00
thibhero
4e90aa527d moving testball3 to testball5 2025-03-06 19:34:25 -05:00
thibhero
f0f2e59fb7 Merge branch 'master' into ask-test
# Conflicts:
#	Library/Homebrew/vendor/bundle/bundler/setup.rb
2025-03-06 00:12:32 -05:00
thibhero
885b7c6f4f checking other tests functions 2025-03-05 23:57:58 -05:00
thibhero
0f919e8397 new files for integration_spec.rb for testball3 and 4 2025-03-05 21:32:48 -05:00
thibhero
0b9374b7ac modifying integration_test.rb to work with other dependencies 2025-03-05 21:29:02 -05:00
Sean Molenaar
fc319f6793 feat: add tests for completion stanzas 2025-03-05 20:12:18 +01:00
Rylan Polster
f874603a21 Add implicit macOS dependency to casks without explicit depends_on stanza 2025-02-17 14:30:44 +01:00
Mike McQuaid
8adc188992
Import brew alias and brew unalias commands
Import these from the homebrew/aliases tap and deprecate that tap.

This required a little messing around with class/module/constant names
to get `brew tests` and `brew typecheck` to play nicely.

I added also added Sorbet type signatures and integration tests.
2025-02-07 14:31:50 +00:00
apainintheneck
839198d21e Remove JSON v3 formula logic 2025-02-05 23:36:57 -08:00
Douglas Eichelberger
f5d2d30f5b Add test for concurrent fetching 2025-02-04 13:02:50 -08:00
Bo Anderson
fed5321969
Rename aarch64_linux tag to arm64_linux 2025-02-01 13:03:58 +01:00
Rylan Polster
c023b70e8f
Mirror real installation directory structure for tests 2025-01-23 03:11:59 -05:00
Issy Long
6ada9a9665
Add clarifying comments to rubocop:disables
- Needed for PR 18842 that adds a `DisableComment` RuboCop to ensure that all RuboCop disables have comments.
2025-01-12 16:59:07 +00:00
Mike McQuaid
e9b4979f40
Add support for Homebrew wrappers
Allow the ability for a system administrator to use
`HOMEBREW_BREW_WRAPPER` and `HOMEBREW_FORCE_BREW_WRAPPER` variables to
enforce the usage of a particular `brew` command for non-trivial (e.g.
`brew --prefix` is considered trivial, it doesn't need to write to the
prefix) Homebrew commands.

This also introduces a `HOMEBREW_ORIGINAL_BREW_FILE` variable for some
internal usage; `HOMEBREW_BREW_FILE` was being used internally for
both "how should we shell out to Homebrew" and "what should we use
to check permissions on Homebrew". `HOMEBREW_ORIGINAL_BREW_FILE` is
now used just for the latter case.

Inspired by conversation in
https://github.com/Homebrew/homebrew-bundle/pull/1551 which suggested
this was worth fixing in wider than just `brew bundle`.
2025-01-07 17:40:18 +00:00
Rui Chen
79ed2c6e61
chore: fix typos
Signed-off-by: Rui Chen <rui@chenrui.dev>
2024-12-28 15:53:35 -05:00
Mike McQuaid
4d4531c19d
Revamp installed_on_request handling
- `reinstall` and `upgrade` no longer mark as installed on request,
  with or without names specified, but preserve the version from the
  tab instead
- default `install_on_request` to `false` rather than `true`
- only set installed in request in a tab if it's missing rather than
  false

Co-authored-by: Michael Cho <michael@michaelcho.dev>
2024-11-19 08:39:55 +00:00
Caleb Xu
215fc85579
deprecate_disable: support optional replacement parameter 2024-11-08 15:49:00 -05:00
Douglas Eichelberger
ba3f426726 clean up fixture 2024-11-07 13:00:38 -08:00
Przemysław Kryger
ff03947ba0 Use @@HOMEBREW_PREFIX@@ for replacements in external patches 2024-10-23 16:51:01 +01:00
Przemysław Kryger
a03d65b5c9 Allow HOMEBREW_PREFIX replacement in external patches
This fixes #15925
2024-10-23 15:15:17 +01:00
Douglas Eichelberger
ced4a3a91f Migrate Parlour extensions to Tapioca compilers 2024-10-14 19:50:09 -07:00
Bevan Kay
8b33aa048a
test/fixtures: add app binary with valid info.plist file 2024-10-10 10:41:09 +11:00
Bevan Kay
8852f024a6
test/fixtures: add livecheck-extract-plist cask 2024-10-10 10:41:09 +11:00
Bo Anderson
326a71712f
Revert "Shorten brew tests temporary paths."
This reverts commit 27fb07c0fc622d3e010a8a9f6e0056fd09dc5b1f.
2024-09-27 01:55:26 +01:00
Mike McQuaid
5b46ec70e9
cask/url: deprecate url do blocks.
We're removing these in
https://github.com/Homebrew/homebrew-cask/pull/186501
so let's deprecate them too.
2024-09-26 14:05:25 +01:00
Carlo Cabrera
e03a9fd0be
tests: add an extra byte of randomness
Two bytes should hopefully be plenty.
2024-09-25 22:32:51 +08:00
Mike McQuaid
27fb07c0fc
Shorten brew tests temporary paths.
If you have `HOMEBREW_TEMP` set to a longer path (e.g. the user's
private temporary directory rather than `/private/tmp`), Sequoia will
error out on some tests when forking because the path is too long
(> 104 bytes).

To improve this situation let's:
- use a shorter path for `HOMEBREW_TEMP` by appending `/brew-tests` to
  the existing `HOMEBREW_TEMP` used outside of tests rather than
  creating nested temporary directories
- use the minimal amount of randomness to avoid collisions while
  allowing parallel tests
- use `squeeze` to remove any double slashes in the temporary path
2024-09-24 10:28:18 +01:00
Mike McQuaid
f719090446
Add a bunch more UNDEFINED_CONSTANTS for startup.
This should avoid these getting included globally in future.

I found this list from a combination of
https://github.com/Homebrew/brew/pull/17707/files, looking at the
Gemfile and just looking around myself.
2024-08-16 12:33:26 +01:00
apainintheneck
f6a6979711 Verify more constants are not loaded at startup
Loading different constants can be tricky with all the requires in
Homebrew so we want to strengthen the existing checks to make
sure that things are not getting required when there is a performance
penalty. This expands the existing check to include more constants
beyond `Formula` that we don't expect to be defined and that pull
in a lot of other dependencies.
2024-08-14 19:08:31 -07:00
Mike McQuaid
02d414d79b
Merge pull request #18008 from Homebrew/deprecate-old-style-cmds 2024-08-14 07:45:13 +01:00
apainintheneck
1fe16a5e35 Address feedback
- Move HOMEBREW_TAP_DIRECTORY to startup/config.rb because this file
holds more of the directory constants
- Rename `Commands.cmd_directories` to `Commands.tap_cmd_directories`
to better express that the commands come from taps

This file has the directory constants while the other one has regexes.
Just better organization.
2024-08-10 17:52:26 -07:00
apainintheneck
a3e917afe1 Refactor method to remove extra tap requires
We were selectively requiring the tap.rb file in a few places for
performance reasons. The main method we were referencing was the
`Tap.cmd_directories` method which uses `Pathname` and the `TAP_DIRECTORY`
constant internally. `Tap.cmd_directories` is mostly used in the `Commands`
module and that is loaded very early on in the program so it made sense
to move that command to that module. To facilitate that I moved the
`TAP_DIRECTORY` constant to the top-level and renamed it to
`HOMEBREW_TAP_DIRECTORY`. It now lies in the tap_constants.rb file.

A nice bonus of this refactor is that it speeds up loading external
commands since the tap.rb file is no longer required by default in
those cases.
2024-08-10 13:49:10 -07:00
Douglas Eichelberger
cefae82307 Fix tests 2024-08-10 11:20:53 -07:00
Mike McQuaid
f39b5c1426
Merge pull request #17554 from Homebrew/cask-install-receipt 2024-07-13 10:55:06 -04:00
Bo Anderson
ae9d5f9f14
cli/named_args: raise priority of core casks 2024-07-12 05:27:57 +01:00
Rylan Polster
d17da89382
Include recursive dependencies in cask tabs 2024-07-09 15:25:57 -04:00