Merge pull request #3728 from ilovezfs/bump-formula-pr-only-validate-tar-files
bump-formula-pr: only validate tar files.
This commit is contained in:
commit
0f44937b92
@ -184,25 +184,30 @@ module Homebrew
|
|||||||
elsif !new_url
|
elsif !new_url
|
||||||
odie "#{formula}: no --url= argument specified!"
|
odie "#{formula}: no --url= argument specified!"
|
||||||
else
|
else
|
||||||
rsrc_url = if requested_spec != :devel && new_url =~ /.*ftpmirror.gnu.*/
|
resource_url = if requested_spec != :devel && new_url =~ /.*ftpmirror.gnu.*/
|
||||||
new_mirror = new_url.sub "ftpmirror.gnu.org", "ftp.gnu.org/gnu"
|
new_mirror = new_url.sub "ftpmirror.gnu.org", "ftp.gnu.org/gnu"
|
||||||
new_mirror
|
new_mirror
|
||||||
else
|
else
|
||||||
new_url
|
new_url
|
||||||
end
|
end
|
||||||
rsrc = Resource.new { @url = rsrc_url }
|
resource = Resource.new { @url = resource_url }
|
||||||
rsrc.download_strategy = CurlDownloadStrategy
|
resource.download_strategy = CurlDownloadStrategy
|
||||||
rsrc.owner = Resource.new(formula.name)
|
resource.owner = Resource.new(formula.name)
|
||||||
rsrc.version = forced_version if forced_version
|
resource.version = forced_version if forced_version
|
||||||
odie "No --version= argument specified!" unless rsrc.version
|
odie "No --version= argument specified!" unless resource.version
|
||||||
rsrc_path = rsrc.fetch
|
resource_path = resource.fetch
|
||||||
gnu_tar_gtar_path = HOMEBREW_PREFIX/"opt/gnu-tar/bin/gtar"
|
tar_file_extensions = %w[.tar .tb2 .tbz .tbz2 .tgz .tlz .txz .tZ]
|
||||||
gnu_tar_gtar = gnu_tar_gtar_path if gnu_tar_gtar_path.executable?
|
if tar_file_extensions.any? { |extension| new_url.include? extension }
|
||||||
tar = which("gtar") || gnu_tar_gtar || which("tar")
|
gnu_tar_gtar_path = HOMEBREW_PREFIX/"opt/gnu-tar/bin/gtar"
|
||||||
if Utils.popen_read(tar, "-tf", rsrc_path) =~ %r{/.*\.}
|
gnu_tar_gtar = gnu_tar_gtar_path if gnu_tar_gtar_path.executable?
|
||||||
new_hash = rsrc_path.sha256
|
tar = which("gtar") || gnu_tar_gtar || which("tar")
|
||||||
elsif new_url.include? ".tar"
|
if Utils.popen_read(tar, "-tf", resource_path) =~ %r{/.*\.}
|
||||||
odie "#{formula}: no --url=/--#{hash_type}= arguments specified!"
|
new_hash = resource_path.sha256
|
||||||
|
else
|
||||||
|
odie "#{resource_path} is not a valid tar file!"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
new_hash = resource_path.sha256
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user