aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/dependencies.rb
AgeCommit message (Collapse)Author
2014-08-14Use the Enumerable implementation of include?Jack Nagel
2014-07-03Replace ComparableSet with a Requirements collectionJack Nagel
2014-07-01Use to_a definition from EnumerableJack Nagel
2014-02-13Implement equality for Dependencies collectionsJack Nagel
2013-05-10Add type accessors to DependenciesJack Nagel
2013-01-26Split dependency classes into separate filesJack Nagel
2013-01-26Fix Dependencies -> Array conversionJack Nagel
2013-01-26Tag Xcode and CLT requirements as build-timeJack Nagel
This way they can be skipped when installing bottles.
2013-01-26Add "depends_on :clt"samueljohn
2013-01-26FormulaInstaller: construct new ARGV from an Options collectionJack Nagel
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.
2013-01-26FormulaInstaller: allow formulae to pass options to depsJack Nagel
Formulae can now pass build options to dependencies. The following syntax is supported: depends_on 'foo' => 'with-bar' depends_on 'foo' => ['with-bar', 'with-baz'] If a dependency is already installed but lacks the required build options, an exception is raised. Eventually we may be able to just stash the existing keg and reinstall it with the combined set of used_options and passed options, but enabling that is left for another day.
2013-01-26Dependency.expand_dependenciesJack Nagel
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.
2013-01-26Dependency#to_formula and associated helpersJack Nagel
2013-01-26Allow depending on requirement class or instance.Mike McQuaid
2013-01-22Infer path to be added for requirements that search PATHJack Nagel
When a requirement is specified like: satisfy { which "foo" } There is no reason that we should inject all of ENV.userpaths! into the build environment. Instead, infer the directory to be added to PATH from the Pathname that is returned. This is another step towards condensing the "which program" requirements down into a one-liner DSL element.
2013-01-22requirements: enable userpaths by default during evaluationJack Nagel
2013-01-21Allow satisfied? to be specified in a blockJack Nagel
Instead of overriding #satisfied?, Requirement subclasses can specify the condition in a block: satisfy do some_condition? end The contents of the block are evaluated in the context of the instance, and so have access to instance variables and instance methods as before. Additionally, it is wrapped in an ENV.with_build_environment block. This can be disabled by passing :build_env => false to satisfy: satisfy :build_env => false do some_condition? end
2013-01-21Object#instance_exec for Ruby 1.8.6Jack Nagel
Not thread safe! But I don't think we care. We want to evaluate the env DSL block in the context of ENV for asthetic reasons, but we also want access to methods on the requirement instance. We can use #instance_exec to pass the requirement itself into the block: class Foo < Requirement env do |req| append 'PATH', req.some_path end def some_path which 'something' end end Also add a simplified version of Object#instance_exec for Ruby 1.8.6.
2013-01-21Allow env DSL to take a blockJack Nagel
In addition to env :userpaths env :std requirements can now do env do append 'PATH', '/some/path/to/bin' # and more end
2013-01-13Remove <=> from Dependency interfaceJack Nagel
It is important that dep equality corresponds to the name attribute, but we may want to use the Comparable interface to sort them by installation order in the future. Code that needs to sort them alphabetically should just use sort_by.
2013-01-13Add tex requirementXiyue Deng
* Detect `latex' and `bibtex' commands. * Recommend installing MacTeX when no LaTeX installation is found. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2013-01-07Allow conversion of Dependencies to ArrayJack Nagel
This is needed for the intersection code in `brew deps` to work right, but can hopefully be refactored away somehow eventually.
2013-01-07Remove Array subclassingJack Nagel
Inheriting from Array (and other core types) is problematic: - It exposes a very wide interface with many methods that are not really relevant to the subclass. - It can cause some weird side effects, as many Array operations are in C and have hardcoded return values; for example, combining two array subclasses returns a new Array instead of the subclass. Avoid these problems using delegation and the Enumerable module where applicable.
2013-01-04Add support for external ocaml deps via opamAlex Reece
Closes #16280. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2012-12-26Allow requirements to specify env optionsJack Nagel
2012-12-26Add a small DSL for setting requirement optionsJack Nagel
2012-11-08Factor out MySQL and Postgres requirementsJack Nagel
2012-10-25Allow requirements to record tagsJack Nagel
To allow depends_on :x11 => :optional and friends to work as expected, make requirements record any tags and add special handling to the X11Dependency to record both a minimum version and additional tags. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-10-25Move requirement subclasses to a separate fileJack Nagel
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-10-15Manage Requirements using ComparableSetMisty De Meo
ComparableSet only allows a single object of a given class, choosing the object with the greatest value. This was mainly created for Requirements, so that, e.g., two X11Dependencies of differing strictness don't both end up in the same requirement set. Fixes #15240.
2012-10-02Replace mentions of easy_install by pipsamueljohn
Use this chance to correct minor typos. Closes #15242. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2012-09-10Clarify that brew does not provide XQuartzCharlie Sharpsteen
Reword the `X11Dependency` error message so that it is clear that an installer must be downloaded. Ref #14851.
2012-08-24XCodeDependency: Clarify that Xcode.app is neededCharlie Sharpsteen
Clarify the error message arising from XCodeDependency so that users know XCode.app is needed and that just installing the CLT does not count as "installing XCode".
2012-08-22Don't use XQuartz for e.g. :libpng on 10.8.Mike McQuaid
XQuartz isn't added to the default library paths so if something is linked against a Homebrew libpng then it doesn't work against the XQuartz libpng. The CLT provides X11 on Lion so don't request users install XQuartz if it isn't needed on Mountain Lion. Fixes #14325.
2012-08-18Deprecate MacOS.version? style methodsJack Nagel
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-17Add special :xcode dependencyAdam Vandenberg
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-14Recursively expand requirements in FormulaInstallerJack Nagel
Currently FormulaInstaller "forgets" about the requirements of dependencies, as dependencies are recursively expanded by the first FormulaInstaller instance, and then ignored by subsequent instances to prevent duplicate installation attempts. These requirements then have their messages displayed, but the fatal check is skipped and thus no exception is raised. Now that we have Formula#recursive_requirements, we can mirror what we are doing with dependencies and recursively expand requirements up front. While at it, fix a bug in determining Requirement equality that resulted in unique requirements being eliminated from a formula's set of recursive requirements. Fixes #12290. Fixes #14084. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-12Make Set available globallyJack Nagel
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-09Document dependencies.rbAdam Vandenberg
2012-08-08Add modular x11 dependencies.Mike McQuaid
Fixes #13638.
2012-08-07Allow multiple unsatisfied fatal requirementsAdam Vandenberg
Closes #13335.
2012-08-01Move X11 machinery into MacOS::XQuartz namespaceJack Nagel
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".
2012-07-30Add conflicts_with DSL methodMisty De Meo
conflicts_with is a thin wrapper around Requirement which simplifies marking conflicts between formulae. Closes #13687. Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2012-07-28dependencies.rb: Add MPI compiler RequirementCharlie Sharpsteen
All versions of OS X prior to Lion shipped with some version of Open-MPI, but without working compiler wrappers for Fortran. Homebrew currently has two formulae that can supply this software: open-mpi and mpich2. This commit adds a `MPIDependency` Requirement that can be passed one of four values when constructed: :cc, :cxx, :f90, :f77 This will ensure the `mpi<value>` compiler is available and working. For example, if `depends_on MPIDependency.new(:cc, :f90)` is used, the Requirement will search for working `mpicc` and `mpif90` wrappers. If the required wrappers cannot be found, an error message will be displayed that prompts the user to install one of the Homebrew formulae that provides MPI. For each language passed to a MPIDependency Requirement, environment variables be will set that point to the compilers. Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
2012-07-27Deduplicate requirementsJack Nagel
Because of some quirks in how formulae are loaded, DSL methods invoked in the class definition are called multiple times. This results in, for example, duplicate dependencies and requirements. Code that iterates over requirements and takes some action for each can thus repeat things that shouldn't be repeated, like appending to environment variables. Make DependencyCollector's external_deps a Set, and define eql? and hash on Requirement to prevent these duplicates. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-07-27Requirement: add modify_build_environment methodJack Nagel
Rather than doing type introspection in build.rb, just define a method to perform the necessary environment setup for Requirements. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-07-25Use new Xcode moduleJack Nagel
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-07-10Add :bsdmake dependencyAdam Vandenberg
2012-07-10All symbols for autotools dependenciesAdam Vandenberg
The symbol versions of :autoconf, :automake and :libtool only activate for OS X / Xcode combinations that do not provide autotools.
2012-07-10Refactor dependencies in preparation for autotools symbol supportAdam Vandenberg