aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-07-16 20:38:50 -0500
committerJack Nagel2013-07-16 21:24:54 -0500
commit7ddf54f7812c79ef8b56653a998365ba16d8df4c (patch)
tree80a127865c1add849c01387b8774603f98828cae /Library
parentf4a735e8f3f02485852a610cd04cf01022250e33 (diff)
downloadhomebrew-7ddf54f7812c79ef8b56653a998365ba16d8df4c.tar.bz2
Audit conditional deps that can be made declarative
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/curl.rb3
-rw-r--r--Library/Formula/mapserver.rb4
-rw-r--r--Library/Homebrew/cmd/audit.rb21
3 files changed, 24 insertions, 4 deletions
diff --git a/Library/Formula/curl.rb b/Library/Formula/curl.rb
index 88469fab8..e7f8c408f 100644
--- a/Library/Formula/curl.rb
+++ b/Library/Formula/curl.rb
@@ -10,14 +10,13 @@ class Curl < Formula
"The libcurl provided by Leopard is too old for CouchDB to use."
option 'with-ssh', 'Build with scp and sftp support'
- option 'with-libmetalink', 'Build with Metalink support'
option 'with-ares', 'Build with C-Ares async DNS support'
option 'with-ssl', 'Build with Homebrew OpenSSL instead of the system version'
option 'with-darwinssl', 'Build with Secure Transport for SSL support'
depends_on 'pkg-config' => :build
+ depends_on 'libmetalink' => :optional
depends_on 'libssh2' if build.with? 'ssh'
- depends_on 'libmetalink' if build.with? 'libmetalink'
depends_on 'c-ares' if build.with? 'ares'
depends_on 'openssl' if build.with? 'ssl'
diff --git a/Library/Formula/mapserver.rb b/Library/Formula/mapserver.rb
index d83f61d3c..1e48c65af 100644
--- a/Library/Formula/mapserver.rb
+++ b/Library/Formula/mapserver.rb
@@ -21,7 +21,7 @@ class Mapserver < Formula
depends_on 'proj'
depends_on 'gdal'
depends_on 'geos' => :optional
- depends_on 'postgresql' if build.include? 'with-postgresql' and not MacOS.version >= :lion
+ depends_on 'postgresql' => :optional unless MacOS.version >= :lion
depends_on 'fcgi' if build.include? 'with-fastcgi'
depends_on 'cairo' => :optional
@@ -38,7 +38,7 @@ class Mapserver < Formula
args << "--with-php=/usr/bin/php-config" if build.include? 'with-php'
args << "--with-cairo" if build.with? 'cairo'
- if build.include? 'with-postgresql'
+ if build.with? 'postgresql'
if MacOS.version >= :lion # Lion ships with PostgreSQL libs
args << "--with-postgis"
else
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index ae5b2410a..3e3075313 100644
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -493,6 +493,27 @@ class FormulaAuditor
if text =~ /ENV.fortran/
problem "Use `depends_on :fortran` instead of `ENV.fortran`"
end
+
+ if text =~ /depends_on :(.+) (if.+|unless.+)$/
+ audit_conditional_dep($1.to_sym, $2, $&)
+ end
+
+ if text =~ /depends_on ['"](.+)['"] (if.+|unless.+)$/
+ audit_conditional_dep($1, $2, $&)
+ end
+ end
+
+ def audit_conditional_dep(dep, condition, line)
+ case condition
+ when /if build\.include\? ['"]with-#{dep}['"]$/, /if build\.with\? ['"]#{dep}['"]$/
+ problem %{Replace #{line.inspect} with "depends_on #{quote_dep(dep)} => :optional"}
+ when /unless build\.include\? ['"]without-#{dep}['"]$/, /unless build\.without\? ['"]#{dep}['"]$/
+ problem %{Replace #{line.inspect} with "depends_on #{quote_dep(dep)} => :recommended"}
+ end
+ end
+
+ def quote_dep(dep)
+ Symbol === dep ? dep.inspect : "'#{dep}'"
end
def audit_python