dev-cmd/bump-formula-pr: search for tar

We first search for gtar in PATH, then
check if Homebrew's gtar is available,
then finally search for tar in PATH.

Signed-off-by: Bob W. Hogg <rwhogg@linux.com>
This commit is contained in:
Bob W. Hogg 2017-08-07 18:57:55 -07:00
parent 33abea9eb3
commit 0ae22c0e36

View File

@ -176,7 +176,10 @@ module Homebrew
rsrc.version = forced_version if forced_version
odie "No version specified!" unless rsrc.version
rsrc_path = rsrc.fetch
if Utils.popen_read("/usr/bin/tar", "-tf", rsrc_path) =~ %r{/.*\.}
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} specified!"