When a dependency of a formula specified on the command-line is also
specified, *after* the dependent formula, installation proceeds as part
of the dependent's dependency tree and then is attempted again because
the user asked for it explicitly. This results in the installer raising
a CannotInstallFormulaError because it has already been installed.
For example:
$ brew install graphviz pkg-config
==> Installing graphviz dependency: pkg-config
...
==> Installing graphviz
...
Error: pkg-config-0.27.1 already installed
We already have a mechanism for dealing with this, but it does not kick
in early enough. Move the installation attempt check into
FormulaInstaller#check_install_sanity and catch the exception in the
appropriate places.
FixesHomebrew/homebrew#16957.
`python --version` doesn't work in some (very) old versions of
python. While I doubt this is going to come up very often, it's
theoretically possible someone has an old python first in their
path. (python -V works on all versions I'm aware of, including
python3, and comes before --version in the --help anyway.)
Also skips the warning in case the regexp matches nothing, which
probably shouldn't happen. But if it does we shouldn't produce the
wrong warning.
Two issues were preventing `brew upgrade` from functioning properly:
- `Tab.for_formula` was used to recover options from prior installs. The
problem is that during an upgrade `for_formula` will be directed to a
non-existant install of the newer version and thus returns a forged tab
claiming no options were invoked.
- The assignment to `installer.install_bottle` requires parenthesis in order
to function properly.
This code makes assumptions about the existence of prefix which are
valid in the context of the installer, but not necessarily in the
context of `brew info`, thus `brew info` on an outdated formula errors
out.
This reverts commit e5b53dd64b769b67805d1054d906f7083939d905.
We support three configurations: Xcode-only, CLT-only, and Xcode with
CLT. Our configuration output should correctly reflect this.
While MacOS::Xcode.version has to continue to return a guess if Xcode is
not installed in order to maintain backwards compatibility, this is an
implementation detail that we don't need to expose to the user. And it
makes `brew --config` output confusing.
So let's only print the "Xcode" line when an actual Xcode installation
is present. This makes it easy to quickly figure out which of the three
possible configurations the user is running.
Addresses Homebrew/homebrew#14941, more or less.
* Use version compare to only remove kegs with lower version than the
current one, not higher version which might be from someone's
branch.
* Do the same for cache cleanup.
- Be conservative so that if a name detected from cache file is not
the same as its formula then don't clean it.
ClosesHomebrew/homebrew#15914.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Enumerable#one? is not available under Ruby 1.8.6. Further, we really
want #any? here, as setting both HOME and CURL_HOME can trigger a false
negative.
FixesHomebrew/homebrew#15883.
Added doctor check for .curlrc rather than silently ignoring it (#13836).
ClosesHomebrew/homebrew#15419.
Signed-off-by: Max Howell <mxcl@me.com>
Removed test in doctor where it actually curl'd a file. It's enough to warn if the curlrc exists. I understand people want to remove the warnings, but the point in the doctor is to help diagnose and not to be some ramification of your UNIX system.
* Renames --force to --overwrite, freeing up brew ln --force for Homebrew/homebrew#13349
* Changes --dry-run to preview linking by default, rather than
overwriting. An overwrite dry-run can be simulated via both
--dry-run --overwrite
* Adds some basic Keg tests