When given no arguments, this should return the stable version, but it
hasn't since we stopped setting this direction in the class's @version
variable.
Expand requirements recursively while applying the same optional? and
recommended? filters that dependencies are run through. Options
generated by requirements are now checked against the correct list of
requirements, eliminating the temporary "best guess" logic in the
installer.
Given
depends_on 'gnutls' => :recommended
depends_on 'libgcrypt' unless build.without? 'gnutls'
the dependency on libgcrypt should be enabled by default. However, the
corresponding option has not yet been generated, so the condition is
true and the dependency is disabled.
Instead, add a hook method that fires after each depends_on and adds the
appropriate option.
The array of options that is passed to the spawned build process is a
combination of the current ARGV, options passed in by a dependent
formula, and an existing install receipt. The objects that are
interacting here each expect the resulting collection to have certain
properties, and the expectations are not consistent.
Clear up this confusing mess by only dealing with Options collections.
This keeps our representation of options uniform across the codebase.
We can remove BuildOptions dependency on HomebrewArgvExtension, which
allows us to pass any Array-like collection to Tab.create. The only
other site inside of FormulaInstaller that uses the array is the #exec
call, and there it is splatted and thus we can substitute our Options
collection there as well.
Move Formula.expand_dependencies into the Dependency class, and extend
it to allow arbitrary filters to be applied when enumerating deps.
When supplied with a block, expand_dependencies will yield a [dependent,
dependency] pair for each dependency, allowing callers to filter out
dependencies that may not be applicable or useful in a given situation.
Deps can be skipped by simple calling Dependency.prune in the block,
e.g.:
Dependency.expand_dependencies do |f, dep|
Dependency.prune if dep.to_formula.installed?
end
The return value of the method is the filtered list.
If no block is supplied, a default filter that omits optional or
recommended deps based on what the dependent formula has requested is
applied.
Formula#recursive_dependencies is now implemented on top of this,
allowing FormulaInstaller to exact detailed control over what deps are
installed. `brew missing` and `brew upgrade` can learn to use this to
apply the installed options set when expanding dependencies.
Move Formula.expand_deps and Formula#recursive_deps into compat, because
these methods do not respect the new optional and recommended tags and
thus should no longer be used.
Optional deps are not installed by default but generate a corresponding
"with-foo" option for the formula. Recommended deps _are_ installed by
default, and generate a corresponding "without-foo" option.
FormulaInstaller now attempts to take a lock on a "foo.brewing" file for
the formula and all of its dependencies before attempting installation.
The lock is an advisory lock implemented using flock(), and as such it
only locks out other processes that attempt to take the lock. It also
means that it is never necessary to manually remove the lock file,
because the lock is not enforced by I/O.
The uninstall, link, and unlink commands all learn to respect this lock
as well, so that the installation cannot be corrupted by a concurrent
Homebrew process, and keg operations cannot occur simultaneously.
This behaves like recursive_deps, but the resulting list consists of
Dependency objects instead of Formula objects. The list maintains the
installable order property of recursive_deps.
While in the area, add some comments clarifying the purpose of related
methods.
Procs cannot be marshalled, but formula objects may be as part of the
BuildError exception. If the formula object has a reference to a Proc,
this will fail.
Work around it by not storing the test Procs during installations.
Tests can now be specified as a block in the DSL. A temporary test
directory is set up automatically when calling Formula#test. The
semantics of the test remain the same: the block can either raise an
exception or return false to signal failure.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
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.
Formula.factory naively assumed that any already-loaded constant
fed into it was a formula, with confusing results when trying to
`brew install` a name from the ruby stdlib.
FixesHomebrew/homebrew#16284.