diff options
| author | Jack Nagel | 2013-12-10 15:16:22 -0600 |
|---|---|---|
| committer | Jack Nagel | 2013-12-10 16:39:13 -0600 |
| commit | 03e87eb07e1e8b17b7e26e350e4d7cce58bcc36a (patch) | |
| tree | 9952f6872b6056c2f5145f0bb28191f114e0af01 /Library/Homebrew | |
| parent | 864521465c0a0e27ea37af8a52200f3b8aced87a (diff) | |
| download | homebrew-03e87eb07e1e8b17b7e26e350e4d7cce58bcc36a.tar.bz2 | |
bottle: determine revision more reliably
Closes #25100.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/cmd/bottle.rb | 15 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/versions.rb | 21 |
2 files changed, 17 insertions, 19 deletions
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index c09ce2760..36e75d079 100644 --- a/Library/Homebrew/cmd/bottle.rb +++ b/Library/Homebrew/cmd/bottle.rb @@ -113,13 +113,14 @@ module Homebrew extend self return ofail "Formula not installed with '--build-bottle': #{f.name}" end - master_bottle_filenames = f.bottle_filenames 'origin/master' - bottle_revision = -1 - begin - bottle_revision += 1 - filename = bottle_filename(f, :tag => bottle_tag, :revision => bottle_revision) - end while not ARGV.include? '--no-revision' \ - and master_bottle_filenames.include? filename + if ARGV.include? '--no-revision' + bottle_revision = 0 + else + max = f.bottle_version_map('origin/master')[f.version].max + bottle_revision = max ? max + 1 : 0 + end + + filename = bottle_filename(f, :tag => bottle_tag, :revision => bottle_revision) if bottle_filename_formula_name(filename).empty? return ofail "Add a new regex to bottle_version.rb to parse the bottle filename." diff --git a/Library/Homebrew/cmd/versions.rb b/Library/Homebrew/cmd/versions.rb index feb908340..d92627270 100644 --- a/Library/Homebrew/cmd/versions.rb +++ b/Library/Homebrew/cmd/versions.rb @@ -41,20 +41,17 @@ class Formula return versions end - def bottle_filenames branch='HEAD' - filenames = [] - rev_list(branch).each do |sha| - filename = formula_for_sha(sha) do |f| - bottle_block = f.class.send(:bottle) - unless bottle_block.checksums.empty? - bottle_filename f, :revision => bottle_block.revision + def bottle_version_map branch='HEAD' + map = Hash.new { |h, k| h[k] = [] } + rev_list(branch).each do |rev| + formula_for_sha(rev) do |f| + bottle = f.class.send(:bottle) + unless bottle.checksums.empty? + map[bottle.version] << bottle.revision end end - unless filenames.include? filename or filename.nil? - filenames << filename - end end - filenames + map end def pretty_relative_path @@ -84,7 +81,7 @@ class Formula def rev_list branch='HEAD' repository.cd do - `git rev-list --abbrev-commit #{branch} -- #{entry_name}`.split + `git rev-list --abbrev-commit --remove-empty #{branch} -- #{entry_name}`.split end end |
