bump-formula-pr: use correct version in download

When a --version is specified, use this specified version in the name of
the downloaded file rather than the default that is parsed from the URL.
For instance,

  brew bump-formula-pr --devel \
    --url=http://www.zsh.org/pub/development/zsh-5.2-test-2.tar.gz \
    --version=5.2-test-2 zsh

should download to $HOMEBREW_CACHE/zsh-5.2-test-2.tar.gz (correct
behavior after this commit) rather than
$HOMEBREW_CACHE/zsh-2.tar.gz (wrong behavior before this commit).
This commit is contained in:
Zhiming Wang 2016-12-06 17:30:10 -05:00
parent 11cf7b97c4
commit 417f27f40f
No known key found for this signature in database
GPG Key ID: BBD31D4D110044B8

View File

@ -134,6 +134,7 @@ module Homebrew
rsrc = Resource.new { @url = rsrc_url } rsrc = Resource.new { @url = rsrc_url }
rsrc.download_strategy = CurlDownloadStrategy rsrc.download_strategy = CurlDownloadStrategy
rsrc.owner = Resource.new(formula.name) rsrc.owner = Resource.new(formula.name)
rsrc.version = forced_version if forced_version
rsrc_path = rsrc.fetch rsrc_path = rsrc.fetch
if Utils.popen_read("/usr/bin/tar", "-tf", rsrc_path) =~ %r{/.*\.} if Utils.popen_read("/usr/bin/tar", "-tf", rsrc_path) =~ %r{/.*\.}
new_hash = rsrc_path.sha256 new_hash = rsrc_path.sha256