brew-bottle: split output and use a bottle object.
This commit is contained in:
parent
dbccff4d80
commit
517889d6fb
@ -8,6 +8,24 @@ module Homebrew extend self
|
|||||||
quiet_system 'fgrep', '--recursive', '--quiet', '--max-count=1', string, keg
|
quiet_system 'fgrep', '--recursive', '--quiet', '--max-count=1', string, keg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bottle_output bottle
|
||||||
|
puts "bottle do"
|
||||||
|
prefix = bottle.prefix.to_s
|
||||||
|
puts " prefix '#{prefix}'" if prefix != '/usr/local'
|
||||||
|
cellar = bottle.cellar.to_s
|
||||||
|
cellar = ":#{bottle.cellar}" if bottle.cellar.is_a? Symbol
|
||||||
|
puts " cellar '#{cellar}'" if bottle.cellar.to_s != '/usr/local/Cellar'
|
||||||
|
puts " revision #{bottle.revision}" if bottle.revision > 0
|
||||||
|
Checksum::TYPES.each do |checksum_type|
|
||||||
|
checksum_cat = bottle.send checksum_type
|
||||||
|
next unless checksum_cat
|
||||||
|
checksum_cat.each do |cat, checksum|
|
||||||
|
puts " #{checksum_type} '#{checksum}' => :#{cat}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
puts "end"
|
||||||
|
end
|
||||||
|
|
||||||
def bottle_formula f
|
def bottle_formula f
|
||||||
unless f.installed?
|
unless f.installed?
|
||||||
return ofail "Formula not installed: #{f.name}"
|
return ofail "Formula not installed: #{f.name}"
|
||||||
@ -49,25 +67,14 @@ module Homebrew extend self
|
|||||||
keg.relocate_install_names tmp_prefix, prefix, tmp_cellar, cellar
|
keg.relocate_install_names tmp_prefix, prefix, tmp_cellar, cellar
|
||||||
end
|
end
|
||||||
|
|
||||||
prefix = cellar = nil
|
bottle = Bottle.new
|
||||||
if relocatable
|
bottle.prefix HOMEBREW_PREFIX
|
||||||
cellar = ':any'
|
bottle.cellar relocatable ? :any : HOMEBREW_CELLAR
|
||||||
else
|
bottle.revision bottle_revision
|
||||||
if HOMEBREW_PREFIX.to_s != '/usr/local'
|
bottle.sha1 sha1 => bottle_tag
|
||||||
prefix = "'#{HOMEBREW_PREFIX}"
|
|
||||||
end
|
|
||||||
if HOMEBREW_CELLAR.to_s != '/usr/local/Cellar'
|
|
||||||
cellar = "'#{HOMEBREW_CELLAR}'"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
puts "./#{filename}"
|
puts "./#{filename}"
|
||||||
puts "bottle do"
|
bottle_output bottle
|
||||||
puts " prefix #{prefix}" if prefix
|
|
||||||
puts " cellar #{cellar}" if cellar
|
|
||||||
puts " revision #{bottle_revision}" if bottle_revision > 0
|
|
||||||
puts " sha1 '#{sha1}' => :#{bottle_tag}"
|
|
||||||
puts "end"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user