brew icon indicating copy to clipboard operation
brew copied to clipboard

Add support for `HOMEBREW_MIN_VERSION` file in tap roots

Open MikeMcQuaid opened this issue 2 years ago • 1 comments

Provide a detailed description of the proposed feature

This HOMEBREW_MIN_VERSION would be something we'd automatically bump in homebrew/core on every release. It would contain just the version and a newline e.g. 3.4.10\n.

When loading a formula from this tap (or tapping it for the first time): we'd ensure that Homebrew/brew is a sufficiently new version and, if it is not, refuse to load the formula and output an error to the user.

It should be written in a plain-text format so it can be read or written by brew update and Homebrew's various Bash scripts when necessary (as opposed to e.g. JSON).

What is the motivation for the feature?

This would be useful in cases where Homebrew/brew isn’t updated and Homebrew/homebrew-core breaks due to API-incompatible changes or when people want to use specific versions of both Homebrew/brew and Homebrew/homebrew-core that are in sync with each other.

Similarly, third-party taps can use it to enforce the minimum version. We could potentially also use it to infer a "maximum version" for those taps if they e.g. haven't bumped it and addressed deprecations.

How will the feature be relevant to at least 90% of Homebrew users?

It won't be. It would only be useful to those who end up with mismatched Homebrew/brew and Homebrew/homebrew-core intentionally or accidentally.

What alternatives to the feature have been considered?

  • the status quo
  • a JSON/YAML file with extendable metadata (YAGNI)
  • a HOMEBREW_VERSION file instead (I could be convinced this is a better idea)
  • a HOMEBREW_MAX_VERSION file as well (YAGNI, for now)

MikeMcQuaid avatar Apr 26 '22 10:04 MikeMcQuaid

I like the explicit purpose afforded by the name of the file. This inhibits scope creep if it was HOMEBREW_VERSION, which affords that it could eventually allow for a range spec instead of an explicit version.

I agree that skipping directly to something extensible like JSON or YAML isn't necessary for the planned scope. That could be a good v2 if we find that adding HOMEBREW_MIN_VERSION catches on and folks are updating them. How we determine that adoption could also be in scope for this.

colindean avatar Apr 26 '22 16:04 colindean

Passing on this.

MikeMcQuaid avatar Feb 16 '23 14:02 MikeMcQuaid