diff options
| author | Mike McQuaid | 2013-05-10 13:35:38 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2013-05-10 13:37:41 +0100 |
| commit | 2d9329f14eaac22dd0e2411e31295dd9acf6d1c5 (patch) | |
| tree | 2fc7c19abb862f1e93022ae6c2a30d2164b14222 /Library | |
| parent | 849942f9fd8028de0ed99c3c740fb33e28cf84ea (diff) | |
| download | homebrew-2d9329f14eaac22dd0e2411e31295dd9acf6d1c5.tar.bz2 | |
Allow requirements to specify a default formula.
This allows default resolution of requirements without user intervention.
Closes #19627.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/elixir.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/mu.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/mysql-connector-odbc.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/shocco.rb | 1 | ||||
| -rw-r--r-- | Library/Formula/signing-party.rb | 1 | ||||
| -rw-r--r-- | Library/Homebrew/requirement.rb | 12 | ||||
| -rw-r--r-- | Library/Homebrew/requirements.rb | 3 | ||||
| -rw-r--r-- | Library/Homebrew/requirements/mpi_dependency.rb | 2 |
8 files changed, 22 insertions, 0 deletions
diff --git a/Library/Formula/elixir.rb b/Library/Formula/elixir.rb index 74b133d91..c129bac14 100644 --- a/Library/Formula/elixir.rb +++ b/Library/Formula/elixir.rb @@ -2,6 +2,7 @@ require 'formula' class ErlangInstalled < Requirement fatal true + default_formula 'erlang' satisfy { which 'erl' } diff --git a/Library/Formula/mu.rb b/Library/Formula/mu.rb index 9b50c5ea3..2d9d18f9a 100644 --- a/Library/Formula/mu.rb +++ b/Library/Formula/mu.rb @@ -3,6 +3,7 @@ require 'formula' class Emacs23Installed < Requirement fatal true env :userpaths + default_formula 'emacs' satisfy do `emacs --version 2>/dev/null` =~ /^GNU Emacs (\d{2})/ diff --git a/Library/Formula/mysql-connector-odbc.rb b/Library/Formula/mysql-connector-odbc.rb index 06a7ed6d9..6bbbe3a7c 100644 --- a/Library/Formula/mysql-connector-odbc.rb +++ b/Library/Formula/mysql-connector-odbc.rb @@ -2,6 +2,7 @@ require 'formula' class MySqlInstalled < Requirement fatal true + default_formula 'mysql' satisfy { which 'mysql_config' } diff --git a/Library/Formula/shocco.rb b/Library/Formula/shocco.rb index bd6959517..c30df7b24 100644 --- a/Library/Formula/shocco.rb +++ b/Library/Formula/shocco.rb @@ -10,6 +10,7 @@ end class MarkdownProvider < Requirement fatal true + default_formula 'markdown' satisfy { which 'markdown' } diff --git a/Library/Formula/signing-party.rb b/Library/Formula/signing-party.rb index dfa02fae5..ecbb8c6b7 100644 --- a/Library/Formula/signing-party.rb +++ b/Library/Formula/signing-party.rb @@ -2,6 +2,7 @@ require 'formula' class GnupgInstalled < Requirement fatal true + default_formula 'gnupg2' satisfy { which('gpg') || which('gpg2') } diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb index c20273895..4cae1f246 100644 --- a/Library/Homebrew/requirement.rb +++ b/Library/Homebrew/requirement.rb @@ -75,6 +75,11 @@ class Requirement end class << self + # The default formula to install to satisfy this requirement. + def default_formula(val=nil) + val.nil? ? @default_formula : @default_formula = val.to_s + end + def fatal(val=nil) val.nil? ? @fatal : @fatal = val end @@ -138,6 +143,13 @@ class Requirement next if prune + # TODO: Do this in a cleaner way, perhaps with another type of + # dependency type. + if req.class.default_formula + dependent.class.depends_on(req.class.default_formula) + next + end + reqs << req end end diff --git a/Library/Homebrew/requirements.rb b/Library/Homebrew/requirements.rb index 29e61b696..bdbe71ee0 100644 --- a/Library/Homebrew/requirements.rb +++ b/Library/Homebrew/requirements.rb @@ -19,6 +19,7 @@ end class MysqlDependency < Requirement fatal true + default_formula 'mysql' satisfy { which 'mysql_config' } @@ -40,6 +41,7 @@ end class PostgresqlDependency < Requirement fatal true + default_formula 'postgres' satisfy { which 'pg_config' } @@ -110,6 +112,7 @@ end class MercurialDependency < Requirement fatal true + default_formula 'mercurial' satisfy { which('hg') } diff --git a/Library/Homebrew/requirements/mpi_dependency.rb b/Library/Homebrew/requirements/mpi_dependency.rb index b51efc303..e83f7d80c 100644 --- a/Library/Homebrew/requirements/mpi_dependency.rb +++ b/Library/Homebrew/requirements/mpi_dependency.rb @@ -9,6 +9,8 @@ class MPIDependency < Requirement fatal true + default_formula 'open-mpi' + env :userpaths def initialize *lang_list |
