1628 Commits

Author SHA1 Message Date
Mike McQuaid
05c7b65f54
tab, cask/tab: add more Sorbet types and signatures.
I bailed before going all the way to `typed: strict` but this should at
least improve things and fix:

`Library/Homebrew/tab.rb:111: warning: The class Tab reached 8 shape variations, instance variables accesses will be slower and memory usage increased.`
2025-06-24 12:06:55 +01: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
Rylan Polster
c03f70f1dc
Refactor OnSystem and SimulateSystem bottle tag handling 2025-06-03 11:57:17 -04:00
Daeho Ro
24cd62140d
feat: add _ to powershell completion filename 2025-05-25 00:15:26 +09:00
Mike McQuaid
e33222b9c1
formula: remove unneeded attr_reader. 2025-04-30 16:42:29 +01:00
botantony
a10b635fe9 no_autobump!: suggestions from contributors and docs
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-29 18:04:59 +02:00
botantony
79cf39fc1d formula/cask: add symbol support to no_autobump! method
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-29 18:04:59 +02:00
botantony
5c032d3616 formula: fix JSON API generation for no_autobump! method
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-29 18:04:59 +02:00
botantony
ad66e0c418 tap: get autobump list from formula/cask API
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
Mike McQuaid
c9a7b62b1d
Homebrew 4.5 deprecations/disables/removals
The usual cycle of deprecating, disabling, and removing things in
Homebrew major/minor releases.
2025-04-22 17:15:23 +01: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
ca447e1ce9 deprecate!/disable!: replacement_formula/replacement_cask fields
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-21 21:13:25 +02:00
botantony
e594e7e0bb deprecate!/disable!: allow to specify replacement type
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-21 21:13:25 +02:00
Thierry Moisan
8211e0de85
shebang: include php language in formula 2025-04-09 12:32:08 -04:00
Mike McQuaid
c72386e3c3
bundle/commands/cleanup: correctly handle .keepme references.
Extract the relevant logic from `formula.rb`, moving to `keg.rb` and
then use this logic in `bundle/commands/cleanup.rb` to ensure that we
don't say we need to uninstall formulae that should be still kept.
2025-04-01 15:12:12 +01:00
Carlo Cabrera
b66c682dc6
formula: fix warning message grammar
The sentence needs a verb.
2025-04-01 17:19:57 +08:00
Douglas Eichelberger
e58486cd4c
fix: Allow Formula.url with no args to get url 2025-03-26 12:15:25 -07:00
botantony
96eacb7fd9
std_go_args: add -tags flag
Signed-off-by: botantony <antonsm21@gmail.com>
2025-03-16 21:41:19 +01:00
Mike McQuaid
805cd6f54f
formula: use any_installed_prefix for service paths
This fixes some edge cases where these paths cannot be found if a keg is
not linked.
2025-03-14 17:17:27 +00:00
botantony
bf7514f328
docs: add a bit more information about std_*_args to Formula Cookbook 2025-03-04 13:04:10 +01:00
Heath Stewart
222e8d129a
Document pwsh shell completion
Based on discussion in #19408, update the documentation to specify that `:pwsh` must be passed explicitly and that it will translate to a "powershell" argument, as is currently supported by Go's common `github.com/spf13/cobra` module and Rust's common `clap` (with `clap_complete`) crate.
2025-03-04 02:16:48 -08:00
Carlo Cabrera
807709622b
formula: remove pwsh from default completion shells
Fixes https://github.com/Homebrew/brew/pull/19407#issuecomment-2694083829
2025-03-03 20:07:13 +08:00
Mike McQuaid
e401eee162
Merge pull request #19407 from heaths/issue19403
Add PowerShell (pwsh) completion support
2025-03-03 08:31:03 +00:00
Douglas Eichelberger
fcf18912fe
Inline use of attr_predicate 2025-03-02 21:36:03 -08:00
Heath Stewart
15282dcdbd
Fix lint 2025-03-02 18:44:40 -08:00
Heath Stewart
42caf20fa4
Add PowerShell (pwsh) completion support
Resolves #19403
2025-03-02 18:17:38 -08:00
Douglas Eichelberger
19332ee1d5
Merge pull request #19383 from Homebrew/fix-yard-directives
docs: Remove misused YARD directives
2025-02-25 20:56:58 +00:00
Douglas Eichelberger
3b3c55ca0d
fix: Remove misused YARD directives 2025-02-25 11:55:37 -08:00
Douglas Eichelberger
a092403b16
Fix breaking type change in Formula#std_npm_args 2025-02-25 11:23:29 -08:00
Douglas Eichelberger
6cd9daffdf
Fix return type of Formula.build 2025-02-25 09:03:01 -08:00
Douglas Eichelberger
49ee4d5720
Fix docs 2025-02-24 10:23:43 -08:00
Douglas Eichelberger
ca8759605c
Fix tests 2025-02-24 10:23:42 -08:00
Douglas Eichelberger
beeb0b8f6d
Reclaim some vertical real estate 2025-02-24 10:23:42 -08:00
Douglas Eichelberger
a81239ec2d
Enable strict typing in Formula 2025-02-24 10:23:42 -08:00
Douglas Eichelberger
7880490f85
Update Library/Homebrew/formula.rb
Co-authored-by: Markus Reiter <me@reitermark.us>
2025-02-23 15:09:34 -08:00
Douglas Eichelberger
3ef22f3181
Inline use of attr_rw 2025-02-23 13:18:49 -08:00
botantony
c5d78f3347
zig std args: use symbols for compilation options 2025-02-21 17:07:29 +01:00
botantony
bfdfdc9489
-fno-rosetta flag 2025-02-21 16:49:11 +01:00
botantony
1e5414c6ac
formula: include -Doptimize flag for Zig std args 2025-02-21 16:01:43 +01:00
botantony
21714d63a4
formula: add std_zig_args 2025-02-21 14:53:34 +01:00
Sam Ford
a7cacfff1c
livecheck: refactor HEAD-only formula handling
The existing code for handling a `HEAD`-only formula involves two
return values that can be `nil` but this isn't apparent because the
related methods aren't typed. This adds type signatures to the
methods and updates the livecheck code to account for `nil` return
values (making it clear which methods can return `nil`).

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2025-02-20 22:39:18 -05:00
Adrian Ho
2df84408c1 formula: don't include DATA patches in initial Git repo
Currently, existing DATA patches are subsumed into the initial Git repo
created by `brew install --git`, which makes creating a new DATA
patch after more fixes a tedious and error-prone process.

This PR delays DATA patch processing till after the Git repo is
created, so a `git diff` at the end creates a correct and consolidated
DATA patch block ready for insertion/replacement, or even migration
to a proper remote patch URL.

The difference is clearly seen in `gromgit/fuse/dislocker-mac`,
which has both remote and DATA patches.

Before:
```
% brew install -sig dislocker-mac
==> Fetching gromgit/fuse/dislocker-mac
==> Downloading 2cfbba2c8c.patch?full_index=1
Already downloaded: /Volumes/aho/Library/Caches/Homebrew/downloads/37276859cbebc1711941278db00cd8b25b98d69e15e31e33915a98d01a13febc--2cfbba2c8cc07e529622ba134d0a6982815d2b30.patch
==> Downloading https://github.com/Aorimn/dislocker/archive/refs/tags/v0.7.3.tar.gz
Already downloaded: /Volumes/aho/Library/Caches/Homebrew/downloads/b1ba1098c95535574936051eca45cc472955a5a024b81cc72e1c3b006e1950b3--dislocker-0.7.3.tar.gz
==> Installing dislocker-mac from gromgit/fuse
==> Patching
==> Applying 2cfbba2c8cc07e529622ba134d0a6982815d2b30.patch
Initialized empty Git repository in /private/tmp/dislocker-mac-20250215-35534-8qlxtp/dislocker-0.7.3/.git/
==> Entering interactive mode...
Type `exit` to return and finalize the installation.
Install to this prefix: /opt/homebrew/Cellar/dislocker-mac/0.7.3_2
This directory is now a Git repository. Make your changes and then use:
  git diff | pbcopy
to copy the diff to the clipboard.
% git diff
```

After:
```
% brew install -sig dislocker-mac
==> Fetching gromgit/fuse/dislocker-mac
==> Downloading 2cfbba2c8c.patch?full_index=1
Already downloaded: /Volumes/aho/Library/Caches/Homebrew/downloads/37276859cbebc1711941278db00cd8b25b98d69e15e31e33915a98d01a13febc--2cfbba2c8cc07e529622ba134d0a6982815d2b30.patch
==> Downloading https://github.com/Aorimn/dislocker/archive/refs/tags/v0.7.3.tar.gz
Already downloaded: /Volumes/aho/Library/Caches/Homebrew/downloads/b1ba1098c95535574936051eca45cc472955a5a024b81cc72e1c3b006e1950b3--dislocker-0.7.3.tar.gz
==> Installing dislocker-mac from gromgit/fuse
==> Applying non-DATA patches
==> Applying 2cfbba2c8cc07e529622ba134d0a6982815d2b30.patch
Initialized empty Git repository in /private/tmp/dislocker-mac-20250215-32462-zh1akh/dislocker-0.7.3/.git/
==> Applying DATA patches
==> Entering interactive mode...
Type `exit` to return and finalize the installation.
Install to this prefix: /opt/homebrew/Cellar/dislocker-mac/0.7.3_2
This directory is now a Git repository. Make your changes and then use:
  git diff | pbcopy
to copy the diff to the clipboard.
% git diff
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bd854d2..9ab137d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -92,7 +92,7 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
        # Don't use `-read_only_relocs' here as it seems to only work for 32 bits
        # binaries
        set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-bind_at_load")
-       set (FUSE_LIB osxfuse_i64)
+       set (FUSE_LIB fuse)
 else()
        # Useless warnings when used within Darwin
        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion")
diff --git a/src/dislocker-fuse.c b/src/dislocker-fuse.c
index f93523f..3dd106c 100644
--- a/src/dislocker-fuse.c
+++ b/src/dislocker-fuse.c
@@ -33,11 +33,7 @@

-#ifdef __DARWIN
-# include <osxfuse/fuse.h>
-#else
-# include <fuse.h>
-#endif /* __DARWIN */
+#include <fuse.h>

 /** NTFS virtual partition's name */
```
2025-02-18 18:12:35 +08:00
Roman Romanov
208acd8e43
Fix "can't modify frozen String" error
Fix "can't modify frozen String" error if bottle requires Command Line Tools when installing/updating several packages, which causes install/update process failure.
2025-02-09 20:16:16 +03:00
apainintheneck
839198d21e Remove JSON v3 formula logic 2025-02-05 23:36:57 -08:00
Mike McQuaid
2b737f0423
Split up SoftwareSpec
This came up in the AGM and has bothered me for years: let's actually
split out `software_spec.rb` into one file per class, as is more typical
in Ruby.

This will make these classes easier to find.
2025-02-04 16:27:39 +00:00
Mike McQuaid
7ff99e2353
Use ~ instead of ${HOME}
Partial revert of Homebrew/brew#19153
See https://github.com/Homebrew/brew/pull/19153#discussion_r1930678587
2025-01-27 15:19:59 +00:00
Mike McQuaid
bbf5a9f479
env_config: use environment variables consistently
- use e.g. `$HOMEBREW_*` for cases where only the environment variable
  is the entire backtick-quoted string
- use e.g. `${HOMEBREW_*}` for cases where the environment variable is
  part of a backtick-quoted string to make clear what parts are variable
  and what parts are not
- use `export HOMEBREW_*=...` for cases where we're talking about
  setting the environment variable (because it likely needs to be
  exported to work how they want)

Inspired by https://github.com/Homebrew/homebrew-bundle/pull/1579 making
similar changes for Homebrew/homebrew-bundle.
2025-01-27 14:21:27 +00:00
Mike McQuaid
aeaeccc3b1
formula: add .keepme files to prevent cleanup
Allow the use of `.keepme` files inside a keg to prevent the cleanup.

Rather than having a binary state of "never cleanup if `.keepme` is
present" and "can cleanup without", instead a `.keepme` file is
essentially providing reference counting.

It can contain one or more lines which reference files on disk. If the
file exists, the `.keepme` file will prevent cleanup. If/when it does
not: `brew cleanup` will happily cleanup this keg (providing all other
conditions apply).
2025-01-23 14:29:48 +00: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