build: ignore dependencies that are not installed #15453

wants to merge 1 commit into


None yet

4 participants

astiob commented Oct 14, 2012

Optional dependencies mean that it is possible to install the package without having the dependency installed. Normally Homebrew installs all dependencies automatically, but --ignore-dependencies is an option that disables this behaviour. But even with --ignore-dependencies, build.rb is desperate to have a working /opt prefix for every formula in the dependency tree and raises an exception if it cannot achieve this:

Error: /usr/local/opt/$dependency not present or broken
Please reinstall $dependency. Sorry :(

The attached patch simply prevents build.rb from trying to do anything whatsoever with dependencies that are not actually installed: thus we have no spurious errors, no superfluous components in paths and no unwarranted switching to stdenv.

@astiob astiob build: ignore dependencies that are not installed
Among other things, this fixes "prefix/opt/formula not present
or broken. Please reinstall formula. Sorry :(" errors when some
optional dependencies are missing and `brew install` is run
with the `--ignore-dependencies` option.
adamv commented Oct 14, 2012

See also: #14456

astiob commented Oct 14, 2012

That looks awesome!

I believe it does solve this issue too, but how soon will it be merged? If that’s still a way off, this could be pulled in the meantime.

adamv commented Oct 15, 2012

Ping @jacknagel


I haven't had much uninterrupted time to work on it lately but I still hope to finish and merge it "soonish". I'll take a closer look at this tomorrow, though.

adamv commented Oct 23, 2012

Fixed in 3831d10 - or at least hacked to work again.

@adamv adamv closed this Oct 23, 2012
astiob commented Oct 24, 2012

That does fix the error, but it also means that dependencies that are installed but haven’t yet got an opt-prefix will be missed. My solution isn’t much more complicated (even if I change several lines, effectively all changes are the same), so I don’t see why you don’t want to pull it instead. In fact, if the number of changes is the reason, you can cut it down to a single-line hack by only retaining the change in line 72.

@adamv adamv reopened this Oct 24, 2012
adamv commented Oct 24, 2012

Reopening for review.


@astiob @adamv @jacknagel With the new dependency code I think this is now redundant. If I'm wrong reopen. Sorry for not merging and thanks!

@MikeMcQuaid MikeMcQuaid closed this Feb 1, 2013
@astiob astiob deleted the astiob:deps branch Apr 28, 2014
@xu-cheng xu-cheng locked and limited conversation to collaborators Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.