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 */
```
- Previously I thought that comments were fine to discourage people from
wasting their time trying to bump things that used `undef` that Sorbet
didn't support. But RuboCop is better at this since it'll complain if
the comments are unnecessary.
- Suggested in https://github.com/Homebrew/brew/pull/18018#issuecomment-2283369501.
- I've gone for a mixture of `rubocop:disable` for the files that can't
be `typed: strict` (use of undef, required before everything else, etc)
and `rubocop:todo` for everything else that should be tried to make
strictly typed. There's no functional difference between the two as
`rubocop:todo` is `rubocop:disable` with a different name.
- And I entirely disabled the cop for the docs/ directory since
`typed: strict` isn't going to gain us anything for some Markdown
linting config files.
- This means that now it's easier to track what needs to be done rather
than relying on checklists of files in our big Sorbet issue:
```shell
$ git grep 'typed: true # rubocop:todo Sorbet/StrictSigil' | wc -l
268
```
- And this is confirmed working for new files:
```shell
$ git status
On branch use-rubocop-for-sorbet-strict-sigils
Untracked files:
(use "git add <file>..." to include in what will be committed)
Library/Homebrew/bad.rb
Library/Homebrew/good.rb
nothing added to commit but untracked files present (use "git add" to track)
$ brew style
Offenses:
bad.rb:1:1: C: Sorbet/StrictSigil: Sorbet sigil should be at least strict got true.
^^^^^^^^^^^^^
1340 files inspected, 1 offense detected
```
This improves the load time of most brew commands. For an example of
one of the simplest commands this speeds up:
Without Bootsnap:
```
$ hyperfine 'git checkout master; brew help' 'git checkout optimise_requires; brew help'
Benchmark 1: git checkout master; brew help
Time (mean ± σ): 525.0 ms ± 35.8 ms [User: 229.9 ms, System: 113.1 ms]
Range (min … max): 465.3 ms … 576.6 ms 10 runs
Benchmark 2: git checkout optimise_requires; brew help
Time (mean ± σ): 383.3 ms ± 25.1 ms [User: 133.0 ms, System: 72.1 ms]
Range (min … max): 353.0 ms … 443.6 ms 10 runs
Summary
git checkout optimise_requires; brew help ran
1.37 ± 0.13 times faster than git checkout master; brew help
```
With Bootsnap:
```
$ hyperfine 'git checkout master; brew help' 'git checkout optimise_requires; brew help'
Benchmark 1: git checkout master; brew help
Time (mean ± σ): 386.0 ms ± 30.9 ms [User: 130.2 ms, System: 93.8 ms]
Range (min … max): 359.5 ms … 469.3 ms 10 runs
Benchmark 2: git checkout optimise_requires; brew help
Time (mean ± σ): 330.2 ms ± 32.4 ms [User: 93.4 ms, System: 73.0 ms]
Range (min … max): 302.9 ms … 413.9 ms 10 runs
Summary
git checkout optimise_requires; brew help ran
1.17 ± 0.15 times faster than git checkout master; brew help
```
This prevents `make` from trying to regenerate `info` files which may
have odd timestamps when this isn't set. See
Homebrew/homebrew-core#87470.
This actually also addresses a build failure we've seen in CI (see
Homebrew/homebrew-core#87641).
- remove usage on macOS as we don't care about it there
- don't error out on incompatibility but still store stdlib on Linux
- remove (now) unused methods
This probably has to wait until 2.7.0 now and will require a bunch of
formula changes/deprecations but we should probably start moving in this
direction given we're not installing any of these on our CI any more.