Closed tzudot closed 8 years ago
When you manually specify an option
it overrides the generic text we insert, which is why you're seeing a blank line there.
depends_on "xyz" => :optional
generates the automated wording:
--with-mp3gain
Build with mp3gain support
--with-musepack
Build with musepack support
--with-opus
Build with opus support
But by creating an option you can override that:
option "with-mp3gain", "Dogs are cooler than cats"
Equals
--with-mp3gain
Dogs are cooler than cats
Unless you want custom wording you don't need to add an option
as well as the depends_on "xyz" => :optional
line.
@DomT4 said everything :smile:
@DomT4 thank you for explaining that in detail. I guess, I didn't make myself clear earlier.
Let me explain again,
Case 1: Homebrew generates a description for option.
$ brew edit msmtp
...
depends_on "gsasl" => :optional
option "with-gsasl"
...
$ brew info msmtp
==> Options
--with-gsasl
Build with gsasl support
But brew audit --strict formula
generates an error:
==> audit problems
msmtp:
* `option` (line 16) should be put before `depends_on` (line 13)
Case 2: Homebrew does not generate a description for option.
$ brew edit msmtp
...
option "with-gsasl"
depends_on "gsasl" => :optional
...
$ brew info msmtp
==> Options
--with-gsasl
I just now checked this locally on my laptop by deliberately putting an option
, without custom description, before depends_on
.
@tzudot The audit
error is because there’s an option after depends_on
. If there are options in a formula, they must be put before any depends_on
.
Yeah, as @bfontaine says. Essentially, if it helps, depends_on "xyz" => :optional
automatically generates the option
wording, so unless you want new option wording you don't need to generate your own option
at all.
The point I am trying to make is, depends_on "xyz" => :optional
does not automatically generate the option
wording, if present after option
.
Anyway, this is not mission critical. I'll try to debug this over the weekend.
Yes, that's because the option
overrides the automated wording. The second you add an option line which is the same as the optional dependency, we throw the automated wording out of the window. What you're seeing is entirely deliberate behaviour.
Earlier today, when I was adding an
option
to a formula, I had noticed that description for anoption
is generated by Homebrew, only if defined afterdepends_on
. But according tobrew audit --strict <formula>
, anoption
should precededepends_on
.If I place an
option
beforedepends_on
, a blank description is shown. e.g.$ brew info formula
$ brew config
@bfontaine any thoughts ?