Bazaar download strategy

This commit is contained in:
David Höppner 2010-02-02 13:43:44 +01:00
parent 6d06b9a179
commit d8b093f279
2 changed files with 35 additions and 0 deletions

View File

@ -274,3 +274,37 @@ class MercurialDownloadStrategy <AbstractDownloadStrategy
end
end
end
class BazaarDownloadStrategy <AbstractDownloadStrategy
def fetch
raise "You must install bazaar first" \
unless system "/usr/bin/which bzr"
ohai "Cloning #{@url}"
@clone=HOMEBREW_CACHE+@unique_token
url=@url.sub(%r[^bzr://], '')
unless @clone.exist?
# 'lightweight' means history-less
safe_system 'bzr', 'checkout', '--lightweight', url, @clone
else
puts "Updating #{@clone}"
Dir.chdir(@clone) { safe_system 'bzr', 'update' }
end
end
def stage
dst=Dir.getwd
Dir.chdir @clone do
if @spec and @ref
ohai "Checking out #{@spec} #{@ref}"
Dir.chdir @clone do
safe_system 'bzr', 'export', '-r', @ref, dst
end
else
safe_system 'bzr', 'export', dst
end
end
end
end

View File

@ -159,6 +159,7 @@ class Formula
when %r[^svn://] then SubversionDownloadStrategy
when %r[^svn+http://] then SubversionDownloadStrategy
when %r[^git://] then GitDownloadStrategy
when %r[^bzr://] then BazaarDownloadStrategy
when %r[^https?://(.+?\.)?googlecode\.com/hg] then MercurialDownloadStrategy
when %r[^https?://(.+?\.)?googlecode\.com/svn] then SubversionDownloadStrategy
when %r[^https?://(.+?\.)?sourceforge\.net/svnroot/] then SubversionDownloadStrategy