Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
13.76k stars 12.45k forks source link

Improve `:all` bottle coverage #191352

Open carlocab opened 1 month ago

carlocab commented 1 month ago

We currently have a few hundred :all bottles in this repository. I count another 200 or so more (see candidate formulae below) that could have an :all bottle but don't currently have one.

These are typically due to /usr/local references inside that bottles that are relocated on x86_64 macOS but not on arm64 macOS or Linux. To fix these, we typically only need a few inreplace lines. See below for example PRs.

Example PRs - https://github.com/Homebrew/homebrew-core/pull/191327 - https://github.com/Homebrew/homebrew-core/pull/191316 - https://github.com/Homebrew/homebrew-core/pull/191252 - https://github.com/Homebrew/homebrew-core/pull/191251 - https://github.com/Homebrew/homebrew-core/pull/191250 - https://github.com/Homebrew/homebrew-core/pull/191249
Candidate Formulae - [ ] abi3audit - [ ] alluxio - [ ] angular-cli - [ ] apify-cli - [ ] appium - [ ] appwrite - [ ] arttime - [ ] asciidoc - [ ] asyncapi - [ ] autoconf - [ ] automake - [ ] autopsy - [ ] autorest - [ ] aws-amplify - [ ] aws-auth - [ ] awscli-local - [ ] b2-tools - [ ] bandcamp-dl - [ ] basedpyright - [ ] basti - [ ] bork - [ ] bower - [ ] braid - [ ] bundletool - [ ] cdk8s - [ ] censys - [ ] certbot - [ ] certifi - [ ] chruby - [ ] cimg - [ ] cloudflare-wrangler2 - [ ] cmake-docs - [ ] cocoapods - [ ] commitlint - [ ] composer - [ ] contentful-cli - [ ] cpanminus - [ ] cpm - [ ] cppman - [ ] credstash - [ ] cubejs-cli - [ ] dbml-cli - [ ] ddclient - [ ] devcontainer - [ ] dicebear - [ ] diceware - [ ] diffoscope - [ ] dita-ot - [ ] doc8 - [ ] dockerfile-language-server - [ ] druid - [ ] duply - [ ] easyengine - [ ] eleventy - [ ] eslint - [ ] extra-cmake-modules - [ ] fades - [ ] fail2ban - [ ] fanyi - [ ] fauna-shell - [ ] firebase-cli - [ ] flake8 - [ ] flamebearer - [ ] flawfinder - [ ] flit - [ ] fnt - [ ] fonts-encodings - [ ] foreman - [ ] fred - [ ] geoip2fast - [ ] getmail6 - [ ] git-big-picture - [ ] git-cola - [ ] git-number - [ ] git-remote-codecommit - [ ] git-review - [ ] git-subrepo - [ ] gitlab-ci-local - [ ] gitmoji - [ ] gitter-cli - [ ] go - [ ] goenv - [ ] goolabs - [ ] gorilla-cli - [ ] gost - [ ] gprof2dot - [ ] grails - [ ] graphql-cli - [ ] graphqurl - [ ] grokmirror - [ ] groovysdk - [ ] grunt-cli - [ ] gsettings-desktop-schemas - [ ] gtop - [ ] gulp-cli - [ ] hadoop - [ ] haste-client - [ ] hexo - [ ] http-server - [ ] httpyac - [ ] hyfetch - [ ] insect - [ ] instalooter - [ ] intltool - [ ] inxi - [ ] ios-sim - [ ] ipython - [ ] itstool - [ ] jruby - [ ] js-beautify - [ ] jscpd - [ ] json2ts - [ ] jtbl - [ ] kafka - [ ] keyring - [ ] kubevious - [ ] lando-cli - [ ] latexdiff - [ ] lerna - [ ] liquibase - [ ] luarocks - [ ] lynis - [ ] libclc - [ ] libunwind-headers - [ ] mailsy - [ ] markdownlint-cli - [ ] marp-cli - [ ] maven - [ ] maxwell - [ ] mjml - [ ] mysqltuner - [ ] n - [ ] nativefier - [ ] naturaldocs - [ ] nave - [ ] nb - [ ] nbdime - [ ] neonctl - [ ] netsurf-buildsystem - [ ] newman - [ ] nicotine-plus - [ ] nikto - [ ] nox - [ ] npm-check-updates - [ ] osc-cli - [ ] osc - [ ] pandemics - [ ] pass-git-helper - [ ] pass - [ ] patch-package - [ ] pedump - [ ] phoronix-test-suite - [ ] phpbrew - [ ] phpstan - [ ] pip-tools - [ ] pipdeptree - [ ] pipenv - [ ] pipgrip - [ ] pipx - [ ] platformio - [ ] pnpm - [ ] pnpm@8 - [ ] postgraphile - [ ] powerlevel10k - [ ] principalmapper - [ ] psalm - [ ] psysh - [ ] ptpython - [ ] px - [ ] pycparser - [ ] pyenv-virtualenv - [ ] pylint - [ ] pyqt-builder - [ ] pyright - [ ] python-argcomplete - [ ] pythran - [ ] quicktype - [ ] rbtools - [x] redo - #191545 - [ ] release-it - [ ] rich-cli - [ ] rollup - [ ] saf-cli - [ ] scons - [ ] seam - [ ] search-that-hash - [ ] serveit - [ ] serverless - [ ] shallow-backup - [ ] shodan - [ ] sip - [ ] slimerjs - [ ] snyk-cli - [ ] solhint - [ ] sonarqube-lts - [ ] sonarqube - [ ] spack - [ ] spectral-cli - [ ] speedtest-cli - [ ] spotbugs - [ ] sql-lint - [ ] sqlite-utils - [ ] sqlmap - [ ] sslmate - [ ] standard - [ ] stepci - [ ] stylelint - [ ] subliminal - [ ] sugarjar - [ ] supervisor - [ ] tailwindcss-language-server - [ ] tartufo - [ ] teku - [ ] terrahub - [ ] tmuxinator-completion - [ ] tmuxinator - [ ] tox - [ ] twarc - [ ] ungit - [ ] unoconv - [ ] unum - [ ] urlscan - [ ] util-macros - [ ] vcs - [ ] vercel-cli - [ ] virtualenv - [ ] vite - [ ] vue-cli - [ ] waybackpy - [ ] web-ext - [ ] webpack - [ ] wikibase-cli - [ ] wildfly-as - [ ] wiremock-standalone - [ ] wp-cli - [ ] xmltoman - [ ] xorgproto - [ ] yaml-language-server - [ ] yapf - [ ] yo - [ ] yuicompressor - [ ] z - [ ] zim - [ ] zinit
How do I identify the files to `inreplace`? `diffoscope` is your best friend here (install it with `brew intall diffoscope`). If you're trying to fix formula `foo`, you'll want to first check `foo` for which bottles have different checksums, e.g., with `brew cat foo` (if you have `homebrew/core` tapped), or with ``` brew info --json=v2 foo | jq '.formulae[].bottle.stable.files' ``` Typically, the Intel macOS bottles will all have the same checksums, but these will be different from the arm64 macOS bottles and Linux bottles (which often all have the same checksums as well). Pull down the relevant bottles with: ``` brew fetch --bottle-tag arm64_sonoma foo brew fetch --bottle-tag sonoma foo ``` and then examine them using `diffoscope`: ``` diffoscope "$(brew --cache --bottle-tag arm64_sonoma foo)" "$(brew --cache --bottle-tag sonoma foo)" ``` `diffoscope` will tell you which files differ, and these are the ones you'll want to `inreplace`.
Why do we care about `:all` bottles? An `:all` bottle can be installed by any Homebrew user, regardless of their `HOMEBREW_PREFIX` or OS version, so having more `:all` bottles mean that more users can benefit from bottle usage. Moreover, `:all` bottles are a signal that our builds are (somewhat) reproducible, which is important when providing pre-built packages. See https://reproducible-builds.org for more on this.
Bo98 commented 1 month ago

Alternative take: inreplace feels like a massive hack and we should perhaps have a DSL that excludes certain files from prefix-scanning.

cho-m commented 1 month ago

Alternative take: inreplace feels like a massive hack and we should perhaps have a DSL that excludes certain files from prefix-scanning.

This seems like a per-formula/file decision

Bo98 commented 1 month ago

Yeah it will totally depend on the formula. There's definitely a fair number though that already read HOMEBREW_PREFIX and use /usr/local as a fallback or are checking specifically for non-Homebrew installs.

cho-m commented 1 month ago

Other situations I recall for missing :all bottles:


There are also formulae that are only :all per-OS/platform. These may have been :all before Linuxbrew merge. If there are enough of these, it may be worth exploring a :macos bottle.

carlocab commented 1 month ago

Alternative take: inreplace feels like a massive hack and we should perhaps have a DSL that excludes certain files from prefix-scanning.

I guess these are hacks to the extent that parts of our existing prefix-relocation scheme is a hack. I actually wouldn't mind relocating automatically a /usr/local reference to HOMEBREW_PREFIX if that's what we would already have done on Intel macOS.

There are also formulae that are only :all per-OS/platform. These may have been :all before Linuxbrew merge. If there are enough of these, it may be worth exploring a :macos bottle.

I've noticed this too. Some Go formulae might even work as :arm64_macos and :x86_64_macos -- e.g. the go formula itself. Would not be surprised if our existing Intel bottles for go work as far back as :catalina.

cho-m commented 1 month ago

I actually wouldn't mind relocating automatically a /usr/local reference to HOMEBREW_PREFIX if that's what we would already have done on Intel macOS.

Having brew automatically pick one and perhaps having an easy override for other may be best way to reduce the manual diff-ing and fix ups which add maintenance overhead. Maybe using a DSL similar to skip_clean for overriding.

GIgako19929 commented 1 month ago