diff options
| author | Mike McQuaid | 2018-01-24 14:20:07 +0000 |
|---|---|---|
| committer | GitHub | 2018-01-24 14:20:07 +0000 |
| commit | 0f44937b927a8053f378dda9d79c254a010a71d4 (patch) | |
| tree | f771e2bb2727cc4b5cb20ffdb1c354f825f95822 | |
| parent | 60a30e966b7cece5bd4823dae3fb981ab85106ea (diff) | |
| parent | 5a3555eeee38fed0cadf4df94dc601a77b1f08ad (diff) | |
| download | brew-0f44937b927a8053f378dda9d79c254a010a71d4.tar.bz2 | |
Merge pull request #3728 from ilovezfs/bump-formula-pr-only-validate-tar-files
bump-formula-pr: only validate tar files.
| -rw-r--r-- | Library/Homebrew/dev-cmd/bump-formula-pr.rb | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 59dfc121d..7069a4816 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -184,25 +184,30 @@ module Homebrew elsif !new_url odie "#{formula}: no --url= argument specified!" 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 else new_url end - rsrc = Resource.new { @url = rsrc_url } - rsrc.download_strategy = CurlDownloadStrategy - rsrc.owner = Resource.new(formula.name) - rsrc.version = forced_version if forced_version - odie "No --version= argument specified!" unless rsrc.version - rsrc_path = rsrc.fetch - gnu_tar_gtar_path = HOMEBREW_PREFIX/"opt/gnu-tar/bin/gtar" - gnu_tar_gtar = gnu_tar_gtar_path if gnu_tar_gtar_path.executable? - tar = which("gtar") || gnu_tar_gtar || which("tar") - if Utils.popen_read(tar, "-tf", rsrc_path) =~ %r{/.*\.} - new_hash = rsrc_path.sha256 - elsif new_url.include? ".tar" - odie "#{formula}: no --url=/--#{hash_type}= arguments specified!" + resource = Resource.new { @url = resource_url } + resource.download_strategy = CurlDownloadStrategy + resource.owner = Resource.new(formula.name) + resource.version = forced_version if forced_version + odie "No --version= argument specified!" unless resource.version + resource_path = resource.fetch + tar_file_extensions = %w[.tar .tb2 .tbz .tbz2 .tgz .tlz .txz .tZ] + if tar_file_extensions.any? { |extension| new_url.include? extension } + gnu_tar_gtar_path = HOMEBREW_PREFIX/"opt/gnu-tar/bin/gtar" + gnu_tar_gtar = gnu_tar_gtar_path if gnu_tar_gtar_path.executable? + tar = which("gtar") || gnu_tar_gtar || which("tar") + if Utils.popen_read(tar, "-tf", resource_path) =~ %r{/.*\.} + new_hash = resource_path.sha256 + else + odie "#{resource_path} is not a valid tar file!" + end + else + new_hash = resource_path.sha256 end end |
