diff options
| author | Jack Nagel | 2013-12-10 15:16:22 -0600 |
|---|---|---|
| committer | Jack Nagel | 2013-12-10 16:39:13 -0600 |
| commit | 1b7718f6a744881c853f258e40ab874cd975db58 (patch) | |
| tree | 67bda185bdb69d9e25a8dcdbd764221b33e7f060 /Library | |
| parent | 1d1bad98b7c77092262f68870cfcfdba2e8a4380 (diff) | |
| download | brew-1b7718f6a744881c853f258e40ab874cd975db58.tar.bz2 | |
bottle: determine revision more reliably
Closes Homebrew/homebrew#25100.
Diffstat (limited to 'Library')
| -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 |
