bottle: determine revision more reliably
Closes Homebrew/homebrew#25100.
This commit is contained in:
parent
1d1bad98b7
commit
1b7718f6a7
@ -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."
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user