diff options
34 files changed, 95 insertions, 152 deletions
| diff --git a/Library/Formula/appledoc.rb b/Library/Formula/appledoc.rb index eecde22e0..e253e71fd 100644 --- a/Library/Formula/appledoc.rb +++ b/Library/Formula/appledoc.rb @@ -3,9 +3,8 @@ require 'formula'  class LionOrNewer < Requirement    fatal true -  def satisfied? -    MacOS.version >= :lion -  end +  satisfy MacOS.version >= :lion +    def message      "Appledoc requires Mac OS X 10.7 (Lion) or newer."    end diff --git a/Library/Formula/avian.rb b/Library/Formula/avian.rb index 7d37eacd1..ce59cf84d 100644 --- a/Library/Formula/avian.rb +++ b/Library/Formula/avian.rb @@ -3,6 +3,8 @@ require 'formula'  class JdkInstalled < Requirement    fatal true +  satisfy { which 'javac' } +    def message; <<-EOS.undent      A JDK is required. @@ -10,10 +12,6 @@ class JdkInstalled < Requirement      http://www.oracle.com/technetwork/java/javase/downloads/index.html      EOS    end - -  def satisfied? -    which 'javac' -  end  end  class Avian < Formula diff --git a/Library/Formula/boost.rb b/Library/Formula/boost.rb index ab62ec388..577d0be8a 100644 --- a/Library/Formula/boost.rb +++ b/Library/Formula/boost.rb @@ -9,6 +9,8 @@ def boost_layout  end  class UniversalPython < Requirement +  satisfy { archs_for_command("python").universal? } +    def message; <<-EOS.undent      A universal build was requested, but Python is not a universal build @@ -16,9 +18,6 @@ class UniversalPython < Requirement      is not a universal build then linking will likely fail.      EOS    end -  def satisfied? -    archs_for_command("python").universal? -  end  end  class Boost < Formula diff --git a/Library/Formula/boost149.rb b/Library/Formula/boost149.rb index cd181b1f8..0901211bc 100644 --- a/Library/Formula/boost149.rb +++ b/Library/Formula/boost149.rb @@ -1,6 +1,8 @@  require 'formula'  class UniversalPython < Requirement +  satisfy { archs_for_command("python").universal? } +    def message; <<-EOS.undent      A universal build was requested, but Python is not a universal build @@ -8,9 +10,6 @@ class UniversalPython < Requirement      is not a universal build then linking will likely fail.      EOS    end -  def satisfied? -    archs_for_command("python").universal? -  end  end  class Boost149 < Formula diff --git a/Library/Formula/cmake.rb b/Library/Formula/cmake.rb index db19d0b72..3688f8e23 100644 --- a/Library/Formula/cmake.rb +++ b/Library/Formula/cmake.rb @@ -1,6 +1,10 @@  require 'formula'  class NoExpatFramework < Requirement +  satisfy :build_env => false do +    not File.exist? "/Library/Frameworks/expat.framework" +  end +    def message; <<-EOS.undent      Detected /Library/Frameworks/expat.framework @@ -10,9 +14,6 @@ class NoExpatFramework < Requirement      You may need to move this file out of the way to compile CMake.      EOS    end -  def satisfied? -    not File.exist? "/Library/Frameworks/expat.framework" -  end  end diff --git a/Library/Formula/cmu-sphinxbase.rb b/Library/Formula/cmu-sphinxbase.rb index 2258fb646..161586403 100644 --- a/Library/Formula/cmu-sphinxbase.rb +++ b/Library/Formula/cmu-sphinxbase.rb @@ -3,6 +3,8 @@ require 'formula'  class HomebrewedPython < Requirement    fatal true +  satisfy(:build_env => false) { Formula.factory('python').installed? } +    def message; <<-EOS.undent      Compiling against the system-provided Python will likely fail.      The system-provided Python includes PPC support, which will cause a compiler @@ -11,9 +13,6 @@ class HomebrewedPython < Requirement      Patches to correct this issue are welcome.      EOS    end -  def satisfied? -    Formula.factory('python').installed? -  end  end  class CmuSphinxbase < Formula diff --git a/Library/Formula/coq.rb b/Library/Formula/coq.rb index 1a163844b..ce67e6c43 100644 --- a/Library/Formula/coq.rb +++ b/Library/Formula/coq.rb @@ -3,17 +3,17 @@ require 'formula'  class TransitionalMode < Requirement    fatal true +  satisfy do +    # If not installed, it will install in the correct mode. +    # If installed, make sure it is transitional instead of strict. +    !which('camlp5') || `camlp5 -pmode 2>&1`.chomp == 'transitional' +  end +    def message; <<-EOS.undent      camlp5 must be compiled in transitional mode (instead of --strict mode):        brew install camlp5      EOS    end -  def satisfied? -    # If not installed, it will install in the correct mode. -    return true if not which('camlp5') -    # If installed, make sure it is transitional instead of strict. -    `camlp5 -pmode 2>&1`.chomp == 'transitional' -  end  end  class Coq < Formula diff --git a/Library/Formula/cvs2svn.rb b/Library/Formula/cvs2svn.rb index e6bf23943..7a53b5d81 100644 --- a/Library/Formula/cvs2svn.rb +++ b/Library/Formula/cvs2svn.rb @@ -3,6 +3,8 @@ require 'formula'  class PythonWithGdbm < Requirement    fatal true +  satisfy { quiet_system "python", "-c", "import gdbm" } +    def message; <<-EOS.undent      The Python being used does not include gdbm support,      but it is required to build this formula: @@ -12,10 +14,6 @@ class PythonWithGdbm < Requirement      Homebrew's Python includes gdbm support.      EOS    end - -  def satisfied? -    quiet_system "python", "-c", "import gdbm" -  end  end  class Cvs2svn < Formula diff --git a/Library/Formula/diffpdf.rb b/Library/Formula/diffpdf.rb index 15775363f..1d0c4fddc 100644 --- a/Library/Formula/diffpdf.rb +++ b/Library/Formula/diffpdf.rb @@ -3,9 +3,8 @@ require 'formula'  class PopplerQt4 < Requirement    fatal true -  def satisfied? -    poppler = Tab.for_formula 'poppler' -    poppler.installed_with? '--with-qt4' +  satisfy :build_env => false do +    Tab.for_formula("poppler").installed_with? "--with-qt4"    end    def message; <<-EOS.undent diff --git a/Library/Formula/drizzle.rb b/Library/Formula/drizzle.rb index 828f9ac35..b156a76b7 100644 --- a/Library/Formula/drizzle.rb +++ b/Library/Formula/drizzle.rb @@ -1,9 +1,7 @@  require 'formula'  class LionOrNewer < Requirement -  def satisfied? -    MacOS.version >= :lion -  end +  satisfy MacOS.version >= :lion    def message      "Drizzle requires Mac OS X 10.7 (Lion) or newer." diff --git a/Library/Formula/dsniff.rb b/Library/Formula/dsniff.rb index 8eda8cc45..add05311c 100644 --- a/Library/Formula/dsniff.rb +++ b/Library/Formula/dsniff.rb @@ -1,6 +1,8 @@  require 'formula'  class NoBdb5 < Requirement +  satisfy(:build_env => false) { !Formula.factory("berkeley-db").installed? } +    def message; <<-EOS.undent      This software can fail to compile when Berkeley-DB 5.x is installed.      You may need to try: @@ -9,10 +11,6 @@ class NoBdb5 < Requirement        brew link berkeley-db      EOS    end -  def satisfied? -    f = Formula.factory("berkeley-db") -    not f.installed? -  end  end  class Dsniff < Formula diff --git a/Library/Formula/elixir.rb b/Library/Formula/elixir.rb index 96c196cbd..8132c56f5 100644 --- a/Library/Formula/elixir.rb +++ b/Library/Formula/elixir.rb @@ -3,6 +3,8 @@ require 'formula'  class ErlangInstalled < Requirement    fatal true +  satisfy { which 'erl' } +    def message; <<-EOS.undent      Erlang is required to install. @@ -13,10 +15,6 @@ class ErlangInstalled < Requirement        http://www.erlang.org/      EOS    end - -  def satisfied? -    which 'erl' -  end  end  class Elixir < Formula diff --git a/Library/Formula/ghc.rb b/Library/Formula/ghc.rb index 6b49abf2a..57edee02d 100644 --- a/Library/Formula/ghc.rb +++ b/Library/Formula/ghc.rb @@ -1,9 +1,7 @@  require 'formula'  class NeedsSnowLeopard < Requirement -  def satisfied? -    MacOS.version >= :snow_leopard -  end +  satisfy MacOS.version >= :snow_leopard    def message; <<-EOS.undent      GHC requires OS X 10.6 or newer. The binary releases no longer work on diff --git a/Library/Formula/git-hg.rb b/Library/Formula/git-hg.rb index fac0be430..1c11e49e9 100644 --- a/Library/Formula/git-hg.rb +++ b/Library/Formula/git-hg.rb @@ -1,6 +1,8 @@  require 'formula'  class HgInstalled < Requirement +  satisfy { which 'hg' } +    def message; <<-EOS.undent      Mercurial is required to use this software. @@ -11,9 +13,6 @@ class HgInstalled < Requirement        http://mercurial.selenic.com/      EOS    end -  def satisfied? -    which 'hg' -  end  end  class GitHg < Formula diff --git a/Library/Formula/google-js-test.rb b/Library/Formula/google-js-test.rb index b28bf43be..3bce824dd 100644 --- a/Library/Formula/google-js-test.rb +++ b/Library/Formula/google-js-test.rb @@ -1,13 +1,11 @@  require 'formula'  class NeedsSnowLeopard < Requirement +  satisfy MacOS.version >= :snow_leopard +    def message      "Google JS Test requires Mac OS X 10.6 (Snow Leopard) or newer."    end - -  def satisfied? -    MacOS.version >= :snow_leopard -  end  end  class GoogleJsTest < Formula diff --git a/Library/Formula/hyperestraier.rb b/Library/Formula/hyperestraier.rb index 932ebc100..38d55f124 100644 --- a/Library/Formula/hyperestraier.rb +++ b/Library/Formula/hyperestraier.rb @@ -7,9 +7,7 @@ class EucjpMecabIpadic < Requirement      @mecab_ipadic_installed = Formula.factory('mecab-ipadic').installed?    end -  def satisfied? -    @mecab_ipadic_installed && mecab_dic_charset == 'euc' -  end +  satisfy { @mecab_ipadic_installed && mecab_dic_charset == 'euc' }    def message      if @mecab_ipadic_installed diff --git a/Library/Formula/jstalk.rb b/Library/Formula/jstalk.rb index ac31ad240..7b9fce72b 100644 --- a/Library/Formula/jstalk.rb +++ b/Library/Formula/jstalk.rb @@ -1,9 +1,7 @@  require 'formula'  class NeedsSnowLeopard < Requirement -  def satisfied? -    MacOS.version >= :snow_leopard -  end +  satisfy MacOS.version >= :snow_leopard    def message      "jstalk requires Mac OS X 10.6 or newer" diff --git a/Library/Formula/mlton.rb b/Library/Formula/mlton.rb index 9fa2ef3e9..999cd35fd 100644 --- a/Library/Formula/mlton.rb +++ b/Library/Formula/mlton.rb @@ -5,6 +5,8 @@ require 'formula'  # would require an existing ML compiler/interpreter for bootstrapping.  class StandardHomebrewLocation < Requirement +  satisfy HOMEBREW_PREFIX.to_s == "/usr/local" +    def message; <<-EOS.undent      mlton won't work outside of /usr/local @@ -13,9 +15,6 @@ class StandardHomebrewLocation < Requirement      will be unable to find GMP.      EOS    end -  def satisfied? -    HOMEBREW_PREFIX.to_s == "/usr/local" -  end  end  class Mlton < Formula diff --git a/Library/Formula/mongodb.rb b/Library/Formula/mongodb.rb index 6f74fc18a..fed3430b9 100644 --- a/Library/Formula/mongodb.rb +++ b/Library/Formula/mongodb.rb @@ -3,9 +3,7 @@ require 'formula'  class SixtyFourBitRequired < Requirement    fatal true -  def satisfied? -    MacOS.prefer_64_bit? -  end +  satisfy MacOS.prefer_64_bit?    def message; <<-EOS.undent      32-bit MongoDB binaries are no longer available. diff --git a/Library/Formula/mu.rb b/Library/Formula/mu.rb index 4c4dda530..9e2008e35 100644 --- a/Library/Formula/mu.rb +++ b/Library/Formula/mu.rb @@ -4,7 +4,7 @@ class Emacs23Installed < Requirement    fatal true    env :userpaths -  def satisfied? +  satisfy do      `emacs --version 2>/dev/null` =~ /^GNU Emacs (\d{2})/      $1.to_i >= 23    end diff --git a/Library/Formula/mupdf.rb b/Library/Formula/mupdf.rb index 07c4fb64d..9381f9e4f 100644 --- a/Library/Formula/mupdf.rb +++ b/Library/Formula/mupdf.rb @@ -3,9 +3,7 @@ require 'formula'  class NeedsSnowLeopard < Requirement    fatal true -  def satisfied? -    MacOS.version >= :snow_leopard -  end +  satisfy MacOS.version >= :snow_leopard    def message; <<-EOS.undent      The version of Freetype that comes with Leopard is too old to build MuPDF diff --git a/Library/Formula/mysql-connector-odbc.rb b/Library/Formula/mysql-connector-odbc.rb index 5bcf3bc88..385fa09da 100644 --- a/Library/Formula/mysql-connector-odbc.rb +++ b/Library/Formula/mysql-connector-odbc.rb @@ -3,6 +3,8 @@ require 'formula'  class MySqlInstalled < Requirement    fatal true +  satisfy { which 'mysql_config' } +    def message; <<-EOS.undent      MySQL is required to install. @@ -17,9 +19,6 @@ class MySqlInstalled < Requirement        http://dev.mysql.com/downloads/mysql/      EOS    end -  def satisfied? -    which 'mysql_config' -  end  end  class MysqlConnectorOdbc < Formula diff --git a/Library/Formula/node.rb b/Library/Formula/node.rb index 55cfc9f9b..0574281b2 100644 --- a/Library/Formula/node.rb +++ b/Library/Formula/node.rb @@ -1,16 +1,19 @@  require 'formula'  class PythonVersion < Requirement +  env :userpaths + +  satisfy { `python -c 'import sys;print(sys.version[:3])'`.strip.to_f >= 2.6 } +    def message; <<-EOS.undent      Node's build system, gyp, requires Python 2.6 or newer.      EOS    end -  def satisfied? -    `python -c 'import sys;print(sys.version[:3])'`.strip.to_f >= 2.6 -  end  end  class NpmNotInstalled < Requirement +  fatal true +    def modules_folder      "#{HOMEBREW_PREFIX}/lib/node_modules"    end @@ -28,7 +31,7 @@ class NpmNotInstalled < Requirement      EOS    end -  def satisfied? +  satisfy :build_env => false do      begin        path = Pathname.new("#{modules_folder}/npm")        not path.realpath.to_s.include?(HOMEBREW_CELLAR) @@ -36,10 +39,6 @@ class NpmNotInstalled < Requirement        true      end    end - -  def fatal? -    true -  end  end  class Node < Formula diff --git a/Library/Formula/nu.rb b/Library/Formula/nu.rb index 0dcb9575b..3ed0e2ac3 100644 --- a/Library/Formula/nu.rb +++ b/Library/Formula/nu.rb @@ -3,9 +3,8 @@ require 'formula'  class NeedsLion < Requirement    fatal true -  def satisfied? -    MacOS.version >= :lion -  end +  satisfy MacOS.version >= :lion +    def message      "Nu requires Mac OS X 10.7 or newer"    end diff --git a/Library/Formula/pdf2svg.rb b/Library/Formula/pdf2svg.rb index a36575477..89c950c30 100644 --- a/Library/Formula/pdf2svg.rb +++ b/Library/Formula/pdf2svg.rb @@ -3,9 +3,8 @@ require 'formula'  class PopplerGlib < Requirement    fatal true -  def satisfied? -    poppler = Tab.for_formula 'poppler' -    poppler.installed_with? '--with-glib' +  satisfy :build_env => false do +    Tab.for_formula("poppler").installed_with? "--with-glib"    end    def message; <<-EOS.undent diff --git a/Library/Formula/phantomjs.rb b/Library/Formula/phantomjs.rb index af6de6eca..e69d81c02 100644 --- a/Library/Formula/phantomjs.rb +++ b/Library/Formula/phantomjs.rb @@ -1,9 +1,7 @@  require 'formula'  class SnowLeopardOrNewer < Requirement -  def satisfied? -    MacOS.version >= :snow_leopard -  end +  satisfy MacOS.version >= :snow_leopard    def message      "PhantomJS requires Mac OS X 10.6 (Snow Leopard) or newer." diff --git a/Library/Formula/postgres-xc.rb b/Library/Formula/postgres-xc.rb index c130ebea0..4179df26b 100644 --- a/Library/Formula/postgres-xc.rb +++ b/Library/Formula/postgres-xc.rb @@ -3,14 +3,13 @@ require 'formula'  class X86_64_Architecture < Requirement    fatal true +  satisfy MacOS.prefer_64_bit? +    def message; <<-EOS.undent      Your system appears to run on a 32-bit architecture.      Postgres-XC only supports 64-bit architectures, sorry.      EOS    end -  def satisfied? -    MacOS.prefer_64_bit? -  end  end  class PostgresXc < Formula diff --git a/Library/Formula/rhash.rb b/Library/Formula/rhash.rb index 2b497c13b..9bea1082a 100644 --- a/Library/Formula/rhash.rb +++ b/Library/Formula/rhash.rb @@ -3,9 +3,8 @@ require 'formula'  class LionOrNewer < Requirement    fatal true -  def satisfied? -    MacOS.version >= :lion -  end +  satisfy(:build_env => false) { MacOS.version >= :lion } +    def message      "rhash requires `wcsdup` which isn't in the SDK before Lion."    end diff --git a/Library/Formula/shocco.rb b/Library/Formula/shocco.rb index b13c443ff..81029c85a 100644 --- a/Library/Formula/shocco.rb +++ b/Library/Formula/shocco.rb @@ -11,6 +11,8 @@ end  class MarkdownProvider < Requirement    fatal true +  satisfy { which 'markdown' } +    def message; <<-EOS.undent      shocco requires a `markdown` command. @@ -21,10 +23,6 @@ class MarkdownProvider < Requirement      Please install one and try again.      EOS    end - -  def satisfied? -    which 'markdown' -  end  end  class Shocco < Formula diff --git a/Library/Formula/signing-party.rb b/Library/Formula/signing-party.rb index 4dfd321a5..33c201055 100644 --- a/Library/Formula/signing-party.rb +++ b/Library/Formula/signing-party.rb @@ -2,6 +2,9 @@ require 'formula'  class GnupgInstalled < Requirement    fatal true +  env :userpaths + +  satisfy { which('gpg') || which('gpg2') }    def message; <<-EOS.undent      Gnupg is required to use these tools. @@ -14,10 +17,6 @@ class GnupgInstalled < Requirement      prepackaged installers that are available.      EOS    end - -  def satisfied? -    which 'gpg' or which 'gpg2' -  end  end  class SigningParty < Formula diff --git a/Library/Formula/squid.rb b/Library/Formula/squid.rb index cf461aad1..0a1a1afe5 100644 --- a/Library/Formula/squid.rb +++ b/Library/Formula/squid.rb @@ -4,6 +4,8 @@ class NoBdb5 < Requirement    # Not fatal in case Squid starts working with a newer version of BDB.    fatal false +  satisfy(:build_env => false) { !Formula.factory("berkeley-db").installed? } +    def message; <<-EOS.undent      This software can fail to compile when Berkeley-DB 5.x is installed.      You may need to try: @@ -12,11 +14,6 @@ class NoBdb5 < Requirement        brew link berkeley-db      EOS    end - -  def satisfied? -    f = Formula.factory("berkeley-db") -    not f.installed? -  end  end  class Squid < Formula diff --git a/Library/Formula/uwsgi.rb b/Library/Formula/uwsgi.rb index 255a2da2b..652a8bca6 100644 --- a/Library/Formula/uwsgi.rb +++ b/Library/Formula/uwsgi.rb @@ -3,6 +3,11 @@ require 'formula'  class UniversalPcre < Requirement    fatal true +  satisfy :build_env => false do +    f = Formula.factory('pcre') +    f.installed? && archs_for_command(f.lib/'libpcre.dylib').universal? +  end +    def message; <<-EOS.undent      pcre must be build universal for uwsgi to work.      You will need to: @@ -10,11 +15,6 @@ class UniversalPcre < Requirement        brew install --universal pcre      EOS    end - -  def satisfied? -    f = Formula.factory('pcre') -    f.installed? && archs_for_command(f.lib/'libpcre.dylib').universal? -  end  end  class Uwsgi < Formula diff --git a/Library/Formula/wxmac.rb b/Library/Formula/wxmac.rb index 09af04e83..78cb2c075 100644 --- a/Library/Formula/wxmac.rb +++ b/Library/Formula/wxmac.rb @@ -2,15 +2,16 @@ require 'formula'  class FrameworkPython < Requirement    fatal true +  env :userpaths -  def message; <<-EOS.undent -    Python needs to be built as a framework. -    EOS -  end -  def satisfied? +  satisfy do      q = `python -c "import distutils.sysconfig as c; print(c.get_config_var('PYTHONFRAMEWORK'))"`      not q.chomp.empty?    end + +  def message +    "Python needs to be built as a framework." +  end  end  class Wxmac < Formula diff --git a/Library/Homebrew/requirements.rb b/Library/Homebrew/requirements.rb index a905968f9..6bf082619 100644 --- a/Library/Homebrew/requirements.rb +++ b/Library/Homebrew/requirements.rb @@ -8,9 +8,7 @@ class LanguageModuleDependency < Requirement      @import_name = import_name || module_name    end -  def satisfied? -    quiet_system(*the_test) -  end +  satisfy { quiet_system(*the_test) }    def message; <<-EOS.undent      Unsatisfied dependency: #{@module_name} @@ -65,8 +63,8 @@ class X11Dependency < Requirement      super    end -  def satisfied? -    MacOS::XQuartz.installed? and (@min_version.nil? or @min_version <= MacOS::XQuartz.version) +  satisfy :build_env => false do +    MacOS::XQuartz.installed? && (@min_version.nil? || @min_version <= MacOS::XQuartz.version)    end    def message; <<-EOS.undent @@ -121,20 +119,14 @@ class MPIDependency < Requirement      quiet_system compiler, '--version'    end -  def satisfied? -    # we have to assure the ENV is (almost) as during the build -    require 'superenv' -    ENV.with_build_environment do -      ENV.userpaths! - -      @lang_list.each do |lang| -        case lang -        when :cc, :cxx, :f90, :f77 -          compiler = 'mpi' + lang.to_s -          @non_functional << compiler unless mpi_wrapper_works? compiler -        else -          @unknown_langs << lang.to_s -        end +  satisfy do +    @lang_list.each do |lang| +      case lang +      when :cc, :cxx, :f90, :f77 +        compiler = 'mpi' + lang.to_s +        @non_functional << compiler unless mpi_wrapper_works? compiler +      else +        @unknown_langs << lang.to_s        end      end      @unknown_langs.empty? and @non_functional.empty? @@ -204,7 +196,7 @@ class ConflictRequirement < Requirement      message    end -  def satisfied? +  satisfy :build_env => false do      keg = Formula.factory(@formula).prefix      not keg.exist? && Keg.new(keg).linked?    end @@ -213,9 +205,7 @@ end  class XcodeDependency < Requirement    fatal true -  def satisfied? -    MacOS::Xcode.installed? -  end +  satisfy(:build_env => false) { MacOS::Xcode.installed? }    def message; <<-EOS.undent      A full installation of Xcode.app is required to compile this software. @@ -226,10 +216,9 @@ end  class MysqlInstalled < Requirement    fatal true +  env :userpaths -  def satisfied? -    which 'mysql_config' -  end +  satisfy { which 'mysql_config' }    def message; <<-EOS.undent      MySQL is required to install. @@ -249,10 +238,9 @@ end  class PostgresqlInstalled < Requirement    fatal true +  env :userpaths -  def satisfied? -    which 'pg_config' -  end +  satisfy { which 'pg_config' }    def message      <<-EOS.undent @@ -271,11 +259,7 @@ class TeXInstalled < Requirement    fatal true    env :userpaths -  def satisfied? -    tex = which 'tex' -    latex = which 'latex' -    not tex.nil? and not latex.nil? -  end +  satisfy { which('tex') || which('latex') }    def message; <<-EOS.undent      A LaTeX distribution is required to install. | 
