Add cache location support to CVS.

This allows formulaes which use CVS to support:
  brew --cache [formula]
This commit is contained in:
Adam Vandenberg 2010-06-06 15:38:46 -07:00
parent ff9c50151d
commit eb30a8555b

View File

@ -204,9 +204,15 @@ class GitDownloadStrategy <AbstractDownloadStrategy
end end
class CVSDownloadStrategy <AbstractDownloadStrategy class CVSDownloadStrategy <AbstractDownloadStrategy
def initialize url, name, version, specs
super
@co=HOMEBREW_CACHE+@unique_token
end
def cached_location; @co; end
def fetch def fetch
ohai "Checking out #{@url}" ohai "Checking out #{@url}"
@co=HOMEBREW_CACHE+@unique_token
# URL of cvs cvs://:pserver:anoncvs@www.gccxml.org:/cvsroot/GCC_XML:gccxml # URL of cvs cvs://:pserver:anoncvs@www.gccxml.org:/cvsroot/GCC_XML:gccxml
# will become: # will become:
@ -220,14 +226,13 @@ class CVSDownloadStrategy <AbstractDownloadStrategy
safe_system '/usr/bin/cvs', '-d', url, 'checkout', '-d', @unique_token, mod safe_system '/usr/bin/cvs', '-d', url, 'checkout', '-d', @unique_token, mod
end end
else else
d = HOMEBREW_CACHE+@unique_token puts "Updating #{@co}"
puts "Updating #{d}" Dir.chdir(@co) { safe_system '/usr/bin/cvs', 'up' }
Dir.chdir(d) { safe_system '/usr/bin/cvs', 'up' }
end end
end end
def stage def stage
FileUtils.cp_r(Dir[HOMEBREW_CACHE+@unique_token+"*"], Dir.pwd) FileUtils.cp_r Dir[@co+"*"], Dir.pwd
require 'find' require 'find'
Find.find(Dir.pwd) do |path| Find.find(Dir.pwd) do |path|