Make brew-bottle an internal command.
This commit is contained in:
parent
aef580261b
commit
22f908d520
@ -1,34 +0,0 @@
|
|||||||
# Builds binary brew package
|
|
||||||
require 'tab'
|
|
||||||
|
|
||||||
ARGV.each do|formula|
|
|
||||||
# Get the latest version
|
|
||||||
version = `brew list --versions #{formula}`.split.last
|
|
||||||
|
|
||||||
if version.nil?
|
|
||||||
onoe "Formula not installed: #{formula}"
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
source = HOMEBREW_CELLAR + formula + version
|
|
||||||
filename = "#{formula}-#{version}-bottle.tar.gz"
|
|
||||||
destination = Pathname.pwd
|
|
||||||
|
|
||||||
tab = Tab.for_keg source
|
|
||||||
if not tab.built_bottle
|
|
||||||
onoe "Formula not installed with '--build-bottle': #{formula}"
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
HOMEBREW_CELLAR.cd do
|
|
||||||
ohai "Bottling #{formula} #{version}..."
|
|
||||||
# Use gzip, faster to compress than bzip2, faster to uncompress than bzip2
|
|
||||||
# or an uncompressed tarball (and more bandwidth friendly).
|
|
||||||
safe_system 'tar', 'czf', destination/filename, "#{formula}/#{version}"
|
|
||||||
puts "./#{filename}"
|
|
||||||
puts "bottle do"
|
|
||||||
puts " url 'https://downloads.sf.net/project/machomebrew/Bottles/#{filename}'"
|
|
||||||
puts " sha1 '#{(destination/filename).sha1}'"
|
|
||||||
puts "end"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
34
Library/Homebrew/cmd/bottle.rb
Executable file
34
Library/Homebrew/cmd/bottle.rb
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
require 'formula'
|
||||||
|
require 'tab'
|
||||||
|
|
||||||
|
module Homebrew extend self
|
||||||
|
def formula_bottle_name f
|
||||||
|
"#{f.name}-#{f.version}-bottle.tar.gz"
|
||||||
|
end
|
||||||
|
|
||||||
|
def bottle_formula f
|
||||||
|
return onoe "Formula not installed: #{f.name}" unless f.installed?
|
||||||
|
return onoe "Formula not installed with '--build-bottle': #{f.name}" unless Tab.for_formula(f).built_bottle
|
||||||
|
|
||||||
|
directory = Pathname.pwd
|
||||||
|
filename = formula_bottle_name f
|
||||||
|
|
||||||
|
HOMEBREW_CELLAR.cd do
|
||||||
|
ohai "Bottling #{f.name} #{f.version}..."
|
||||||
|
# Use gzip, faster to compress than bzip2, faster to uncompress than bzip2
|
||||||
|
# or an uncompressed tarball (and more bandwidth friendly).
|
||||||
|
safe_system 'tar', 'czf', directory/filename, "#{f.name}/#{f.version}"
|
||||||
|
puts "./#{filename}"
|
||||||
|
puts "bottle do"
|
||||||
|
puts " url 'https://downloads.sf.net/project/machomebrew/Bottles/#{filename}'"
|
||||||
|
puts " sha1 '#{(directory/filename).sha1}'"
|
||||||
|
puts "end"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def bottle
|
||||||
|
ARGV.formulae.each do|f|
|
||||||
|
bottle_formula Formula.factory f
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user