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.
This commit is contained in:
Adam Vandenberg 2010-06-28 14:55:31 -07:00
parent 281768cc07
commit 4c2d3e1f7f
4 changed files with 37 additions and 5 deletions

View File

@ -163,6 +163,12 @@ didn't include with OS X.
If set, instructs Homebrew to always assume `--verbose` when running If set, instructs Homebrew to always assume `--verbose` when running
commands. commands.
* HOMEBREW\_SVN:
When exporting from Subversion, Homebrew will use `HOMEBREW_SVN` if set,
a Homebrew-built Subversion if installed, or the system-provided binary.
Set this to force Homebrew to use a particular svn binary.
## SEE ALSO ## SEE ALSO
Homebrew Wiki: http://wiki.github.com/mxcl/homebrew/ Homebrew Wiki: http://wiki.github.com/mxcl/homebrew/

View File

@ -198,11 +198,30 @@ class SubversionDownloadStrategy <AbstractDownloadStrategy
quiet_safe_system *args quiet_safe_system *args
end end
# Override this method in a DownloadStrategy to force the use of a non- # Try HOMEBREW_SVN, a Homebrew-built svn, and finally the OS X system svn.
# system svn binary. mplayer.rb uses this to require a svn new enough to # Not all features are available in the 10.5 system-provided svn.
# understand its externals.
def 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
end end

View File

@ -255,7 +255,7 @@ def dump_build_env env
puts "\"--use-llvm\" was specified" if ARGV.include? '--use-llvm' 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 %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] value = env[k]
puts "#{k}: #{value}" if value puts "#{k}: #{value}" if value
end end

View File

@ -178,6 +178,13 @@ If set, instructs Homebrew to use the LLVM front\-ends to the GCC compilers\.
HOMEBREW_VERBOSE HOMEBREW_VERBOSE
If set, instructs Homebrew to always assume \fB\-\-verbose\fR when running commands\. If set, instructs Homebrew to always assume \fB\-\-verbose\fR when running commands\.
. .
.TP
HOMEBREW_SVN
When exporting from Subversion, Homebrew will use \fBHOMEBREW_SVN\fR if set, a Homebrew\-built Subversion if installed, or the system\-provided binary\.
.
.IP
Set this to force Homebrew to use a particular svn binary\.
.
.SH "SEE ALSO" .SH "SEE ALSO"
Homebrew Wiki: http://wiki\.github\.com/mxcl/homebrew/ Homebrew Wiki: http://wiki\.github\.com/mxcl/homebrew/
. .