Bazaar download strategy
This commit is contained in:
parent
6d06b9a179
commit
d8b093f279
@ -274,3 +274,37 @@ class MercurialDownloadStrategy <AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
end
|
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
|
||||||
|
|||||||
@ -159,6 +159,7 @@ class Formula
|
|||||||
when %r[^svn://] then SubversionDownloadStrategy
|
when %r[^svn://] then SubversionDownloadStrategy
|
||||||
when %r[^svn+http://] then SubversionDownloadStrategy
|
when %r[^svn+http://] then SubversionDownloadStrategy
|
||||||
when %r[^git://] then GitDownloadStrategy
|
when %r[^git://] then GitDownloadStrategy
|
||||||
|
when %r[^bzr://] then BazaarDownloadStrategy
|
||||||
when %r[^https?://(.+?\.)?googlecode\.com/hg] then MercurialDownloadStrategy
|
when %r[^https?://(.+?\.)?googlecode\.com/hg] then MercurialDownloadStrategy
|
||||||
when %r[^https?://(.+?\.)?googlecode\.com/svn] then SubversionDownloadStrategy
|
when %r[^https?://(.+?\.)?googlecode\.com/svn] then SubversionDownloadStrategy
|
||||||
when %r[^https?://(.+?\.)?sourceforge\.net/svnroot/] then SubversionDownloadStrategy
|
when %r[^https?://(.+?\.)?sourceforge\.net/svnroot/] then SubversionDownloadStrategy
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user