download_strategy: rename @co to @clone for uniformity

This commit is contained in:
Jack Nagel 2013-10-10 11:24:35 -05:00
parent 4a9cf0dd14
commit 1626282c45

View File

@ -317,47 +317,47 @@ class SubversionDownloadStrategy < VCSDownloadStrategy
@@svn ||= 'svn' @@svn ||= 'svn'
if ARGV.build_head? if ARGV.build_head?
@co = Pathname.new("#{HOMEBREW_CACHE}/#{checkout_name("svn-HEAD")}") @clone = Pathname.new("#{HOMEBREW_CACHE}/#{checkout_name("svn-HEAD")}")
else else
@co = Pathname.new("#{HOMEBREW_CACHE}/#{checkout_name("svn")}") @clone = Pathname.new("#{HOMEBREW_CACHE}/#{checkout_name("svn")}")
end end
end end
def cached_location def cached_location
@co @clone
end end
def repo_valid? def repo_valid?
@co.join(".svn").directory? @clone.join(".svn").directory?
end end
def fetch def fetch
@url.sub!(/^svn\+/, '') if @url =~ %r[^svn\+http://] @url.sub!(/^svn\+/, '') if @url =~ %r[^svn\+http://]
ohai "Checking out #{@url}" ohai "Checking out #{@url}"
if @co.exist? and not repo_valid? if @clone.exist? and not repo_valid?
puts "Removing invalid SVN repo from cache" puts "Removing invalid SVN repo from cache"
@co.rmtree @clone.rmtree
end end
case @ref_type case @ref_type
when :revision when :revision
fetch_repo @co, @url, @ref fetch_repo @clone, @url, @ref
when :revisions when :revisions
# nil is OK for main_revision, as fetch_repo will then get latest # nil is OK for main_revision, as fetch_repo will then get latest
main_revision = @ref[:trunk] main_revision = @ref[:trunk]
fetch_repo @co, @url, main_revision, true fetch_repo @clone, @url, main_revision, true
get_externals do |external_name, external_url| get_externals do |external_name, external_url|
fetch_repo @co+external_name, external_url, @ref[external_name], true fetch_repo @clone+external_name, external_url, @ref[external_name], true
end end
else else
fetch_repo @co, @url fetch_repo @clone, @url
end end
end end
def stage def stage
quiet_safe_system @@svn, 'export', '--force', @co, Dir.pwd quiet_safe_system @@svn, 'export', '--force', @clone, Dir.pwd
end end
def shell_quote str def shell_quote str
@ -574,10 +574,10 @@ end
class CVSDownloadStrategy < VCSDownloadStrategy class CVSDownloadStrategy < VCSDownloadStrategy
def initialize name, resource def initialize name, resource
super super
@co = Pathname.new("#{HOMEBREW_CACHE}/#{checkout_name("cvs")}") @clone = Pathname.new("#{HOMEBREW_CACHE}/#{checkout_name("cvs")}")
end end
def cached_location; @co; end def cached_location; @clone; end
def fetch def fetch
ohai "Checking out #{@url}" ohai "Checking out #{@url}"
@ -588,19 +588,19 @@ class CVSDownloadStrategy < VCSDownloadStrategy
# cvs -d :pserver:anoncvs@www.gccxml.org:/cvsroot/GCC_XML co gccxml # cvs -d :pserver:anoncvs@www.gccxml.org:/cvsroot/GCC_XML co gccxml
mod, url = split_url(@url) mod, url = split_url(@url)
unless @co.exist? unless @clone.exist?
HOMEBREW_CACHE.cd do HOMEBREW_CACHE.cd do
safe_system '/usr/bin/cvs', '-d', url, 'login' safe_system '/usr/bin/cvs', '-d', url, 'login'
safe_system '/usr/bin/cvs', '-d', url, 'checkout', '-d', checkout_name("cvs"), mod safe_system '/usr/bin/cvs', '-d', url, 'checkout', '-d', checkout_name("cvs"), mod
end end
else else
puts "Updating #{@co}" puts "Updating #{@clone}"
@co.cd { safe_system '/usr/bin/cvs', 'up' } @clone.cd { safe_system '/usr/bin/cvs', 'up' }
end end
end end
def stage def stage
FileUtils.cp_r Dir[@co+"{.}"], Dir.pwd FileUtils.cp_r Dir[@clone+"{.}"], Dir.pwd
require 'find' require 'find'
Find.find(Dir.pwd) do |path| Find.find(Dir.pwd) do |path|