diff options
| author | Adam Vandenberg | 2010-06-28 14:55:31 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2010-07-08 22:45:03 -0700 |
| commit | 4c2d3e1f7f3c10829c454ce152877eb26f3d92ab (patch) | |
| tree | 735cbeafed195d89efc236151b6881db949a65a0 /Library/Homebrew | |
| parent | 281768cc07edb256efc8788c6e86e324c35c3b4c (diff) | |
| download | brew-4c2d3e1f7f3c10829c454ce152877eb26f3d92ab.tar.bz2 | |
Improved Subversion support.
Homebrew will now use the svn binary pointed to by HOMEBREW_SVN if set,
use a Homebrew-installed svn if present, finally falling back to the
system-provided svn binary.
If a formula (mplayer) requires a newer version of Subversion than what
Leopard provides, it can use the "StrictSubversionDownloadStrategy"
download strategy to warn the user.
These changes also fix an issue with forcing exports not working on a
stock Leopard subversion, but letting the user either specify a specific
binary or install Subversion via Homebrew and pick that up instead.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 27 | ||||
| -rw-r--r-- | Library/Homebrew/utils.rb | 2 |
2 files changed, 24 insertions, 5 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 3ec36cb54..75ae64c1e 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -198,11 +198,30 @@ class SubversionDownloadStrategy <AbstractDownloadStrategy quiet_safe_system *args end - # Override this method in a DownloadStrategy to force the use of a non- - # system svn binary. mplayer.rb uses this to require a svn new enough to - # understand its externals. + # Try HOMEBREW_SVN, a Homebrew-built svn, and finally the OS X system svn. + # Not all features are available in the 10.5 system-provided svn. def svn - '/usr/bin/svn' + return ENV['HOMEBREW_SVN'] if ENV['HOMEBREW_SVN'] + return "#{HOMEBREW_PREFIX}/bin/svn" if File.exist? "#{HOMEBREW_PREFIX}/bin/svn" + return '/usr/bin/svn' + end +end + +# Require a newer version of Subversion than 1.4.x (Leopard-provided version) +class StrictSubversionDownloadStrategy <SubversionDownloadStrategy + def svn + exe = super + `#{exe} --version` =~ /version (\d+\.\d+(\.\d+)*)/ + svn_version = $1 + version_tuple=svn_version.split(".").collect {|v|Integer(v)} + + if version_tuple[0] == 1 and version_tuple[1] <= 4 + onoe "Detected Subversion (#{exe}, version #{svn_version}) is too old." + puts "Subversion 1.4.x will not export externals correctly for this formula." + puts "You must either `brew install subversion` or set HOMEBREW_SVN to the path" + puts "of a newer svn binary." + end + return exe end end diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 1de969939..d6170c323 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -255,7 +255,7 @@ def dump_build_env env puts "\"--use-llvm\" was specified" if ARGV.include? '--use-llvm' %w[ CC CXX LD CFLAGS CXXFLAGS CPPFLAGS LDFLAGS MACOSX_DEPLOYMENT_TARGET MAKEFLAGS PKG_CONFIG_PATH - HOMEBREW_DEBUG HOMEBREW_VERBOSE HOMEBREW_USE_LLVM ].each do |k| + HOMEBREW_DEBUG HOMEBREW_VERBOSE HOMEBREW_USE_LLVM HOMEBREW_SVN ].each do |k| value = env[k] puts "#{k}: #{value}" if value end |
