In FormulaInstaller#install, needed_deps is created without first
filtering ARGV for flags like --HEAD. In practice, this means that
sometimes needed_deps will contain dependencies that are actually
already installed; --HEAD causes Formula#installed_prefix to differ and
thus checking Formula#installed? will result in false negatives.
This can trigger weird bugs; for example, Homebrew/homebrew#10380, where the "Installing
foo" header is displayed even though no dependencies were previously
installed.
Fix this by filtering ARGV before testing for installed dependencies,
and do the same for requirements to maintain symmetry, and because some
requiremnts check Formula#installed? as well.
FixesHomebrew/homebrew#10380.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Currently FormulaInstaller "forgets" about the requirements of
dependencies, as dependencies are recursively expanded by the first
FormulaInstaller instance, and then ignored by subsequent instances to
prevent duplicate installation attempts. These requirements then have
their messages displayed, but the fatal check is skipped and thus no
exception is raised.
Now that we have Formula#recursive_requirements, we can mirror what we
are doing with dependencies and recursively expand requirements up
front.
While at it, fix a bug in determining Requirement equality that resulted
in unique requirements being eliminated from a formula's set of
recursive requirements.
FixesHomebrew/homebrew#12290.
FixesHomebrew/homebrew#14084.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Apple's X11 is XQuartz, but this can be confusing, and is ultimately
unnecessary for debugging purposes.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
-D is now the switch for diagnostic-dumps. Let it be so.
Shows how long each doctor method takes in a sorted table at end. I used this to move the two slowest methods to the end of the doctor run so that as much useful information can be shown as quickly as possible.
Also now possible to specify on command line which tests should be run.
This was slowing down every instantiation of brew significantly.
Hopefully doesn't break anything that had become accustomed to not having to require 'formula' or 'keg'.
/cc @mikemcquaid
As options are stored in an object owned by the eigenclass of a formula,
options defined in the Formula#options method can be added multiple
times if the formula is instantiated multiple times.
Store them in a set to prevent duplicates.
FixesHomebrew/homebrew#14133.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
When combining the set of old-style and new-style options, make sure
that the leading "--" is stripped.
Fixes displaying options in `brew options`, and the exotic case of
declaring options using the old syntax and then checking them with
`build.include?`
If you google for "Cowardly refusing to sudo brew" you get a lot of confused users who didn't read any of the Homebrew documentation and then had a hissy-fit.
A user on IRC was getting strange results from MacOS.dev_tools_path.
It turns out that xcrun's exit status is not always reliable - if
xcrun is a shim and not able to locate the real xcrun, it will exit
0 despite not actually doing what it was asked. Instead check to see
if the stout is empty.