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>
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 */
```
Fix "can't modify frozen String" error if bottle requires Command Line Tools when installing/updating several packages, which causes install/update process failure.
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.
- 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.
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).
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`.
We have received multiple bug reports from users complaining that `brew`
tells them to install the CLT when they already have Xcode installed.
See, for example, #18976.
Let's try to avoid these issues from being opened by making the error
message more explicit that we require the CLT at a specific location,
and that installing Xcode does not suffice.
When running `generate_completions_from_executable` with a formula's
`bin`/`sbin` executable, the resulting completion is usually intended
for the executable itself.
This required:
- adding signatures/types where missing
- ensuring that we respect the signature of `Version.new`
- remove some non-Sorbet type checks
- fixing the exception in tests
- removing some tests now caught by Sorbet
- fixing `Formula#prefix` so it works as intended with correct type
usage
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
The following methods used in Homebrew/core are now public API:
* `system`
* `std_*_args`
* `any_version_installed?`
* `shared_library`
* `rpath`
* `loader_path`
* `deuniversalize_machos`
* `generate_completions_from_executable`
Also remove duplicate typing in `generate_completions_from_executable`
Seen in:
https://github.com/Homebrew/homebrew-core/pull/191090#issuecomment-2363215204
There's a missing signature issue here due to the `generic_*` aliasing
we're doing. With prepend, though: this is no longer needed and we can
use `super` instead which is more idiomatic and nicer overall.
This pattern should probably be applied in other places but: let's try
this targetting fix for here first.