Some Cleanup
This commit is contained in:
parent
b13baedfd8
commit
c1a3b724fd
@ -17,7 +17,6 @@ ARGV.formulae.each do |f|
|
|||||||
|
|
||||||
puts "MD5: #{the_tarball.md5}"
|
puts "MD5: #{the_tarball.md5}"
|
||||||
puts "SHA1: #{the_tarball.sha1}"
|
puts "SHA1: #{the_tarball.sha1}"
|
||||||
puts
|
|
||||||
|
|
||||||
unless previous_md5.nil? or the_tarball.md5 == previous_md5
|
unless previous_md5.nil? or the_tarball.md5 == previous_md5
|
||||||
opoo "Formula reports different MD5: #{previous_md5}"
|
opoo "Formula reports different MD5: #{previous_md5}"
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
class Cleaner
|
class Cleaner
|
||||||
def initialize f
|
def initialize f
|
||||||
@f=f
|
@f = Formula.factory f
|
||||||
[f.bin, f.sbin, f.lib].select{|d|d.exist?}.each{|d|clean_dir d}
|
[f.bin, f.sbin, f.lib].select{ |d| d.exist? }.each{ |d| clean_dir d }
|
||||||
|
|
||||||
unless ENV['HOMEBREW_KEEP_INFO'].nil?
|
unless ENV['HOMEBREW_KEEP_INFO'].nil?
|
||||||
f.info.rmtree if f.info.directory? and not f.skip_clean? f.info
|
f.info.rmtree if f.info.directory? and not f.skip_clean? f.info
|
||||||
@ -23,7 +23,8 @@ class Cleaner
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def strip path, args=''
|
def strip path, args=''
|
||||||
return if @f.skip_clean? path
|
return if @f.skip_clean? path
|
||||||
puts "strip #{path}" if ARGV.verbose?
|
puts "strip #{path}" if ARGV.verbose?
|
||||||
@ -46,18 +47,17 @@ private
|
|||||||
end
|
end
|
||||||
|
|
||||||
def clean_file path
|
def clean_file path
|
||||||
perms=0444
|
perms = 0444
|
||||||
case `file -h '#{path}'`
|
case `file -h '#{path}'`
|
||||||
when /Mach-O dynamically linked shared library/
|
when /Mach-O dynamically linked shared library/
|
||||||
# Stripping libraries is causing no end of trouble
|
# Stripping libraries is causing no end of trouble. Lets just give up,
|
||||||
# Lets just give up, and try to do it manually in instances where it
|
# and try to do it manually in instances where it makes sense.
|
||||||
# makes sense
|
|
||||||
#strip path, '-SxX'
|
#strip path, '-SxX'
|
||||||
when /Mach-O [^ ]* ?executable/
|
when /Mach-O [^ ]* ?executable/
|
||||||
strip path
|
strip path
|
||||||
perms=0555
|
perms = 0555
|
||||||
when /script text executable/
|
when /script text executable/
|
||||||
perms=0555
|
perms = 0555
|
||||||
end
|
end
|
||||||
path.chmod perms
|
path.chmod perms
|
||||||
end
|
end
|
||||||
@ -68,9 +68,9 @@ private
|
|||||||
Find.prune if @f.skip_clean? path
|
Find.prune if @f.skip_clean? path
|
||||||
elsif not path.file?
|
elsif not path.file?
|
||||||
next
|
next
|
||||||
elsif path.extname == '.la' and not @f.skip_clean? path
|
elsif path.extname == '.la'
|
||||||
# *.la files are stupid
|
# *.la files are stupid
|
||||||
path.unlink
|
path.unlink unless @f.skip_clean? path
|
||||||
elsif not path.symlink?
|
elsif not path.symlink?
|
||||||
clean_file path
|
clean_file path
|
||||||
end
|
end
|
||||||
|
|||||||
@ -206,33 +206,33 @@ def audit_formula_instance f
|
|||||||
end
|
end
|
||||||
|
|
||||||
module Homebrew extend self
|
module Homebrew extend self
|
||||||
def audit
|
def audit
|
||||||
ff.each do |f|
|
ff.each do |f|
|
||||||
problems = []
|
problems = []
|
||||||
problems += audit_formula_instance f
|
problems += audit_formula_instance f
|
||||||
problems += audit_formula_urls f
|
problems += audit_formula_urls f
|
||||||
|
|
||||||
text = ""
|
text = ""
|
||||||
File.open(f.path, "r") { |afile| text = afile.read }
|
File.open(f.path, "r") { |afile| text = afile.read }
|
||||||
|
|
||||||
# DATA with no __END__
|
# DATA with no __END__
|
||||||
if (text =~ /\bDATA\b/) and not (text =~ /^\s*__END__\s*$/)
|
if (text =~ /\bDATA\b/) and not (text =~ /^\s*__END__\s*$/)
|
||||||
problems << " * 'DATA' was found, but no '__END__'"
|
problems << " * 'DATA' was found, but no '__END__'"
|
||||||
end
|
end
|
||||||
|
|
||||||
problems += [' * invalid or missing version'] if f.version.to_s.empty?
|
problems += [' * invalid or missing version'] if f.version.to_s.empty?
|
||||||
|
|
||||||
# Don't try remaining audits on text in __END__
|
# Don't try remaining audits on text in __END__
|
||||||
text_without_patch = (text.split("__END__")[0]).strip()
|
text_without_patch = (text.split("__END__")[0]).strip()
|
||||||
|
|
||||||
problems += audit_formula_text(text_without_patch)
|
problems += audit_formula_text(text_without_patch)
|
||||||
problems += audit_formula_options(f, text_without_patch)
|
problems += audit_formula_options(f, text_without_patch)
|
||||||
|
|
||||||
unless problems.empty?
|
unless problems.empty?
|
||||||
puts "#{f.name}:"
|
puts "#{f.name}:"
|
||||||
puts problems * "\n"
|
puts problems * "\n"
|
||||||
puts
|
puts
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|||||||
@ -584,50 +584,50 @@ def check_for_other_vars
|
|||||||
end
|
end
|
||||||
|
|
||||||
module Homebrew extend self
|
module Homebrew extend self
|
||||||
def doctor
|
def doctor
|
||||||
read, write = IO.pipe
|
read, write = IO.pipe
|
||||||
|
|
||||||
if fork == nil
|
if fork == nil
|
||||||
read.close
|
read.close
|
||||||
$stdout.reopen write
|
$stdout.reopen write
|
||||||
|
|
||||||
check_usr_bin_ruby
|
check_usr_bin_ruby
|
||||||
check_homebrew_prefix
|
check_homebrew_prefix
|
||||||
check_for_macgpg2
|
check_for_macgpg2
|
||||||
check_for_stray_dylibs
|
check_for_stray_dylibs
|
||||||
check_gcc_versions
|
check_gcc_versions
|
||||||
check_cc_symlink
|
check_cc_symlink
|
||||||
check_for_other_package_managers
|
check_for_other_package_managers
|
||||||
check_for_x11
|
check_for_x11
|
||||||
check_for_nonstandard_x11
|
check_for_nonstandard_x11
|
||||||
check_access_share_locale
|
check_access_share_locale
|
||||||
check_access_share_man
|
check_access_share_man
|
||||||
check_access_include
|
check_access_include
|
||||||
check_access_etc
|
check_access_etc
|
||||||
check_user_path
|
check_user_path
|
||||||
check_which_pkg_config
|
check_which_pkg_config
|
||||||
check_pkg_config_paths
|
check_pkg_config_paths
|
||||||
check_access_pkgconfig
|
check_access_pkgconfig
|
||||||
check_for_gettext
|
check_for_gettext
|
||||||
check_for_config_scripts
|
check_for_config_scripts
|
||||||
check_for_dyld_vars
|
check_for_dyld_vars
|
||||||
check_for_other_vars
|
check_for_other_vars
|
||||||
check_for_symlinked_cellar
|
check_for_symlinked_cellar
|
||||||
check_for_multiple_volumes
|
check_for_multiple_volumes
|
||||||
check_for_git
|
check_for_git
|
||||||
check_for_autoconf
|
check_for_autoconf
|
||||||
check_for_linked_kegonly_brews
|
check_for_linked_kegonly_brews
|
||||||
|
|
||||||
exit! 0
|
exit! 0
|
||||||
else
|
|
||||||
write.close
|
|
||||||
|
|
||||||
unless (out = read.read).chomp.empty?
|
|
||||||
puts out
|
|
||||||
else
|
else
|
||||||
puts "Your OS X is ripe for brewing."
|
write.close
|
||||||
puts "Any troubles you may be experiencing are likely purely psychosomatic."
|
|
||||||
|
unless (out = read.read).chomp.empty?
|
||||||
|
puts out
|
||||||
|
else
|
||||||
|
puts "Your OS X is ripe for brewing."
|
||||||
|
puts "Any troubles you may be experiencing are likely purely psychosomatic."
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|||||||
@ -13,15 +13,17 @@ module Homebrew extend self
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_ppc
|
def check_ppc
|
||||||
case Hardware.cpu_type when :ppc, :dunno
|
case Hardware.cpu_type when :ppc, :dunno
|
||||||
abort "Sorry, Homebrew does not support your computer's CPU architecture.\n"+
|
abort <<-EOS.undent
|
||||||
"For PPC support, see: http://github.com/sceaga/homebrew/tree/powerpc"
|
Sorry, Homebrew does not support your computer's CPU architecture.
|
||||||
end
|
For PPC support, see: http://github.com/sceaga/homebrew/tree/powerpc
|
||||||
|
EOS
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_writable_install_location
|
def check_writable_install_location
|
||||||
raise "Cannot write to #{HOMEBREW_CELLAR}" if HOMEBREW_CELLAR.exist? and not HOMEBREW_CELLAR.writable?
|
raise "Cannot write to #{HOMEBREW_CELLAR}" if HOMEBREW_CELLAR.exist? and not HOMEBREW_CELLAR.writable?
|
||||||
raise "Cannot write to #{HOMEBREW_PREFIX}" unless HOMEBREW_PREFIX.writable?
|
raise "Cannot write to #{HOMEBREW_PREFIX}" unless HOMEBREW_PREFIX.writable?
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_cc
|
def check_cc
|
||||||
|
|||||||
@ -18,7 +18,7 @@ module HomebrewArgvExtension
|
|||||||
require 'keg'
|
require 'keg'
|
||||||
require 'formula'
|
require 'formula'
|
||||||
@kegs ||= downcased_unique_named.collect do |name|
|
@kegs ||= downcased_unique_named.collect do |name|
|
||||||
d = HOMEBREW_CELLAR + Formula.resolve_alias(name)
|
d = HOMEBREW_CELLAR/Formula.resolve_alias(name)
|
||||||
dirs = d.children.select{ |pn| pn.directory? } rescue []
|
dirs = d.children.select{ |pn| pn.directory? } rescue []
|
||||||
raise NoSuchKegError.new(name) if not d.directory? or dirs.length == 0
|
raise NoSuchKegError.new(name) if not d.directory? or dirs.length == 0
|
||||||
raise MultipleVersionsInstalledError.new(name) if dirs.length > 1
|
raise MultipleVersionsInstalledError.new(name) if dirs.length > 1
|
||||||
|
|||||||
@ -10,12 +10,12 @@ ARGV.extend(HomebrewArgvExtension)
|
|||||||
HOMEBREW_VERSION = '0.7.1'
|
HOMEBREW_VERSION = '0.7.1'
|
||||||
HOMEBREW_WWW = 'http://mxcl.github.com/homebrew/'
|
HOMEBREW_WWW = 'http://mxcl.github.com/homebrew/'
|
||||||
|
|
||||||
if Process.uid == 0
|
HOMEBREW_CACHE = if Process.uid == 0
|
||||||
# technically this is not the correct place, this cache is for *all users*
|
# technically this is not the correct place, this cache is for *all users*
|
||||||
# so in that case, maybe we should always use it, root or not?
|
# so in that case, maybe we should always use it, root or not?
|
||||||
HOMEBREW_CACHE=Pathname.new("/Library/Caches/Homebrew")
|
Pathname.new("/Library/Caches/Homebrew")
|
||||||
else
|
else
|
||||||
HOMEBREW_CACHE=Pathname.new("~/Library/Caches/Homebrew").expand_path
|
Pathname.new("~/Library/Caches/Homebrew").expand_path
|
||||||
end
|
end
|
||||||
|
|
||||||
if not defined? HOMEBREW_BREW_FILE
|
if not defined? HOMEBREW_BREW_FILE
|
||||||
@ -27,10 +27,10 @@ HOMEBREW_REPOSITORY = Pathname.new(HOMEBREW_BREW_FILE).realpath.dirname.parent #
|
|||||||
|
|
||||||
# Where we store built products; /usr/local/Cellar if it exists,
|
# Where we store built products; /usr/local/Cellar if it exists,
|
||||||
# otherwise a Cellar relative to the Repository.
|
# otherwise a Cellar relative to the Repository.
|
||||||
if (HOMEBREW_PREFIX+'Cellar').exist?
|
HOMEBREW_CELLAR = if (HOMEBREW_PREFIX/"Cellar").exist?
|
||||||
HOMEBREW_CELLAR = HOMEBREW_PREFIX+'Cellar'
|
HOMEBREW_PREFIX/"Cellar"
|
||||||
else
|
else
|
||||||
HOMEBREW_CELLAR = HOMEBREW_REPOSITORY+'Cellar'
|
HOMEBREW_REPOSITORY/"Cellar"
|
||||||
end
|
end
|
||||||
|
|
||||||
MACOS_FULL_VERSION = `/usr/bin/sw_vers -productVersion`.chomp
|
MACOS_FULL_VERSION = `/usr/bin/sw_vers -productVersion`.chomp
|
||||||
|
|||||||
@ -10,7 +10,7 @@ def text_for_keg_only_formula f
|
|||||||
rationale = "The formula didn't provide any rationale for this."
|
rationale = "The formula didn't provide any rationale for this."
|
||||||
end
|
end
|
||||||
<<-EOS
|
<<-EOS
|
||||||
This formula is keg-only, so it is not symlinked into Homebrew's prefix.
|
This formula is keg-only. This means it is not symlinked into #{HOMEBREW_PREFIX}.
|
||||||
#{rationale}
|
#{rationale}
|
||||||
|
|
||||||
Generally there are no consequences of this for you, however if you build
|
Generally there are no consequences of this for you, however if you build
|
||||||
@ -137,10 +137,10 @@ def install f
|
|||||||
show_summary_heading = true
|
show_summary_heading = true
|
||||||
else
|
else
|
||||||
# warn the user if stuff was installed outside of their PATH
|
# warn the user if stuff was installed outside of their PATH
|
||||||
paths = ENV['PATH'].split(':').collect{|p| File.expand_path p}
|
paths = ENV['PATH'].split(':').map{ |p| File.expand_path p }
|
||||||
[f.bin, f.sbin].each do |bin|
|
[f.bin, f.sbin].each do |bin|
|
||||||
if bin.directory?
|
if bin.directory?
|
||||||
rootbin = (HOMEBREW_PREFIX+bin.basename).to_s
|
rootbin = (HOMEBREW_PREFIX/bin.basename).to_s
|
||||||
bin = File.expand_path bin
|
bin = File.expand_path bin
|
||||||
unless paths.include? rootbin
|
unless paths.include? rootbin
|
||||||
opoo "#{rootbin} is not in your PATH"
|
opoo "#{rootbin} is not in your PATH"
|
||||||
@ -151,7 +151,7 @@ def install f
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Check for man pages that aren't in share/man
|
# Check for man pages that aren't in share/man
|
||||||
if (f.prefix+'man').exist?
|
if (f.prefix/:man).exist?
|
||||||
opoo 'A top-level "man" folder was found.'
|
opoo 'A top-level "man" folder was found.'
|
||||||
puts "Homebrew requires that man pages live under share."
|
puts "Homebrew requires that man pages live under share."
|
||||||
puts 'This can often be fixed by passing "--mandir=#{man}" to configure.'
|
puts 'This can often be fixed by passing "--mandir=#{man}" to configure.'
|
||||||
|
|||||||
@ -173,7 +173,7 @@ class BeerTasting < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_pathname_properties
|
def test_pathname_properties
|
||||||
foo1=HOMEBREW_CACHE+'foo-0.1.tar.gz'
|
foo1 = HOMEBREW_CACHE/'foo-0.1.tar.gz'
|
||||||
|
|
||||||
assert_equal '.tar.gz', foo1.extname
|
assert_equal '.tar.gz', foo1.extname
|
||||||
assert_equal 'foo-0.1', foo1.stem
|
assert_equal 'foo-0.1', foo1.stem
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
class Tty
|
class Tty
|
||||||
class <<self
|
class <<self
|
||||||
def blue; bold 34; end
|
def blue; bold 34; end
|
||||||
@ -41,6 +40,7 @@ def onoe error
|
|||||||
puts lines unless lines.empty?
|
puts lines unless lines.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def pretty_duration s
|
def pretty_duration s
|
||||||
return "2 seconds" if s < 3 # avoids the plural problem ;)
|
return "2 seconds" if s < 3 # avoids the plural problem ;)
|
||||||
return "#{s.to_i} seconds" if s < 120
|
return "#{s.to_i} seconds" if s < 120
|
||||||
@ -115,28 +115,25 @@ end
|
|||||||
def exec_editor *args
|
def exec_editor *args
|
||||||
editor = ENV['HOMEBREW_EDITOR'] || ENV['EDITOR']
|
editor = ENV['HOMEBREW_EDITOR'] || ENV['EDITOR']
|
||||||
if editor.nil?
|
if editor.nil?
|
||||||
if system "/usr/bin/which -s mate"
|
editor = if system "/usr/bin/which -s mate"
|
||||||
# TextMate
|
'mate'
|
||||||
editor='mate'
|
|
||||||
elsif system "/usr/bin/which -s edit"
|
elsif system "/usr/bin/which -s edit"
|
||||||
# BBEdit / TextWrangler
|
'edit' # BBEdit / TextWrangler
|
||||||
editor='edit'
|
|
||||||
else
|
else
|
||||||
# Default to vim
|
'/usr/bin/vim' # Default to vim
|
||||||
editor='/usr/bin/vim'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# we split the editor because especially on mac "mate -w" is common
|
# we split the editor because especially on mac "mate -w" is common
|
||||||
# but we still want to use the comma-delimited version of exec because then
|
# but we still want to use the comma-delimited version of exec because then
|
||||||
# we don't have to escape args, and escaping 100% is tricky
|
# we don't have to escape args, and escaping 100% is tricky
|
||||||
exec(*(editor.split+args))
|
exec *(editor.split + args) unless args.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
# GZips the given path, and returns the gzipped file
|
# GZips the given paths, and returns the gzipped paths
|
||||||
def gzip *paths
|
def gzip *paths
|
||||||
paths.collect do |path|
|
paths.collect do |path|
|
||||||
system "/usr/bin/gzip", path
|
system "/usr/bin/gzip", path
|
||||||
Pathname.new(path+".gz")
|
Pathname.new("#{path}.gz")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -242,9 +239,9 @@ module MacOS extend self
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def x11_installed?
|
def x11_installed?
|
||||||
Pathname.new('/usr/X11/lib/libpng.dylib').exist?
|
Pathname.new('/usr/X11/lib/libpng.dylib').exist?
|
||||||
end
|
end
|
||||||
|
|
||||||
def macports_or_fink_installed?
|
def macports_or_fink_installed?
|
||||||
# See these issues for some history:
|
# See these issues for some history:
|
||||||
|
|||||||
13
bin/brew
13
bin/brew
@ -8,7 +8,7 @@ Dir.getwd rescue abort "The current working directory doesn't exist, cannot proc
|
|||||||
HOMEBREW_BREW_FILE = ENV['HOMEBREW_BREW_FILE'] = File.expand_path(__FILE__)
|
HOMEBREW_BREW_FILE = ENV['HOMEBREW_BREW_FILE'] = File.expand_path(__FILE__)
|
||||||
|
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
HOMEBREW_LIBRARY_PATH = (Pathname.new(__FILE__).realpath.dirname.parent+"Library/Homebrew").to_s
|
HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.dirname.parent.join("Library/Homebrew").to_s
|
||||||
$:.unshift(HOMEBREW_LIBRARY_PATH)
|
$:.unshift(HOMEBREW_LIBRARY_PATH)
|
||||||
require 'global'
|
require 'global'
|
||||||
|
|
||||||
@ -35,7 +35,10 @@ case HOMEBREW_PREFIX.to_s when '/', '/usr'
|
|||||||
abort "Cowardly refusing to continue at this prefix: #{HOMEBREW_PREFIX}"
|
abort "Cowardly refusing to continue at this prefix: #{HOMEBREW_PREFIX}"
|
||||||
end
|
end
|
||||||
if MACOS_VERSION < 10.5
|
if MACOS_VERSION < 10.5
|
||||||
abort "Homebrew requires Leopard or higher. For Tiger support, see:\nhttp://github.com/sceaga/homebrew/tree/tiger"
|
abort <<-EOABORT.undent
|
||||||
|
Homebrew requires Leopard or higher. For Tiger support, see:
|
||||||
|
http://github.com/sceaga/homebrew/tree/tiger
|
||||||
|
EOABORT
|
||||||
end
|
end
|
||||||
|
|
||||||
def require? path
|
def require? path
|
||||||
@ -104,15 +107,13 @@ rescue BuildError => e
|
|||||||
formula_name = $1
|
formula_name = $1
|
||||||
error_line = $2
|
error_line = $2
|
||||||
|
|
||||||
puts "Exit status: #{e.exit_status}"
|
ohai "Exit Status: #{e.exit_status}"
|
||||||
puts
|
|
||||||
puts "http://github.com/mxcl/homebrew/blob/master/Library/Formula/#{formula_name}.rb#L#{error_line}"
|
puts "http://github.com/mxcl/homebrew/blob/master/Library/Formula/#{formula_name}.rb#L#{error_line}"
|
||||||
puts
|
|
||||||
ohai "Environment"
|
ohai "Environment"
|
||||||
puts Homebrew.config_s
|
puts Homebrew.config_s
|
||||||
puts
|
|
||||||
ohai "Build Flags"
|
ohai "Build Flags"
|
||||||
Homebrew.dump_build_env e.env
|
Homebrew.dump_build_env e.env
|
||||||
|
puts
|
||||||
onoe e
|
onoe e
|
||||||
puts PLEASE_REPORT_BUG
|
puts PLEASE_REPORT_BUG
|
||||||
# this feature can be slow (depends on network conditions and if github is up)
|
# this feature can be slow (depends on network conditions and if github is up)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user