I noticed that several formulae in
homebrew/core call the
version_suffix method defined in the
gcc formula, to derive the name of the installed GCC executable, e.g.:
cc = Formula["gcc"].version_suffix
This breaks when building HEAD, because
gcc defines it as follows:
def version_suffix if build.head? "HEAD" else version.to_s.slice(/\d+/) end end
build reference is resolved from the parent (the formula actually being built), building HEAD formulae would then use the nonexistent
gcc-HEAD, resulting in very strange build failures.
I’ll submit PRs to change
Formula["gcc"].version.to_s.slice(/\d+/) in the relevant core formulae, but this begs the question: Is it licit for one formula to directly call methods defined in another formula?
I’m pretty sure it’s not desirable, as it’s obviously fragile, and there’s currently no way to mark specific methods as part of a formula’s “interface”.