dev-cmd/bottle: fix Rubocop warnings.
This commit is contained in:
parent
264afb67df
commit
9b5c45a7df
@ -13,7 +13,7 @@ require "utils/inreplace"
|
||||
require "erb"
|
||||
require "extend/pathname"
|
||||
|
||||
BOTTLE_ERB = <<-EOS
|
||||
BOTTLE_ERB = <<-EOS.freeze
|
||||
bottle do
|
||||
<% if !root_url.start_with?(BottleSpecification::DEFAULT_DOMAIN) %>
|
||||
root_url "<%= root_url %>"
|
||||
@ -89,15 +89,14 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
if ARGV.verbose? && !text_matches.empty?
|
||||
print_filename string, file
|
||||
text_matches.first(MAXIMUM_STRING_MATCHES).each do |match, offset|
|
||||
puts " #{Tty.gray}-->#{Tty.reset} match '#{match}' at offset #{Tty.em}0x#{offset}#{Tty.reset}"
|
||||
end
|
||||
next unless ARGV.verbose? && !text_matches.empty?
|
||||
print_filename string, file
|
||||
text_matches.first(MAXIMUM_STRING_MATCHES).each do |match, offset|
|
||||
puts " #{Tty.gray}-->#{Tty.reset} match '#{match}' at offset #{Tty.em}0x#{offset}#{Tty.reset}"
|
||||
end
|
||||
|
||||
if text_matches.size > MAXIMUM_STRING_MATCHES
|
||||
puts "Only the first #{MAXIMUM_STRING_MATCHES} matches were output"
|
||||
end
|
||||
if text_matches.size > MAXIMUM_STRING_MATCHES
|
||||
puts "Only the first #{MAXIMUM_STRING_MATCHES} matches were output"
|
||||
end
|
||||
end
|
||||
|
||||
@ -107,10 +106,9 @@ module Homebrew
|
||||
def keg_contain_absolute_symlink_starting_with?(string, keg)
|
||||
absolute_symlinks_start_with_string = []
|
||||
keg.find do |pn|
|
||||
if pn.symlink? && (link = pn.readlink).absolute?
|
||||
if link.to_s.start_with?(string)
|
||||
absolute_symlinks_start_with_string << pn
|
||||
end
|
||||
next unless pn.symlink? && (link = pn.readlink).absolute?
|
||||
if link.to_s.start_with?(string)
|
||||
absolute_symlinks_start_with_string << pn
|
||||
end
|
||||
end
|
||||
|
||||
@ -146,7 +144,7 @@ module Homebrew
|
||||
return
|
||||
end
|
||||
|
||||
unless Utils::Bottles::built_as? f
|
||||
unless Utils::Bottles.built_as? f
|
||||
return ofail "Formula not installed with '--build-bottle': #{f.full_name}"
|
||||
end
|
||||
|
||||
@ -289,6 +287,9 @@ module Homebrew
|
||||
bottle.sha256 sha256 => Utils::Bottles.tag
|
||||
|
||||
old_spec = f.bottle_specification
|
||||
p root_url
|
||||
p old_spec.root_url(root_url)
|
||||
p bottle.root_url(root_url)
|
||||
if ARGV.include?("--keep-old") && !old_spec.checksums.empty?
|
||||
mismatches = [:root_url, :prefix, :cellar, :rebuild].select do |key|
|
||||
old_spec.send(key) != bottle.send(key)
|
||||
@ -332,7 +333,7 @@ module Homebrew
|
||||
"filename" => filename.to_s,
|
||||
"sha256" => sha256,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
"bintray" => {
|
||||
"package" => Utils::Bottles::Bintray.package(f.name),
|
||||
@ -372,7 +373,7 @@ module Homebrew
|
||||
output = bottle_output bottle
|
||||
|
||||
if write
|
||||
path = Pathname.new("#{HOMEBREW_REPOSITORY/bottle_hash["formula"]["path"]}")
|
||||
path = Pathname.new((HOMEBREW_REPOSITORY/bottle_hash["formula"]["path"]).to_s)
|
||||
update_or_add = nil
|
||||
|
||||
Utils::Inreplace.inreplace(path) do |s|
|
||||
@ -391,7 +392,7 @@ module Homebrew
|
||||
old_value = old_value_original.to_s.delete ":'\""
|
||||
tag = tag.to_s.delete ":"
|
||||
|
||||
if !tag.empty?
|
||||
unless tag.empty?
|
||||
if !bottle_hash["bottle"]["tags"][tag].to_s.empty?
|
||||
mismatches << "#{key} => #{tag}"
|
||||
else
|
||||
@ -403,11 +404,10 @@ module Homebrew
|
||||
value_original = bottle_hash["bottle"][key]
|
||||
value = value_original.to_s
|
||||
next if key == "cellar" && old_value == "any" && value == "any_skip_relocation"
|
||||
if old_value.empty? || value != old_value
|
||||
old_value = old_value_original.inspect
|
||||
value = value_original.inspect
|
||||
mismatches << "#{key}: old: #{old_value}, new: #{value}"
|
||||
end
|
||||
next unless old_value.empty? || value != old_value
|
||||
old_value = old_value_original.inspect
|
||||
value = value_original.inspect
|
||||
mismatches << "#{key}: old: #{old_value}, new: #{value}"
|
||||
end
|
||||
|
||||
unless mismatches.empty?
|
||||
@ -444,7 +444,8 @@ module Homebrew
|
||||
rebuild\ \d+ # rebuild with a number
|
||||
)\n+ # multiple empty lines
|
||||
)+
|
||||
/mx, '\0' + output + "\n")
|
||||
/mx, '\0' + output + "\n"
|
||||
)
|
||||
end
|
||||
odie "Bottle block addition failed!" unless string
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user