mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Move bottle URL construction to the bottle object
This commit is contained in:
parent
a87d2108ea
commit
1cc3747094
@ -28,11 +28,6 @@ def bottle_native_regex
|
|||||||
/(\.#{bottle_tag}\.bottle\.(\d+\.)?tar\.gz)$/o
|
/(\.#{bottle_tag}\.bottle\.(\d+\.)?tar\.gz)$/o
|
||||||
end
|
end
|
||||||
|
|
||||||
def bottle_url(root_url, *filename_args)
|
|
||||||
filename = Bottle::Filename.new(*filename_args)
|
|
||||||
"#{root_url}/#{filename}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def bottle_tag
|
def bottle_tag
|
||||||
if MacOS.version >= :lion
|
if MacOS.version >= :lion
|
||||||
MacOS.cat
|
MacOS.cat
|
||||||
|
@ -143,7 +143,8 @@ class Bottle
|
|||||||
|
|
||||||
checksum, tag = spec.checksum_for(bottle_tag)
|
checksum, tag = spec.checksum_for(bottle_tag)
|
||||||
|
|
||||||
@resource.url = bottle_url(spec.root_url, formula.name, formula.pkg_version, tag, spec.revision)
|
filename = Filename.new(formula.name, formula.pkg_version, tag, spec.revision)
|
||||||
|
@resource.url = build_url(spec.root_url, filename)
|
||||||
@resource.download_strategy = CurlBottleDownloadStrategy
|
@resource.download_strategy = CurlBottleDownloadStrategy
|
||||||
@resource.version = formula.pkg_version
|
@resource.version = formula.pkg_version
|
||||||
@resource.checksum = checksum
|
@resource.checksum = checksum
|
||||||
@ -155,6 +156,12 @@ class Bottle
|
|||||||
def compatible_cellar?
|
def compatible_cellar?
|
||||||
cellar == :any || cellar == HOMEBREW_CELLAR.to_s
|
cellar == :any || cellar == HOMEBREW_CELLAR.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def build_url(root_url, filename)
|
||||||
|
"#{root_url}/#{filename}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class BottleSpecification
|
class BottleSpecification
|
||||||
|
Loading…
x
Reference in New Issue
Block a user