remove several homebrew-fork files
* blacklist.rb * build_environment.rb * caveats.rb * cleaner.rb * language/go.rb * language/haskell.rb * language/python.rb * tab.rb
This commit is contained in:
parent
01816f96cc
commit
14526210e0
|
@ -1,99 +0,0 @@
|
|||
def blacklisted? name
|
||||
case name.downcase
|
||||
when 'screen', /^rubygems?$/ then <<-EOS.undent
|
||||
Apple distributes #{name} with OS X, you can find it in /usr/bin.
|
||||
EOS
|
||||
when 'libpcap' then <<-EOS.undent
|
||||
Apple distributes #{name} with OS X, you can find it in /usr/lib.
|
||||
EOS
|
||||
when 'libiconv' then <<-EOS.undent
|
||||
Apple distributes #{name} with OS X, you can find it in /usr/lib.
|
||||
Some build scripts fail to detect it correctly, please check existing
|
||||
formulae for solutions.
|
||||
EOS
|
||||
when 'tex', 'tex-live', 'texlive', 'latex' then <<-EOS.undent
|
||||
Installing TeX from source is weird and gross, requires a lot of patches,
|
||||
and only builds 32-bit (and thus can't use Homebrew deps on Snow Leopard.)
|
||||
|
||||
We recommend using a MacTeX distribution: http://www.tug.org/mactex/
|
||||
EOS
|
||||
when 'pip' then <<-EOS.undent
|
||||
Homebrew provides pip via: `brew install python`. However you will then
|
||||
have two Pythons installed on your Mac, so alternatively you can:
|
||||
sudo easy_install pip
|
||||
EOS
|
||||
when 'pil' then <<-EOS.undent
|
||||
Instead of PIL, consider `pip install pillow` or `brew install Homebrew/python/pillow`.
|
||||
EOS
|
||||
when 'macruby' then <<-EOS.undent
|
||||
MacRuby works better when you install their package:
|
||||
http://www.macruby.org/
|
||||
EOS
|
||||
when /(lib)?lzma/
|
||||
"lzma is now part of the xz formula."
|
||||
when 'xcode'
|
||||
if MacOS.version >= :lion
|
||||
<<-EOS.undent
|
||||
Xcode can be installed from the App Store.
|
||||
EOS
|
||||
else
|
||||
<<-EOS.undent
|
||||
Xcode can be installed from https://developer.apple.com/downloads/
|
||||
EOS
|
||||
end
|
||||
when 'gtest', 'googletest', 'google-test' then <<-EOS.undent
|
||||
Installing gtest system-wide is not recommended; it should be vendored
|
||||
in your projects that use it.
|
||||
EOS
|
||||
when 'gmock', 'googlemock', 'google-mock' then <<-EOS.undent
|
||||
Installing gmock system-wide is not recommended; it should be vendored
|
||||
in your projects that use it.
|
||||
EOS
|
||||
when 'sshpass' then <<-EOS.undent
|
||||
We won't add sshpass because it makes it too easy for novice SSH users to
|
||||
ruin SSH's security.
|
||||
EOS
|
||||
when 'gsutil' then <<-EOS.undent
|
||||
Install gsutil with `pip install gsutil`
|
||||
EOS
|
||||
when 'clojure' then <<-EOS.undent
|
||||
Clojure isn't really a program but a library managed as part of a
|
||||
project and Leiningen is the user interface to that library.
|
||||
|
||||
To install Clojure you should install Leiningen:
|
||||
brew install leiningen
|
||||
and then follow the tutorial:
|
||||
https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md
|
||||
EOS
|
||||
when 'rubinius' then <<-EOS.undent
|
||||
Rubinius requires an existing Ruby 2.0 to bootstrap.
|
||||
Doing this through Homebrew is error-prone. Instead, consider using
|
||||
`ruby-build` to build and install specific versions of Ruby:
|
||||
brew install ruby-build
|
||||
EOS
|
||||
when 'osmium' then <<-EOS.undent
|
||||
The creator of Osmium requests that it not be packaged and that people
|
||||
use the GitHub master branch instead.
|
||||
EOS
|
||||
when 'gfortran' then <<-EOS.undent
|
||||
GNU Fortran is now provided as part of GCC, and can be installed with:
|
||||
brew install gcc
|
||||
EOS
|
||||
when 'play' then <<-EOS.undent
|
||||
Play 2.3 replaces the play command with activator:
|
||||
brew install typesafe-activator
|
||||
|
||||
You can read more about this change at:
|
||||
http://www.playframework.com/documentation/2.3.x/Migration23
|
||||
http://www.playframework.com/documentation/2.3.x/Highlights23
|
||||
EOS
|
||||
when 'haskell-platform' then <<-EOS.undent
|
||||
We no longer package haskell-platform. Consider installing ghc
|
||||
and cabal-install instead:
|
||||
brew install ghc cabal-install
|
||||
|
||||
A binary installer is available:
|
||||
https://www.haskell.org/platform/mac.html
|
||||
EOS
|
||||
end
|
||||
end
|
|
@ -1,32 +0,0 @@
|
|||
require 'set'
|
||||
|
||||
class BuildEnvironment
|
||||
def initialize(*settings)
|
||||
@settings = Set.new(*settings)
|
||||
end
|
||||
|
||||
def merge(*args)
|
||||
@settings.merge(*args)
|
||||
self
|
||||
end
|
||||
|
||||
def <<(o)
|
||||
@settings << o
|
||||
self
|
||||
end
|
||||
|
||||
def std?
|
||||
@settings.include? :std
|
||||
end
|
||||
|
||||
def userpaths?
|
||||
@settings.include? :userpaths
|
||||
end
|
||||
end
|
||||
|
||||
module BuildEnvironmentDSL
|
||||
def env(*settings)
|
||||
@env ||= BuildEnvironment.new
|
||||
@env.merge(settings)
|
||||
end
|
||||
end
|
|
@ -1,132 +0,0 @@
|
|||
class Caveats
|
||||
attr_reader :f
|
||||
|
||||
def initialize(f)
|
||||
@f = f
|
||||
end
|
||||
|
||||
def caveats
|
||||
caveats = []
|
||||
caveats << f.caveats if f.caveats.to_s.length > 0
|
||||
caveats << f.keg_only_text if f.keg_only? && f.respond_to?(:keg_only_text)
|
||||
caveats << bash_completion_caveats
|
||||
caveats << zsh_completion_caveats
|
||||
caveats << plist_caveats
|
||||
caveats << python_caveats
|
||||
caveats << app_caveats
|
||||
caveats.compact.join("\n")
|
||||
end
|
||||
|
||||
def empty?
|
||||
caveats.empty?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def keg
|
||||
@keg ||= [f.prefix, f.opt_prefix, f.linked_keg].map do |d|
|
||||
Keg.new(d.resolved_path) rescue nil
|
||||
end.compact.first
|
||||
end
|
||||
|
||||
def bash_completion_caveats
|
||||
if keg and keg.completion_installed? :bash then <<-EOS.undent
|
||||
Bash completion has been installed to:
|
||||
#{HOMEBREW_PREFIX}/etc/bash_completion.d
|
||||
EOS
|
||||
end
|
||||
end
|
||||
|
||||
def zsh_completion_caveats
|
||||
if keg and keg.completion_installed? :zsh then <<-EOS.undent
|
||||
zsh completion has been installed to:
|
||||
#{HOMEBREW_PREFIX}/share/zsh/site-functions
|
||||
EOS
|
||||
end
|
||||
end
|
||||
|
||||
def python_caveats
|
||||
return unless keg
|
||||
return unless keg.python_site_packages_installed?
|
||||
return if Formula["python"].installed?
|
||||
site_packages = if f.keg_only?
|
||||
"#{f.opt_prefix}/lib/python2.7/site-packages"
|
||||
else
|
||||
"#{HOMEBREW_PREFIX}/lib/python2.7/site-packages"
|
||||
end
|
||||
dir = "~/Library/Python/2.7/lib/python/site-packages"
|
||||
dir_path = Pathname.new(dir).expand_path
|
||||
file = "#{dir}/homebrew.pth"
|
||||
file_path = Pathname.new(file).expand_path
|
||||
if !file_path.readable? || !file_path.read.include?(site_packages)
|
||||
s = "If you need Python to find the installed site-packages:\n"
|
||||
s += " mkdir -p #{dir}\n" unless dir_path.exist?
|
||||
s += " echo '#{site_packages}' > #{file}"
|
||||
end
|
||||
end
|
||||
|
||||
def app_caveats
|
||||
if keg and keg.app_installed?
|
||||
<<-EOS.undent
|
||||
.app bundles were installed.
|
||||
Run `brew linkapps` to symlink these to /Applications.
|
||||
EOS
|
||||
end
|
||||
end
|
||||
|
||||
def plist_caveats
|
||||
s = []
|
||||
if f.plist or (keg and keg.plist_installed?)
|
||||
destination = f.plist_startup ? '/Library/LaunchDaemons' \
|
||||
: '~/Library/LaunchAgents'
|
||||
|
||||
plist_filename = f.plist_path.basename
|
||||
plist_link = "#{destination}/#{plist_filename}"
|
||||
plist_domain = f.plist_path.basename('.plist')
|
||||
destination_path = Pathname.new File.expand_path destination
|
||||
plist_path = destination_path/plist_filename
|
||||
|
||||
# we readlink because this path probably doesn't exist since caveats
|
||||
# occurs before the link step of installation
|
||||
if !plist_path.file? || !plist_path.symlink?
|
||||
if f.plist_startup
|
||||
s << "To have launchd start #{f.name} at startup:"
|
||||
s << " sudo mkdir -p #{destination}" unless destination_path.directory?
|
||||
s << " sudo cp -fv #{f.opt_prefix}/*.plist #{destination}"
|
||||
else
|
||||
s << "To have launchd start #{f.name} at login:"
|
||||
s << " mkdir -p #{destination}" unless destination_path.directory?
|
||||
s << " ln -sfv #{f.opt_prefix}/*.plist #{destination}"
|
||||
end
|
||||
s << "Then to load #{f.name} now:"
|
||||
if f.plist_startup
|
||||
s << " sudo launchctl load #{plist_link}"
|
||||
else
|
||||
s << " launchctl load #{plist_link}"
|
||||
end
|
||||
# For startup plists, we cannot tell whether it's running on launchd,
|
||||
# as it requires for `sudo launchctl list` to get real result.
|
||||
elsif f.plist_startup
|
||||
s << "To reload #{f.name} after an upgrade:"
|
||||
s << " sudo launchctl unload #{plist_link}"
|
||||
s << " sudo cp -fv #{f.opt_prefix}/*.plist #{destination}"
|
||||
s << " sudo launchctl load #{plist_link}"
|
||||
elsif Kernel.system "/bin/launchctl list #{plist_domain} &>/dev/null"
|
||||
s << "To reload #{f.name} after an upgrade:"
|
||||
s << " launchctl unload #{plist_link}"
|
||||
s << " launchctl load #{plist_link}"
|
||||
else
|
||||
s << "To load #{f.name}:"
|
||||
s << " launchctl load #{plist_link}"
|
||||
end
|
||||
|
||||
if f.plist_manual
|
||||
s << "Or, if you don't want/need launchctl, you can just run:"
|
||||
s << " #{f.plist_manual}"
|
||||
end
|
||||
|
||||
s << "" << "WARNING: launchctl will fail when run under tmux." if ENV['TMUX']
|
||||
end
|
||||
s.join("\n") unless s.empty?
|
||||
end
|
||||
end
|
|
@ -1,107 +0,0 @@
|
|||
# Cleans a newly installed keg.
|
||||
# By default:
|
||||
# * removes .la files
|
||||
# * removes empty directories
|
||||
# * sets permissions on executables
|
||||
# * removes unresolved symlinks
|
||||
class Cleaner
|
||||
|
||||
# Create a cleaner for the given formula
|
||||
def initialize f
|
||||
@f = f
|
||||
end
|
||||
|
||||
# Clean the keg of formula @f
|
||||
def clean
|
||||
ObserverPathnameExtension.reset_counts!
|
||||
|
||||
# Many formulae include 'lib/charset.alias', but it is not strictly needed
|
||||
# and will conflict if more than one formula provides it
|
||||
observe_file_removal @f.lib/'charset.alias'
|
||||
|
||||
[@f.bin, @f.sbin, @f.lib].select{ |d| d.exist? }.each{ |d| clean_dir d }
|
||||
|
||||
# Get rid of any info 'dir' files, so they don't conflict at the link stage
|
||||
info_dir_file = @f.info + 'dir'
|
||||
if info_dir_file.file? and not @f.skip_clean? info_dir_file
|
||||
observe_file_removal info_dir_file
|
||||
end
|
||||
|
||||
prune
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def observe_file_removal path
|
||||
path.extend(ObserverPathnameExtension).unlink if path.exist?
|
||||
end
|
||||
|
||||
# Removes any empty directories in the formula's prefix subtree
|
||||
# Keeps any empty directions projected by skip_clean
|
||||
# Removes any unresolved symlinks
|
||||
def prune
|
||||
dirs = []
|
||||
symlinks = []
|
||||
@f.prefix.find do |path|
|
||||
if path == @f.libexec or @f.skip_clean?(path)
|
||||
Find.prune
|
||||
elsif path.symlink?
|
||||
symlinks << path
|
||||
elsif path.directory?
|
||||
dirs << path
|
||||
end
|
||||
end
|
||||
|
||||
# Remove directories opposite from traversal, so that a subtree with no
|
||||
# actual files gets removed correctly.
|
||||
dirs.reverse_each do |d|
|
||||
if d.children.empty?
|
||||
puts "rmdir: #{d} (empty)" if ARGV.verbose?
|
||||
d.rmdir
|
||||
end
|
||||
end
|
||||
|
||||
# Remove unresolved symlinks
|
||||
symlinks.reverse_each do |s|
|
||||
s.unlink unless s.resolved_path_exists?
|
||||
end
|
||||
end
|
||||
|
||||
# Clean a top-level (bin, sbin, lib) directory, recursively, by fixing file
|
||||
# permissions and removing .la files, unless the files (or parent
|
||||
# directories) are protected by skip_clean.
|
||||
#
|
||||
# bin and sbin should not have any subdirectories; if either do that is
|
||||
# caught as an audit warning
|
||||
#
|
||||
# lib may have a large directory tree (see Erlang for instance), and
|
||||
# clean_dir applies cleaning rules to the entire tree
|
||||
def clean_dir d
|
||||
d.find do |path|
|
||||
path.extend(ObserverPathnameExtension)
|
||||
|
||||
Find.prune if @f.skip_clean? path
|
||||
|
||||
if path.symlink? or path.directory?
|
||||
next
|
||||
elsif path.extname == '.la'
|
||||
path.unlink
|
||||
else
|
||||
# Set permissions for executables and non-executables
|
||||
perms = if path.mach_o_executable? || path.text_executable?
|
||||
0555
|
||||
else
|
||||
0444
|
||||
end
|
||||
if ARGV.debug?
|
||||
old_perms = path.stat.mode & 0777
|
||||
if perms != old_perms
|
||||
puts "Fixing #{path} permissions from #{old_perms.to_s(8)} to #{perms.to_s(8)}"
|
||||
end
|
||||
end
|
||||
path.chmod perms
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
require "resource"
|
||||
|
||||
module Language
|
||||
module Go
|
||||
# Given a set of resources, stages them to a gopath for
|
||||
# building go software.
|
||||
# The resource names should be the import name of the package,
|
||||
# e.g. `resource "github.com/foo/bar"`
|
||||
def self.stage_deps resources, target
|
||||
resources.grep(Resource::Go) { |resource| resource.stage(target) }
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,68 +0,0 @@
|
|||
module Language
|
||||
module Haskell
|
||||
# module for formulas using cabal-install as build tool
|
||||
module Cabal
|
||||
def cabal_sandbox
|
||||
pwd = Pathname.pwd
|
||||
# force cabal to put its stuff here instead of the home directory by
|
||||
# pretending the home is here. This also avoid to deal with many options
|
||||
# to configure cabal. Note this is also useful with cabal sandbox to
|
||||
# avoid touching ~/.cabal
|
||||
home = ENV["HOME"]
|
||||
ENV["HOME"] = pwd
|
||||
# use cabal's sandbox feature if available
|
||||
cabal_version = `cabal --version`[/[0-9.]+/].split('.').collect(&:to_i)
|
||||
if (cabal_version <=> [1, 20]) > -1
|
||||
system "cabal", "sandbox", "init"
|
||||
cabal_sandbox_bin = pwd/".cabal-sandbox/bin"
|
||||
else
|
||||
# no or broken sandbox feature - just use the HOME trick
|
||||
cabal_sandbox_bin = pwd/".cabal/bin"
|
||||
end
|
||||
# cabal may build useful tools that should be found in the PATH
|
||||
mkdir_p cabal_sandbox_bin
|
||||
path = ENV["PATH"]
|
||||
ENV.prepend_path 'PATH', cabal_sandbox_bin
|
||||
# update cabal package database
|
||||
system "cabal", "update"
|
||||
yield
|
||||
# restore the environment
|
||||
if (cabal_version <=> [1, 20]) > -1
|
||||
system "cabal", "sandbox", "delete"
|
||||
end
|
||||
ENV["HOME"] = home
|
||||
ENV["PATH"] = path
|
||||
end
|
||||
|
||||
def cabal_install(*opts)
|
||||
system "cabal", "install", "--jobs=#{ENV.make_jobs}", *opts
|
||||
end
|
||||
|
||||
# install the tools passed in parameter and remove the packages that where
|
||||
# used so they won't be in the way of the dependency solver for the main
|
||||
# package. The tools are installed sequentially in order to make possible
|
||||
# to install several tools that depends on each other
|
||||
def cabal_install_tools(*opts)
|
||||
opts.each {|t| cabal_install t}
|
||||
rm_rf Dir[".cabal*/*packages.conf.d/"]
|
||||
end
|
||||
|
||||
# remove the development files from the lib directory. cabal-install should
|
||||
# be used instead to install haskell packages
|
||||
def cabal_clean_lib
|
||||
# a better approach may be needed here
|
||||
rm_rf lib
|
||||
end
|
||||
|
||||
def install_cabal_package
|
||||
cabal_sandbox do
|
||||
# the dependencies are built first and installed locally, and only the
|
||||
# current package is actually installed in the destination dir
|
||||
cabal_install "--only-dependencies"
|
||||
cabal_install "--prefix=#{prefix}"
|
||||
end
|
||||
cabal_clean_lib
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
require "utils.rb"
|
||||
|
||||
module Language
|
||||
module Python
|
||||
def self.major_minor_version python
|
||||
version = /\d\.\d/.match `#{python} --version 2>&1`
|
||||
return unless version
|
||||
Version.new(version.to_s)
|
||||
end
|
||||
|
||||
def self.each_python build, &block
|
||||
original_pythonpath = ENV["PYTHONPATH"]
|
||||
["python", "python3"].each do |python|
|
||||
next if build.without? python
|
||||
version = self.major_minor_version python
|
||||
ENV["PYTHONPATH"] = if Formulary.factory(python).installed?
|
||||
nil
|
||||
else
|
||||
"#{HOMEBREW_PREFIX}/lib/python#{version}/site-packages"
|
||||
end
|
||||
block.call python, version if block
|
||||
end
|
||||
ENV["PYTHONPATH"] = original_pythonpath
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,135 +0,0 @@
|
|||
require 'ostruct'
|
||||
require 'options'
|
||||
require 'utils/json'
|
||||
|
||||
# Inherit from OpenStruct to gain a generic initialization method that takes a
|
||||
# hash and creates an attribute for each key and value. `Tab.new` probably
|
||||
# should not be called directly, instead use one of the class methods like
|
||||
# `Tab.create`.
|
||||
class Tab < OpenStruct
|
||||
FILENAME = 'INSTALL_RECEIPT.json'
|
||||
|
||||
def self.create(formula, compiler, stdlib, build)
|
||||
Tab.new :used_options => build.used_options.as_flags,
|
||||
:unused_options => build.unused_options.as_flags,
|
||||
:tabfile => formula.prefix.join(FILENAME),
|
||||
:tapped_from => formula.tap,
|
||||
:time => Time.now.to_i,
|
||||
:HEAD => Homebrew.git_head,
|
||||
:compiler => compiler,
|
||||
:stdlib => stdlib
|
||||
end
|
||||
|
||||
def self.from_file path
|
||||
attributes = Utils::JSON.load(File.read(path))
|
||||
attributes[:tabfile] = path
|
||||
new(attributes)
|
||||
end
|
||||
|
||||
def self.for_keg keg
|
||||
path = keg.join(FILENAME)
|
||||
|
||||
if path.exist?
|
||||
from_file(path)
|
||||
else
|
||||
dummy_tab
|
||||
end
|
||||
end
|
||||
|
||||
def self.for_name name
|
||||
for_formula(Formulary.factory(name))
|
||||
end
|
||||
|
||||
def self.for_formula f
|
||||
paths = []
|
||||
|
||||
if f.opt_prefix.symlink? && f.opt_prefix.directory?
|
||||
paths << f.opt_prefix.resolved_path
|
||||
end
|
||||
|
||||
if f.linked_keg.symlink? && f.linked_keg.directory?
|
||||
paths << f.linked_keg.resolved_path
|
||||
end
|
||||
|
||||
if f.rack.directory? && (dirs = f.rack.subdirs).length == 1
|
||||
paths << dirs.first
|
||||
end
|
||||
|
||||
paths << f.prefix
|
||||
|
||||
path = paths.map { |pn| pn.join(FILENAME) }.find(&:file?)
|
||||
|
||||
if path
|
||||
from_file(path)
|
||||
else
|
||||
dummy_tab(f)
|
||||
end
|
||||
end
|
||||
|
||||
def self.dummy_tab f=nil
|
||||
Tab.new :used_options => [],
|
||||
:unused_options => (f.options.as_flags rescue []),
|
||||
:tapped_from => "",
|
||||
:time => nil,
|
||||
:HEAD => nil,
|
||||
:stdlib => nil,
|
||||
:compiler => :clang
|
||||
end
|
||||
|
||||
def with? name
|
||||
include?("with-#{name}") || unused_options.include?("without-#{name}")
|
||||
end
|
||||
|
||||
def without? name
|
||||
not with? name
|
||||
end
|
||||
|
||||
def include? opt
|
||||
used_options.include? opt
|
||||
end
|
||||
|
||||
def universal?
|
||||
include?("universal")
|
||||
end
|
||||
|
||||
def cxx11?
|
||||
include?("c++11")
|
||||
end
|
||||
|
||||
def build_32_bit?
|
||||
include?("32-bit")
|
||||
end
|
||||
|
||||
def used_options
|
||||
Options.create(super)
|
||||
end
|
||||
|
||||
def unused_options
|
||||
Options.create(super)
|
||||
end
|
||||
|
||||
def to_json
|
||||
Utils::JSON.dump({
|
||||
:used_options => used_options.as_flags,
|
||||
:unused_options => unused_options.as_flags,
|
||||
:tapped_from => tapped_from,
|
||||
:time => time,
|
||||
:HEAD => self.HEAD,
|
||||
:stdlib => (stdlib.to_s if stdlib),
|
||||
:compiler => (compiler.to_s if compiler)})
|
||||
end
|
||||
|
||||
def write
|
||||
tabfile.atomic_write(to_json)
|
||||
end
|
||||
|
||||
def to_s
|
||||
s = []
|
||||
unless used_options.empty?
|
||||
s << "Installed" if s.empty?
|
||||
s << "with:"
|
||||
s << used_options.to_a.join(", ")
|
||||
end
|
||||
s.join(" ")
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue