aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2012-09-28 21:04:03 -0500
committerJack Nagel2012-09-28 21:05:08 -0500
commitee485b16e7c42c269438fcd2181abad2bc3732be (patch)
treec8ce40300727114734d00403e9ef8febd36dff9c /Library
parent69ba010637421bf1f4b9934c7c3a7ab370dc376f (diff)
downloadbrew-ee485b16e7c42c269438fcd2181abad2bc3732be.tar.bz2
Make VCS download strategies work without user paths
Closes Homebrew/homebrew#15139. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/download_strategy.rb43
1 files changed, 31 insertions, 12 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 09086678a..bb01eb864 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -458,12 +458,17 @@ class MercurialDownloadStrategy < AbstractDownloadStrategy
def cached_location; @clone; end
+
def hgpath
- @path ||= (which("hg") || "#{HOMEBREW_PREFIX}/bin/hg")
+ @path ||= %W[
+ #{which("hg")}
+ #{HOMEBREW_PREFIX}/bin/hg
+ #{HOMEBREW_PREFIX}/share/python/hg
+ ].find { |p| File.executable? p }
end
def fetch
- raise "You must: brew install hg" unless File.file?(hgpath)
+ raise "You must: brew install mercurial" unless hgpath
ohai "Cloning #{@url}"
@@ -501,17 +506,24 @@ class BazaarDownloadStrategy < AbstractDownloadStrategy
def cached_location; @clone; end
+ def bzrpath
+ @path ||= %W[
+ #{which("bzr")}
+ #{HOMEBREW_PREFIX}/bin/bzr
+ ].find { |p| File.executable? p }
+ end
+
def fetch
- raise "You must install bazaar first" unless which "bzr"
+ raise "You must: brew install bazaar" unless bzrpath
ohai "Cloning #{@url}"
unless @clone.exist?
url=@url.sub(%r[^bzr://], '')
# 'lightweight' means history-less
- safe_system 'bzr', 'checkout', '--lightweight', url, @clone
+ safe_system bzrpath, 'checkout', '--lightweight', url, @clone
else
puts "Updating #{@clone}"
- Dir.chdir(@clone) { safe_system 'bzr', 'update' }
+ Dir.chdir(@clone) { safe_system bzrpath, 'update' }
end
end
@@ -526,10 +538,10 @@ class BazaarDownloadStrategy < AbstractDownloadStrategy
# if @spec and @ref
# ohai "Checking out #{@spec} #{@ref}"
# Dir.chdir @clone do
- # safe_system 'bzr', 'export', '-r', @ref, dst
+ # safe_system bzrpath, 'export', '-r', @ref, dst
# end
# else
- # safe_system 'bzr', 'export', dst
+ # safe_system bzrpath, 'export', dst
# end
#end
end
@@ -544,25 +556,32 @@ class FossilDownloadStrategy < AbstractDownloadStrategy
def cached_location; @clone; end
+ def fossilpath
+ @path ||= %W[
+ #{which("fossil")}
+ #{HOMEBREW_PREFIX}/bin/fossil
+ ].find { |p| File.executable? p }
+ end
+
def fetch
- raise "You must install fossil first" unless which "fossil"
+ raise "You must: brew install fossil" unless fossilpath
ohai "Cloning #{@url}"
unless @clone.exist?
url=@url.sub(%r[^fossil://], '')
- safe_system 'fossil', 'clone', url, @clone
+ safe_system fossilpath, 'clone', url, @clone
else
puts "Updating #{@clone}"
- safe_system 'fossil', 'pull', '-R', @clone
+ safe_system fossilpath, 'pull', '-R', @clone
end
end
def stage
# TODO: The 'open' and 'checkout' commands are very noisy and have no '-q' option.
- safe_system 'fossil', 'open', @clone
+ safe_system fossilpath, 'open', @clone
if @spec and @ref
ohai "Checking out #{@spec} #{@ref}"
- safe_system 'fossil', 'checkout', @ref
+ safe_system fossilpath, 'checkout', @ref
end
end
end