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