Checking the license text is probably the most future proofed method. Though for future reference other possible methods are listed in the below ticket.
ClosesHomebrew/homebrew#14558.
This is safe, I tested various scenarios, including Homebrew installed in ~. The only files that are removed are unexpected files in Homebrew's already managed directories.
The heuristic for determining whether something is installed changes
from "f.installed?" to "f.rack.exist? and f.rack.subdirs.length > 0" in
order to properly consider outdated formulae.
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.
ClosesHomebrew/homebrew#13689.
Signed-off-by: Max Howell <mxcl@me.com>
There are subtle distinctions between writable? and writable_real? we don't
understand precisely why we need this, but it fixes the bugs :/
Currently, if brew doctor detects untracked changes in the local repo,
it suggests doing 'git reset --hard', but that doesn't remove untracked
files. This change adds an additional suggestion to run 'git clean -f'
to remove them.
ClosesHomebrew/homebrew#12814.
Signed-off-by: Max Howell <mxcl@me.com>
Changed the path to Library as we don't want to clean -f all over the whole /usr/local :P
Now that X11 components are specified as dependencies, users will be
prompted to install these components when necessary, and this check is
no longer needed.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Tell user exactly what command to use rather than thinking they'll figure it out by applying some negation logic to the main verb in the sentence they just read.
ClosesHomebrew/homebrew#12790.
In order to better support Xcode-only systems, where X11 libs and
executables live under /usr/X11 but headers live in the SDK, move the
x11_* helper methods into a new module.
This allows us to keep some of the CLT/Xcode-only and Apple X11/XQuartz
logic hidden from outside code, like ENV.x11.
Since Apple's X11 is actually XQuartz, name the module "MacOS::XQuartz".
Fixes the problems discussed in 34c970 to ensure that `brew doctor`
does not look like it is broken on user setup problems but still
returns a sensible exit code for e.g. BrewBot.
- pkg-config no longer defaults to checking /usr/X11/lib/pkgconfig;
instead this path is added via ENV.x11 or depends_on :x11. Formulae
that expect X11 libs should be explicitly marked as depends_on :x11.
- Remove warning about /usr/X11 as a symlink.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Shortened the part about the CLT-only systems, because this message is
never shown to them.
ClosesHomebrew/homebrew#13061.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Undoing parts of the hot fix 78b9e8548e771a59e382e6f13339664ec5498391.
The only thing missing was to check for `system "/usr/bin/xcrun -find make 1>/dev/null 2>&1"`
and then it's safe to call locate.
This commit restores the original functionality but without the risk for recursion
and improves the logic of `MacOS.locate`. See below.
To important changes in this commit:
- For Xcode _and_ CLT: don't add the SDK and leave things as before.
So if `MacOS.clt_installed?`, then no `SDKROOT` and `-L` and `-I`
directories are set in `ENV.macosxsdk`.
- Improved the logic for `MacOS.locate` for Xcode-only situations
by assuring that the xcode-select path is correct. This is done
by checking that `bin/make` exists and is executable. Otherwise it
was possible to set xcode-select to an empty dir.
This check is done in `MacOS.sdk_path` too.
We are now able to use Xcode wherever it is and can work even, if
xcode-select is set to invalid values. (Remember some users don't
have sudo access and that is needed to fix xcode-select).
Some minor whitespace fixes.
Minor backtick fix in doctor.rb's printout.
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Allow XCode without the Command Line Tools to
work with homebrew, so it's not necessary
to register an Apple Dev ID and/or go to the
XCode prefs and download the CLT. Yay!
Further, this commit allows to use the CLT
solely (without the need for XCode).
Saves quite some megs.
(Some furmulae require xcodebuild)
Of course XCode together with the CLT is still
fine and has been tested on 10.7 and 10.6
with Xcode 4 and Xcode 3.
Only on Lion or above, tell the user about the options,
which are
- Xcode without CLT
- CLT without Xcode
- both (ok, it's not directly stated, but implicit)
So if no Xcode is found and we are on Lion or above,
we don't fail but check for the CLTs now.
For older Macs, the old message that Xcode is needed
and the installer should be run is still displayed.
If the CLT are not found but Xcode is, then we
print out about the experimental status of this setup.
ClosesHomebrew/homebrew#10510.
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Mono installs its own pkg-config symlink into /usr/bin/pkg-config,
which breaks non-Mono builds. Provide a specific warning.
ClosesHomebrew/homebrew#12859.
`brew doctor` shelled to `brew missing` and parsed the results.
When VERBOSE was true, this caused an error as extra, unexpected
output is generated.
Make missing an internal command, and give it a programmatic interface.
We now skip the outdated check if our local origin/master tracking
branch matches the origin remote's current master. This prevents false
positives when we are actually up-to-date but the latest commit is over
24 hours old.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Under certain circumstances, an invalid path element would cause
File.expand_path to bail out. Catch mistakes and report them, then
continue instead.
FixesHomebrew/homebrew#12154
'which' only returns a Pathname or nil, and doesn't care about anything
sent to stderr, so just silence it by default and combine the two
methods.
ClosesHomebrew/homebrew#12115.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>