Abort installs if reps are installed but not linked

Except for keg-only reps of course.

I suspect quite a few bug reports we receive are due to this sort of thing.

Ideally we'd not do this check for deps, since they have already been checked. I fear some weird consequences. But this check *should* be done before unlinking the previously installed brew in the case of upgrades. And the ignore_deps flag is set after the initialiser. There are ways round this but the code would be less nice.
This commit is contained in:
Max Howell 2012-03-15 12:32:03 +00:00
parent 33221835dc
commit 59436b194d

View File

@ -38,6 +38,12 @@ class FormulaInstaller
if ARGV.build_head? and f.unstable.nil?
raise CannotInstallFormulaError, "No head is defined for #{f.name}"
end
f.recursive_deps.each do |dep|
if dep.installed? and not dep.keg_only? and not dep.linked_keg.directory?
raise CannotInstallFormulaError, "You must `brew link #{dep}' before #{f} can be installed"
end
end unless ignore_deps
end
def install