aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Vandenberg2010-06-28 14:55:31 -0700
committerAdam Vandenberg2010-07-08 22:45:03 -0700
commitd5c16f2fdbc90e063b527394b4d9dc48d7976acc (patch)
tree03826e5873a5416f6cceff03fd794516b368c175
parent958cf50d8231aa38596cfe9bfad385f101ce78e0 (diff)
downloadhomebrew-d5c16f2fdbc90e063b527394b4d9dc48d7976acc.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.
-rw-r--r--Library/Contributions/manpages/brew.1.md6
-rw-r--r--Library/Formula/mplayer.rb14
-rw-r--r--Library/Homebrew/download_strategy.rb27
-rw-r--r--Library/Homebrew/utils.rb2
-rw-r--r--share/man/man1/brew.17
5 files changed, 39 insertions, 17 deletions
diff --git a/Library/Contributions/manpages/brew.1.md b/Library/Contributions/manpages/brew.1.md
index b5184d055..b33c8c320 100644
--- a/Library/Contributions/manpages/brew.1.md
+++ b/Library/Contributions/manpages/brew.1.md
@@ -163,6 +163,12 @@ didn't include with OS X.
If set, instructs Homebrew to always assume `--verbose` when running
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
Homebrew Wiki: http://wiki.github.com/mxcl/homebrew/
diff --git a/Library/Formula/mplayer.rb b/Library/Formula/mplayer.rb
index 37d273c9e..59406431c 100644
--- a/Library/Formula/mplayer.rb
+++ b/Library/Formula/mplayer.rb
@@ -2,14 +2,12 @@ require 'formula'
class Mplayer <Formula
homepage 'http://www.mplayerhq.hu/'
- head 'svn://svn.mplayerhq.hu/mplayer/trunk'
+ # http://github.com/mxcl/homebrew/issues/issue/87
+ head 'svn://svn.mplayerhq.hu/mplayer/trunk', :using => StrictSubversionDownloadStrategy
depends_on 'pkg-config' => :recommended
depends_on 'yasm' => :optional
- # http://github.com/mxcl/homebrew/issues/#issue/87
- depends_on :subversion if MACOS_VERSION < 10.6
-
def install
# Do not use pipes, per bug report
# http://github.com/mxcl/homebrew/issues#issue/622
@@ -30,11 +28,3 @@ class Mplayer <Formula
system "make install"
end
end
-
-if MACOS_VERSION < 10.6
- class SubversionDownloadStrategy
- def svn
- Formula.factory('subversion').bin+'svn'
- end
- end
-end
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
diff --git a/share/man/man1/brew.1 b/share/man/man1/brew.1
index e286e430c..83b0be1db 100644
--- a/share/man/man1/brew.1
+++ b/share/man/man1/brew.1
@@ -178,6 +178,13 @@ If set, instructs Homebrew to use the LLVM front\-ends to the GCC compilers\.
HOMEBREW_VERBOSE
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"
Homebrew Wiki: http://wiki\.github\.com/mxcl/homebrew/
.