Repository navigation
Make source build dependency upgrades more liberal - #24273
Conversation
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Thanks! Prepared to merge something like this. Main concern here as-is is that we probably want to avoid this behaviour change when building bottles from source? Fine when explicitly or due to missing bottles having to build from source.
Can you explain more what you would want, do you mean enable the new behavior with a flag? |
84a673d to
c4b959b
Compare
I think Mike means when the build uses |
Yes, thanks Carlo. New behaviour fine:
New behaviour to be avoided:
|
|
Yes, but isn't that what this PR already does? |
c4b959b to
9432c02
Compare
- Since Homebrew#15927, installing from a bottle doesn't upgrade outdated dependencies the bottle is known to work with. Building from source still upgrades every outdated build dependency, so e.g. `ccache` on Intel macOS rebuilds `rust` and `llvm` just to build `ruby` for `asciidoctor`. - When building from source, keep an outdated build dependency whose installed `compatibility_version` matches the current formula, along with the dependencies it was built against. `brew upgrade` still upgrades it. - Upgrade it anyway when building a bottle or if this install would incompatibly upgrade one of the dependencies it was built against. - Load `compatibility_version` from the API: `FormulaStruct` dropped it, so formulae loaded from the API always returned `nil`. - Let `Dependency#installed?` check `minimum_compatibility_version` without also needing a `minimum_version`.
9432c02 to
bfd4847
Compare
Does it also keep the existing/old behaviour for |
The check uses |
|
Awesome! |
- Check that `--build-bottle`, with or without `--build-from-source`, still upgrades outdated build dependencies under both keep rules: a matching `compatibility_version` (Homebrew#24273) and `:no_linkage`. - Also check that a build dependency's own dependencies are upgraded when building a bottle, and that `:no_linkage` alone doesn't keep an outdated runtime dependency.
- Check that `--build-bottle`, with or without `--build-from-source`, still upgrades outdated build dependencies under both keep rules: a matching `compatibility_version` (Homebrew#24273) and `:no_linkage`. - Also check that a build dependency's own dependencies are upgraded when building a bottle, and that `:no_linkage` alone doesn't keep an outdated runtime dependency.
I know building from source isn't a supported configuration (see #24261), so rather than adding a dedicated source-build feature, this extends the rule #15927 introduced for bottles: an outdated dependency that's known to be compatible isn't upgraded. Bottles use the versions recorded in the bottle's tab. Source builds now use
compatibility_version, which formulae already declare to reduce the number of dependency upgrades users need.It's still a big quality-of-life improvement on machines without bottles. On my Intel macOS 12 machine,
brew install ccachespent three hours buildingllvmbefore I cancelled it. That was only becauseasciidoctorneedsruby, which needsrustto build, which needsllvm, and all three were outdated.Before:
After:
llvm,rustandautomakeare no longer upgraded because their installedcompatibility_versionmatches.gccis still upgraded because my 2018gcckeg predatescompatibility_version. The "after" run usedHOMEBREW_NO_INSTALL_FROM_API=1(hence the slightly older versions from my tap) because the API doesn't includecompatibility_versionuntil it's regenerated with the fix below.Changes:
compatibility_versionmatches the current formula, along with the dependencies it was built against (otherwise e.g. upgradingllvmwould break the keptrust).brew upgradestill upgrades it.--build-bottle, whichbrew test-botalso passes when installing dependencies) or if this install would incompatibly upgrade one of the dependencies it was built against.compatibility_versionfrom the API.FormulaStructdidn't declare it, so formulae loaded from the API always returnednil:brew ruby -e 'p Formula["rust"].compatibility_version'printsnil, but1withHOMEBREW_NO_INSTALL_FROM_API=1.Dependency#installed?checkminimum_compatibility_versionwithout also needing aminimum_version. Nothing passed it before.brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Claude Code (Claude Opus 5.5) helped trace the dependency resolution code and write the change and specs. I verified it with
brew style,brew typecheck, thedependencyspecs and the affectedformula_installerandformularyexamples locally, and by checking the dependency plan forbrew install ccacheon my machine (above).Summary by CodeRabbit