Added FossilDownloadStrategy (Fossil SCM support)
This will enable downloading source repository using fossil SCM. For example, formulae `fossil` and `mongrel2` can have HEAD version. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
This commit is contained in:
parent
25f6bffa30
commit
915b018e15
@ -439,6 +439,39 @@ class BazaarDownloadStrategy <AbstractDownloadStrategy
|
||||
end
|
||||
end
|
||||
|
||||
class FossilDownloadStrategy < AbstractDownloadStrategy
|
||||
def initialize url, name, version, specs
|
||||
super
|
||||
@unique_token="#{name}--fossil" unless name.to_s.empty? or name == '__UNKNOWN__'
|
||||
@clone=HOMEBREW_CACHE+@unique_token
|
||||
end
|
||||
|
||||
def cached_location; @clone; end
|
||||
|
||||
def fetch
|
||||
raise "You must install fossil first" \
|
||||
unless system "/usr/bin/which fossil"
|
||||
|
||||
ohai "Cloning #{@url}"
|
||||
unless @clone.exist?
|
||||
url=@url.sub(%r[^fossil://], '')
|
||||
safe_system 'fossil', 'clone', url, @clone
|
||||
else
|
||||
puts "Updating #{@clone}"
|
||||
safe_system 'fossil', '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
|
||||
if @spec and @ref
|
||||
ohai "Checking out #{@spec} #{@ref}"
|
||||
safe_system 'fossil', 'checkout', @ref
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def detect_download_strategy url
|
||||
case url
|
||||
# We use a special URL pattern for cvs
|
||||
@ -449,6 +482,7 @@ def detect_download_strategy url
|
||||
when %r[^hg://] then MercurialDownloadStrategy
|
||||
when %r[^svn://] then SubversionDownloadStrategy
|
||||
when %r[^svn+http://] then SubversionDownloadStrategy
|
||||
when %r[^fossil://] then FossilDownloadStrategy
|
||||
# Some well-known source hosts
|
||||
when %r[^http://github\.com/.+\.git$] then GitDownloadStrategy
|
||||
when %r[^https?://(.+?\.)?googlecode\.com/hg] then MercurialDownloadStrategy
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user