Update deprecations and cleanup

- Move `odeprecated` to `odisabled`
- Remove `odisabled`
- Enable automatic cleanup on install/reinstall/upgrade.
This commit is contained in:
Mike McQuaid 2019-01-23 21:57:37 +00:00
parent 193af1442f
commit eed1444d61
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
35 changed files with 16 additions and 631 deletions

View File

@ -64,10 +64,10 @@ Metrics/LineLength:
IgnoredPatterns: ['#: '] IgnoredPatterns: ['#: ']
# we won't change backward compatible predicate names # we won't change backward compatible predicate names
# TODO: deprecate whitelisted names and move to compat
Naming/PredicateName: Naming/PredicateName:
Exclude: Exclude:
- 'compat/**/*' - 'compat/**/*'
# can't rename these
NameWhitelist: is_32_bit?, is_64_bit? NameWhitelist: is_32_bit?, is_64_bit?
# whitelist those that are standard # whitelist those that are standard

View File

@ -95,7 +95,7 @@ begin
end end
if ENV["HOMEBREW_BUILD_FROM_SOURCE"] if ENV["HOMEBREW_BUILD_FROM_SOURCE"]
odeprecated("HOMEBREW_BUILD_FROM_SOURCE", "--build-from-source") odisabled("HOMEBREW_BUILD_FROM_SOURCE", "--build-from-source")
end end
if internal_cmd if internal_cmd

View File

@ -41,7 +41,7 @@ module Homebrew
MACOSX_DEPLOYMENT_TARGET PKG_CONFIG_PATH PKG_CONFIG_LIBDIR MACOSX_DEPLOYMENT_TARGET PKG_CONFIG_PATH PKG_CONFIG_LIBDIR
HOMEBREW_DEBUG HOMEBREW_MAKE_JOBS HOMEBREW_VERBOSE HOMEBREW_DEBUG HOMEBREW_MAKE_JOBS HOMEBREW_VERBOSE
HOMEBREW_SVN HOMEBREW_GIT HOMEBREW_SVN HOMEBREW_GIT
HOMEBREW_SDKROOT HOMEBREW_BUILD_FROM_SOURCE HOMEBREW_SDKROOT
MAKE GIT CPP MAKE GIT CPP
ACLOCAL_PATH PATH CPATH ACLOCAL_PATH PATH CPATH
LD_LIBRARY_PATH LD_RUN_PATH LD_PRELOAD LIBRARY_PATH LD_LIBRARY_PATH LD_RUN_PATH LD_PRELOAD LIBRARY_PATH

View File

@ -158,7 +158,6 @@ module Homebrew
def self.install_formula_clean!(f) def self.install_formula_clean!(f)
return if ENV["HOMEBREW_NO_INSTALL_CLEANUP"] return if ENV["HOMEBREW_NO_INSTALL_CLEANUP"]
return unless ENV["HOMEBREW_INSTALL_CLEANUP"]
cleanup = Cleanup.new cleanup = Cleanup.new
if cleanup.periodic_clean_due? if cleanup.periodic_clean_due?
@ -170,7 +169,6 @@ module Homebrew
def periodic_clean_due? def periodic_clean_due?
return false if ENV["HOMEBREW_NO_INSTALL_CLEANUP"] return false if ENV["HOMEBREW_NO_INSTALL_CLEANUP"]
return unless ENV["HOMEBREW_INSTALL_CLEANUP"]
return true unless PERIODIC_CLEAN_FILE.exist? return true unless PERIODIC_CLEAN_FILE.exist?
PERIODIC_CLEAN_FILE.mtime < CLEANUP_DEFAULT_DAYS.days.ago PERIODIC_CLEAN_FILE.mtime < CLEANUP_DEFAULT_DAYS.days.ago

View File

@ -31,10 +31,6 @@
#: source even if a bottle is provided. Dependencies will still be installed #: source even if a bottle is provided. Dependencies will still be installed
#: from bottles if they are available. #: from bottles if they are available.
#: #:
#: If `HOMEBREW_BUILD_FROM_SOURCE` is set, regardless of whether `--build-from-source` was
#: passed, then both <formula> and the dependencies installed as part of this process
#: are built from source even if bottles are available.
#:
#: If `--force-bottle` is passed, install from a bottle if it exists for the #: If `--force-bottle` is passed, install from a bottle if it exists for the
#: current or newest version of macOS, even if it would not normally be used #: current or newest version of macOS, even if it would not normally be used
#: for installation. #: for installation.

View File

@ -25,7 +25,6 @@ module Homebrew
def prune def prune
prune_args.parse prune_args.parse
odeprecated("'brew prune'", "'brew cleanup'") odisabled("'brew prune'", "'brew cleanup'")
Cleanup.new(dry_run: args.dry_run?).prune_prefix_symlinks_and_directories
end end
end end

View File

@ -3,9 +3,6 @@
#: #:
#: If `--display-times` is passed, install times for each formula are printed #: If `--display-times` is passed, install times for each formula are printed
#: at the end of the run. #: at the end of the run.
#:
#: If `HOMEBREW_INSTALL_CLEANUP` is set then remove previously installed versions
#: of upgraded <formulae> as well as the HOMEBREW_CACHE for that formula.
require "formula_installer" require "formula_installer"
require "development_tools" require "development_tools"
@ -23,9 +20,6 @@ module Homebrew
`reinstall` [<option(s)>] <formula>: `reinstall` [<option(s)>] <formula>:
Uninstall and then install <formula> (with existing install options). Uninstall and then install <formula> (with existing install options).
If `HOMEBREW_INSTALL_CLEANUP` is set then remove previously installed versions
of upgraded <formulae> as well as the HOMEBREW_CACHE for that formula.
EOS EOS
switch "-s", "--build-from-source", switch "-s", "--build-from-source",
description: "Compile the formula> from source even if a bottle is available." description: "Compile the formula> from source even if a bottle is available."

View File

@ -28,13 +28,10 @@ module Homebrew
module_function module_function
def upgrade def upgrade
# TODO: deprecate for next minor release.
if ARGV.include?("--cleanup") if ARGV.include?("--cleanup")
ENV["HOMEBREW_INSTALL_CLEANUP"] = "1" odisabled("'brew upgrade --cleanup'")
odeprecated("'brew upgrade --cleanup'", "'HOMEBREW_INSTALL_CLEANUP'")
elsif ENV["HOMEBREW_UPGRADE_CLEANUP"] elsif ENV["HOMEBREW_UPGRADE_CLEANUP"]
ENV["HOMEBREW_INSTALL_CLEANUP"] = "1" odisabled("'HOMEBREW_UPGRADE_CLEANUP'")
odeprecated("'HOMEBREW_UPGRADE_CLEANUP'", "'HOMEBREW_INSTALL_CLEANUP'")
end end
FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed? FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed?

View File

@ -1,8 +1,2 @@
require "compat/extend/os/mac/utils/bottles"
require "compat/os/mac" require "compat/os/mac"
require "compat/requirements/x11_requirement"
require "compat/requirements/xcode_requirement"
require "compat/cask"
require "compat/download_strategy"
require "compat/formula" require "compat/formula"
require "compat/tap"

View File

@ -1,21 +0,0 @@
require "compat/cask/cache"
require "compat/cask/cask_loader"
require "compat/cask/caskroom"
require "compat/cask/dsl"
module Cask
class << self
module Compat
def init
Cache.delete_legacy_cache
Caskroom.migrate_caskroom_from_repo_to_prefix
Caskroom.migrate_legacy_caskroom
super
end
end
prepend Compat
end
end

View File

@ -1,17 +0,0 @@
module Cask
module Cache
class << self
module Compat
def delete_legacy_cache
legacy_cache = HOMEBREW_CACHE.join("Casks")
return unless legacy_cache.exist?
ohai "Deleting legacy cache at #{legacy_cache}"
FileUtils.remove_entry_secure(legacy_cache)
end
end
prepend Compat
end
end
end

View File

@ -1,24 +0,0 @@
module Cask
module CaskLoader
class FromContentLoader; end
class FromPathLoader < FromContentLoader
module Compat
private
# TODO: can't delete this code until the merge of
# https://github.com/Homebrew/brew/pull/4730 or an equivalent.
def cask(header_token, **options, &block)
if header_token.is_a?(Hash) && header_token.key?(:v1)
odisabled %q("cask :v1 => 'token'"), %q("cask 'token'")
header_token = header_token[:v1]
end
super(header_token, **options, &block)
end
end
prepend Compat
end
end
end

View File

@ -1,49 +0,0 @@
module Cask
module Caskroom
class << self
module Compat
def migrate_legacy_caskroom
return if path.exist?
legacy_caskroom_path = Pathname.new("/opt/homebrew-cask/Caskroom")
return if path == legacy_caskroom_path
return unless legacy_caskroom_path.exist?
return if legacy_caskroom_path.symlink?
ohai "Migrating Caskroom from #{legacy_caskroom_path} to #{path}."
if path.parent.writable?
FileUtils.mv legacy_caskroom_path, path
else
opoo "#{path.parent} is not writable, sudo is needed to move the Caskroom."
SystemCommand.run("/bin/mv", args: [legacy_caskroom_path, path.parent], sudo: true)
end
ohai "Creating symlink from #{path} to #{legacy_caskroom_path}."
if legacy_caskroom_path.parent.writable?
FileUtils.ln_s path, legacy_caskroom_path
else
opoo "#{legacy_caskroom_path.parent} is not writable, sudo is needed to link the Caskroom."
SystemCommand.run("/bin/ln", args: ["-s", path, legacy_caskroom_path], sudo: true)
end
end
def migrate_caskroom_from_repo_to_prefix
repo_caskroom_path = HOMEBREW_REPOSITORY.join("Caskroom")
return if path.exist?
return unless repo_caskroom_path.directory?
ohai "Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX"
if path.parent.writable?
FileUtils.mv repo_caskroom_path, path
else
opoo "#{path.parent} is not writable, sudo is needed to move the Caskroom."
SystemCommand.run("/bin/mv", args: [repo_caskroom_path, path.parent], sudo: true)
end
end
end
prepend Compat
end
end
end

View File

@ -1,22 +0,0 @@
module Cask
class DSL
module Compat
# TODO: can't delete this code until the merge of
# https://github.com/Homebrew/brew/pull/4730 or an equivalent.
def gpg(*)
odisabled "the `gpg` stanza"
end
def license(*)
odisabled "the `license` stanza"
end
def accessibility_access(*)
odisabled "the `accessibility_access` stanza"
end
end
prepend Compat
end
end

View File

@ -1,256 +0,0 @@
require "download_strategy"
# S3DownloadStrategy downloads tarballs from AWS S3.
# To use it, add `:using => :s3` to the URL section of your
# formula. This download strategy uses AWS access tokens (in the
# environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`)
# to sign the request. This strategy is good in a corporate setting,
# because it lets you use a private S3 bucket as a repo for internal
# distribution. (It will work for public buckets as well.)
class S3DownloadStrategy < CurlDownloadStrategy
def initialize(url, name, version, **meta)
odisabled("S3DownloadStrategy",
"a vendored S3DownloadStrategy in your own formula or tap (using require_relative)")
super
end
def _fetch(url:, resolved_url:)
if url !~ %r{^https?://([^.].*)\.s3\.amazonaws\.com/(.+)$} &&
url !~ %r{^s3://([^.].*?)/(.+)$}
raise "Bad S3 URL: " + url
end
bucket = Regexp.last_match(1)
key = Regexp.last_match(2)
ENV["AWS_ACCESS_KEY_ID"] = ENV["HOMEBREW_AWS_ACCESS_KEY_ID"]
ENV["AWS_SECRET_ACCESS_KEY"] = ENV["HOMEBREW_AWS_SECRET_ACCESS_KEY"]
begin
require "aws-sdk-s3"
rescue LoadError
Homebrew.install_gem! "aws-sdk-s3", "~> 1.8"
require "aws-sdk-s3"
end
begin
signer = Aws::S3::Presigner.new
s3url = signer.presigned_url :get_object, bucket: bucket, key: key
rescue Aws::Sigv4::Errors::MissingCredentialsError
ohai "AWS credentials missing, trying public URL instead."
s3url = url
end
curl_download s3url, to: temporary_path
end
end
# GitHubPrivateRepositoryDownloadStrategy downloads contents from GitHub
# Private Repository. To use it, add
# `:using => :github_private_repo` to the URL section of
# your formula. This download strategy uses GitHub access tokens (in the
# environment variables `HOMEBREW_GITHUB_API_TOKEN`) to sign the request. This
# strategy is suitable for corporate use just like S3DownloadStrategy, because
# it lets you use a private GitHub repository for internal distribution. It
# works with public one, but in that case simply use CurlDownloadStrategy.
class GitHubPrivateRepositoryDownloadStrategy < CurlDownloadStrategy
require "utils/formatter"
require "utils/github"
def initialize(url, name, version, **meta)
odisabled("GitHubPrivateRepositoryDownloadStrategy",
"a vendored GitHubPrivateRepositoryDownloadStrategy in your own formula or tap (using require_relative)")
super
parse_url_pattern
set_github_token
end
def parse_url_pattern
unless match = url.match(%r{https://github.com/([^/]+)/([^/]+)/(\S+)})
raise CurlDownloadStrategyError, "Invalid url pattern for GitHub Repository."
end
_, @owner, @repo, @filepath = *match
end
def download_url
"https://#{@github_token}@github.com/#{@owner}/#{@repo}/#{@filepath}"
end
private
def _fetch(url:, resolved_url:)
curl_download download_url, to: temporary_path
end
def set_github_token
@github_token = ENV["HOMEBREW_GITHUB_API_TOKEN"]
unless @github_token
raise CurlDownloadStrategyError, "Environmental variable HOMEBREW_GITHUB_API_TOKEN is required."
end
validate_github_repository_access!
end
def validate_github_repository_access!
# Test access to the repository
GitHub.repository(@owner, @repo)
rescue GitHub::HTTPNotFoundError
# We only handle HTTPNotFoundError here,
# becase AuthenticationFailedError is handled within util/github.
message = <<~EOS
HOMEBREW_GITHUB_API_TOKEN can not access the repository: #{@owner}/#{@repo}
This token may not have permission to access the repository or the url of formula may be incorrect.
EOS
raise CurlDownloadStrategyError, message
end
end
# GitHubPrivateRepositoryReleaseDownloadStrategy downloads tarballs from GitHub
# Release assets. To use it, add `:using => :github_private_release` to the URL section
# of your formula. This download strategy uses GitHub access tokens (in the
# environment variables HOMEBREW_GITHUB_API_TOKEN) to sign the request.
class GitHubPrivateRepositoryReleaseDownloadStrategy < GitHubPrivateRepositoryDownloadStrategy
def initialize(url, name, version, **meta)
odisabled("GitHubPrivateRepositoryReleaseDownloadStrategy",
"a vendored GitHubPrivateRepositoryReleaseDownloadStrategy in your own formula or tap (using require_relative)")
super
end
def parse_url_pattern
url_pattern = %r{https://github.com/([^/]+)/([^/]+)/releases/download/([^/]+)/(\S+)}
unless @url =~ url_pattern
raise CurlDownloadStrategyError, "Invalid url pattern for GitHub Release."
end
_, @owner, @repo, @tag, @filename = *@url.match(url_pattern)
end
def download_url
"https://#{@github_token}@api.github.com/repos/#{@owner}/#{@repo}/releases/assets/#{asset_id}"
end
private
def _fetch(url:, resolved_url:)
# HTTP request header `Accept: application/octet-stream` is required.
# Without this, the GitHub API will respond with metadata, not binary.
curl_download download_url, "--header", "Accept: application/octet-stream", to: temporary_path
end
def asset_id
@asset_id ||= resolve_asset_id
end
def resolve_asset_id
release_metadata = fetch_release_metadata
assets = release_metadata["assets"].select { |a| a["name"] == @filename }
raise CurlDownloadStrategyError, "Asset file not found." if assets.empty?
assets.first["id"]
end
def fetch_release_metadata
release_url = "https://api.github.com/repos/#{@owner}/#{@repo}/releases/tags/#{@tag}"
GitHub.open_api(release_url)
end
end
# ScpDownloadStrategy downloads files using ssh via scp. To use it, add
# `:using => :scp` to the URL section of your formula or
# provide a URL starting with scp://. This strategy uses ssh credentials for
# authentication. If a public/private keypair is configured, it will not
# prompt for a password.
#
# @example
# class Abc < Formula
# url "scp://example.com/src/abc.1.0.tar.gz"
# ...
class ScpDownloadStrategy < AbstractFileDownloadStrategy
def initialize(url, name, version, **meta)
odisabled("ScpDownloadStrategy",
"a vendored ScpDownloadStrategy in your own formula or tap (using require_relative)")
super
parse_url_pattern
end
def parse_url_pattern
url_pattern = %r{scp://([^@]+@)?([^@:/]+)(:\d+)?/(\S+)}
if @url !~ url_pattern
raise ScpDownloadStrategyError, "Invalid URL for scp: #{@url}"
end
_, @user, @host, @port, @path = *@url.match(url_pattern)
end
def fetch
ohai "Downloading #{@url}"
if cached_location.exist?
puts "Already downloaded: #{cached_location}"
else
system_command! "scp", args: [scp_source, temporary_path.to_s]
ignore_interrupts { temporary_path.rename(cached_location) }
end
end
def clear_cache
super
rm_rf(temporary_path)
end
private
def scp_source
path_prefix = "/" unless @path.start_with?("~")
port_arg = "-P #{@port[1..-1]} " if @port
"#{port_arg}#{@user}#{@host}:#{path_prefix}#{@path}"
end
end
class DownloadStrategyDetector
class << self
module Compat
def detect_from_url(url)
case url
when %r{^s3://}
odisabled("s3://",
"a vendored S3DownloadStrategy in your own formula or tap (using require_relative)")
S3DownloadStrategy
when %r{^scp://}
odisabled("scp://",
"a vendored ScpDownloadStrategy in your own formula or tap (using require_relative)")
ScpDownloadStrategy
else
super(url)
end
end
def detect_from_symbol(symbol)
case symbol
when :github_private_repo
odisabled(":github_private_repo",
"a vendored GitHubPrivateRepositoryDownloadStrategy in your own formula or tap (using require_relative)")
GitHubPrivateRepositoryDownloadStrategy
when :github_private_release
odisabled(":github_private_repo",
"a vendored GitHubPrivateRepositoryReleaseDownloadStrategy in your own formula or tap "\
"(using require_relative)")
GitHubPrivateRepositoryReleaseDownloadStrategy
when :s3
odisabled(":s3",
"a vendored S3DownloadStrategy in your own formula or tap (using require_relative)")
S3DownloadStrategy
when :scp
odisabled(":scp",
"a vendored ScpDownloadStrategy in your own formula or tap (using require_relative)")
ScpDownloadStrategy
else
super(symbol)
end
end
end
prepend Compat
end
end

View File

@ -1,19 +0,0 @@
module Utils
class Bottles
class Collector
module Compat
private
def tag_without_or_later(tag)
return super unless tag.to_s.end_with?("_or_later")
odisabled "`or_later` bottles",
"bottles without `or_later` (or_later is implied now)"
tag.to_s[/(\w+)_or_later$/, 1].to_sym
end
end
prepend Compat
end
end
end

View File

@ -2,40 +2,15 @@ class Formula
module Compat module Compat
# Run `scons` using a Homebrew-installed version rather than whatever is # Run `scons` using a Homebrew-installed version rather than whatever is
# in the `PATH`. # in the `PATH`.
# TODO: deprecate def scons(*)
def scons(*args) odisabled("scons", 'system "scons"')
odeprecated("scons", 'system "scons"')
system Formulary.factory("scons").opt_bin/"scons", *args
end end
# Run `make` 3.81 or newer. # Run `make` 3.81 or newer.
# Uses the system make on Leopard and newer, and the # Uses the system make on Leopard and newer, and the
# path to the actually-installed make on Tiger or older. # path to the actually-installed make on Tiger or older.
# TODO: deprecate def make(*)
def make(*args) odisabled("make", 'system "make"')
odeprecated("make", 'system "make"')
if Utils.popen_read("/usr/bin/make", "--version")
.match(/Make (\d\.\d+)/)[1] > "3.80"
make_path = "/usr/bin/make"
else
make = Formula["make"].opt_bin/"make"
make_path = if make.exist?
make.to_s
else
(Formula["make"].opt_bin/"gmake").to_s
end
end
if superenv?
make_name = File.basename(make_path)
with_env(HOMEBREW_MAKE: make_name) do
system "make", *args
end
else
system make_path, *args
end
end end
end end

View File

@ -3,7 +3,7 @@ module OS
class << self class << self
module Compat module Compat
def prefer_64_bit? def prefer_64_bit?
odeprecated("MacOS.prefer_64_bit?") odisabled("MacOS.prefer_64_bit?")
Hardware::CPU.is_64_bit? Hardware::CPU.is_64_bit?
end end
end end

View File

@ -1,15 +0,0 @@
require "requirement"
class X11Requirement < Requirement
module Compat
def initialize(tags = [])
if tags.first.to_s.match?(/(\d\.)+\d/)
odisabled('depends_on :x11 => "X.Y.Z"')
end
super(tags)
end
end
prepend Compat
end

View File

@ -1,21 +0,0 @@
require "requirement"
class XcodeRequirement < Requirement
module Compat
def initialize(tags = [])
@version = if tags.first.to_s.match?(/(\d\.)+\d/)
tags.shift
else
tags.find do |tag|
next unless tag.to_s.match?(/(\d\.)+\d/)
odisabled('depends_on :xcode => [..., "X.Y.Z"]')
tags.delete(tag)
end
end
super(tags)
end
end
prepend Compat
end

View File

@ -1,47 +0,0 @@
class Tap
module Compat
def initialize(user, repo)
super
return unless user == "caskroom"
old_initial_revision_var = "HOMEBREW_UPDATE_BEFORE#{repo_var}"
old_current_revision_var = "HOMEBREW_UPDATE_AFTER#{repo_var}"
new_user = "Homebrew"
new_repo = (repo == "cask") ? repo : "cask-#{repo}"
old_name = name
old_path = path
old_remote = path.git_origin
clear_cache
super(new_user, new_repo)
return unless old_path.directory?
new_initial_revision_var = "HOMEBREW_UPDATE_BEFORE#{repo_var}"
new_current_revision_var = "HOMEBREW_UPDATE_AFTER#{repo_var}"
ENV[new_initial_revision_var] ||= ENV[old_initial_revision_var]
ENV[new_current_revision_var] ||= ENV[old_current_revision_var]
new_name = name
new_path = path
new_remote = default_remote
ohai "Migrating tap #{old_name} to #{new_name}..." if $stdout.tty?
if old_path.git?
puts "Changing remote from #{old_remote} to #{new_remote}..." if $stdout.tty?
old_path.git_origin = new_remote
end
puts "Moving #{old_path} to #{new_path}..." if $stdout.tty?
path.dirname.mkpath
FileUtils.mv old_path, new_path
end
end
prepend Compat
end

View File

@ -61,7 +61,6 @@ module Homebrew
ENV.delete("HOMEBREW_NO_GITHUB_API") ENV.delete("HOMEBREW_NO_GITHUB_API")
ENV.delete("HOMEBREW_NO_EMOJI") ENV.delete("HOMEBREW_NO_EMOJI")
ENV.delete("HOMEBREW_DEVELOPER") ENV.delete("HOMEBREW_DEVELOPER")
ENV.delete("HOMEBREW_INSTALL_CLEANUP")
ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1" ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1"
ENV["HOMEBREW_NO_COMPAT"] = "1" if args.no_compat? ENV["HOMEBREW_NO_COMPAT"] = "1" if args.no_compat?
ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if args.generic? ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if args.generic?

View File

@ -115,15 +115,6 @@ module Homebrew
EOS EOS
end end
def check_build_from_source
return unless ENV["HOMEBREW_BUILD_FROM_SOURCE"]
<<~EOS
You have HOMEBREW_BUILD_FROM_SOURCE set.
#{please_create_pull_requests}
EOS
end
# Anaconda installs multiple system & brew dupes, including OpenSSL, Python, # Anaconda installs multiple system & brew dupes, including OpenSSL, Python,
# sqlite, libpng, Qt, etc. Regularly breaks compile on Vim, MacVim and others. # sqlite, libpng, Qt, etc. Regularly breaks compile on Vim, MacVim and others.
# Is flagged as part of the *-config script checks below, but people seem # Is flagged as part of the *-config script checks below, but people seem

View File

@ -219,15 +219,10 @@ module HomebrewArgvExtension
switch?("s") || include?("--build-from-source") switch?("s") || include?("--build-from-source")
end end
def build_all_from_source?
!ENV["HOMEBREW_BUILD_FROM_SOURCE"].nil?
end
# Whether a given formula should be built from source during the current # Whether a given formula should be built from source during the current
# installation run. # installation run.
def build_formula_from_source?(f) def build_formula_from_source?(f)
return true if build_all_from_source? return false if !build_from_source? && !build_bottle?
return false unless build_from_source? || build_bottle?
formulae.any? { |argv_f| argv_f.full_name == f.full_name } formulae.any? { |argv_f| argv_f.full_name == f.full_name }
end end

View File

@ -15,7 +15,6 @@ module Homebrew
def supported_configuration_checks def supported_configuration_checks
%w[ %w[
check_build_from_source
check_for_unsupported_macos check_for_unsupported_macos
].freeze ].freeze
end end

View File

@ -2510,7 +2510,7 @@ class Formula
# version '7.1' # version '7.1'
# end</pre> # end</pre>
def fails_with(compiler, &block) def fails_with(compiler, &block)
odeprecated "fails_with :gcc_4_0" if compiler == :gcc_4_0 odisabled "fails_with :gcc_4_0" if compiler == :gcc_4_0
specs.each { |spec| spec.fails_with(compiler, &block) } specs.each { |spec| spec.fails_with(compiler, &block) }
end end

View File

@ -46,7 +46,7 @@ class FormulaInstaller
@show_header = false @show_header = false
@ignore_deps = false @ignore_deps = false
@only_deps = false @only_deps = false
@build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source? @build_from_source = ARGV.build_from_source?
@build_bottle = false @build_bottle = false
@force_bottle = ARGV.force_bottle? @force_bottle = ARGV.force_bottle?
@include_test = ARGV.include?("--include-test") @include_test = ARGV.include?("--include-test")

View File

@ -192,16 +192,6 @@ Note that environment variables must have a value set to be detected. For exampl
*Default:* the beer emoji. *Default:* the beer emoji.
* `HOMEBREW_INSTALL_CLEANUP`:
If set, `brew install`, `brew upgrade` and `brew reinstall` will remove
previously installed version(s) of the installed/upgraded formulae.
If `brew cleanup` has not been run in 30 days then it will be run at this
time.
This will become the default in a later version of Homebrew. To opt-out see
`HOMEBREW_NO_INSTALL_CLEANUP`.
* `HOMEBREW_LOGS`: * `HOMEBREW_LOGS`:
If set, Homebrew will use the specified directory to store log files. If set, Homebrew will use the specified directory to store log files.

View File

@ -18,7 +18,6 @@ module OS
# Don't tell people to report issues on unsupported configurations. # Don't tell people to report issues on unsupported configurations.
if !OS::Mac.prerelease? && if !OS::Mac.prerelease? &&
!OS::Mac.outdated_release? && !OS::Mac.outdated_release? &&
!ENV["HOMEBREW_BUILD_FROM_SOURCE"] &&
ARGV.none? { |v| v.start_with?("--cc=") } && ARGV.none? { |v| v.start_with?("--cc=") } &&
ENV["HOMEBREW_PREFIX"] == "/usr/local" ENV["HOMEBREW_PREFIX"] == "/usr/local"
ISSUES_URL = "https://docs.brew.sh/Troubleshooting".freeze ISSUES_URL = "https://docs.brew.sh/Troubleshooting".freeze

View File

@ -208,7 +208,7 @@ class SoftwareSpec
end end
def fails_with(compiler, &block) def fails_with(compiler, &block)
odeprecated "fails_with :gcc_4_0" if compiler == :gcc_4_0 odisabled "fails_with :gcc_4_0" if compiler == :gcc_4_0
compiler_failures << CompilerFailure.create(compiler, &block) compiler_failures << CompilerFailure.create(compiler, &block)
end end

View File

@ -1,19 +1,10 @@
describe "brew upgrade", :integration_test do describe "brew upgrade", :integration_test do
it "upgrades a Formula to the latest version" do it "upgrades a Formula and cleans up old versions" do
setup_test_formula "testball" setup_test_formula "testball"
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
expect { brew "upgrade" }.to be_a_success expect { brew "upgrade" }.to be_a_success
expect(HOMEBREW_CELLAR/"testball/0.1").to be_a_directory
end
it "upgrades a Formula and cleans up old versions when `--cleanup` is passed" do
setup_test_formula "testball"
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
expect { brew "upgrade", "--cleanup" }.to be_a_success
expect(HOMEBREW_CELLAR/"testball/0.1").to be_a_directory expect(HOMEBREW_CELLAR/"testball/0.1").to be_a_directory
expect(HOMEBREW_CELLAR/"testball/0.0.1").not_to exist expect(HOMEBREW_CELLAR/"testball/0.0.1").not_to exist
end end

View File

@ -6,12 +6,6 @@ describe Homebrew::Diagnostic::Checks do
expect(subject.inject_file_list(%w[/a /b], "foo:\n")).to eq("foo:\n /a\n /b\n") expect(subject.inject_file_list(%w[/a /b], "foo:\n")).to eq("foo:\n /a\n /b\n")
end end
specify "#check_build_from_source" do
ENV["HOMEBREW_BUILD_FROM_SOURCE"] = "1"
expect(subject.check_build_from_source)
.to match("You have HOMEBREW_BUILD_FROM_SOURCE set.")
end
specify "#check_for_anaconda" do specify "#check_for_anaconda" do
mktmpdir do |path| mktmpdir do |path|
anaconda = "#{path}/anaconda" anaconda = "#{path}/anaconda"

View File

@ -90,8 +90,6 @@ following conditions:
will use a bottled version of the formula, but will use a bottled version of the formula, but
`brew install --enable-bar <formula>` will trigger a source build. `brew install --enable-bar <formula>` will trigger a source build.
* The `--build-from-source` option is invoked. * The `--build-from-source` option is invoked.
* The environment variable `HOMEBREW_BUILD_FROM_SOURCE` is set
(intended for developers only).
* The machine is not running a supported version of macOS as all * The machine is not running a supported version of macOS as all
bottled builds are generated only for supported macOS versions. bottled builds are generated only for supported macOS versions.
* Homebrew is installed to a prefix other than the standard * Homebrew is installed to a prefix other than the standard

View File

@ -269,10 +269,6 @@ these flags should only appear after a command.
source even if a bottle is provided. Dependencies will still be installed source even if a bottle is provided. Dependencies will still be installed
from bottles if they are available. from bottles if they are available.
If `HOMEBREW_BUILD_FROM_SOURCE` is set, regardless of whether `--build-from-source` was
passed, then both *`formula`* and the dependencies installed as part of this process
are built from source even if bottles are available.
If `--force-bottle` is passed, install from a bottle if it exists for the If `--force-bottle` is passed, install from a bottle if it exists for the
current or newest version of macOS, even if it would not normally be used current or newest version of macOS, even if it would not normally be used
for installation. for installation.
@ -424,9 +420,6 @@ these flags should only appear after a command.
If `--display-times` is passed, install times for each formula are printed If `--display-times` is passed, install times for each formula are printed
at the end of the run. at the end of the run.
If `HOMEBREW_INSTALL_CLEANUP` is set then remove previously installed versions
of upgraded *`formulae`* as well as the HOMEBREW_CACHE for that formula.
* `search`, `-S`: * `search`, `-S`:
Display all locally available formulae (including tapped ones). Display all locally available formulae (including tapped ones).
No online search is performed. No online search is performed.
@ -1185,16 +1178,6 @@ Note that environment variables must have a value set to be detected. For exampl
*Default:* the beer emoji. *Default:* the beer emoji.
* `HOMEBREW_INSTALL_CLEANUP`:
If set, `brew install`, `brew upgrade` and `brew reinstall` will remove
previously installed version(s) of the installed/upgraded formulae.
If `brew cleanup` has not been run in 30 days then it will be run at this
time.
This will become the default in a later version of Homebrew. To opt-out see
`HOMEBREW_NO_INSTALL_CLEANUP`.
* `HOMEBREW_LOGS`: * `HOMEBREW_LOGS`:
If set, Homebrew will use the specified directory to store log files. If set, Homebrew will use the specified directory to store log files.

View File

@ -276,9 +276,6 @@ If \fB\-\-cc=\fR\fIcompiler\fR is passed, attempt to compile using \fIcompiler\f
If \fB\-\-build\-from\-source\fR (or \fB\-s\fR) is passed, compile the specified \fIformula\fR from source even if a bottle is provided\. Dependencies will still be installed from bottles if they are available\. If \fB\-\-build\-from\-source\fR (or \fB\-s\fR) is passed, compile the specified \fIformula\fR from source even if a bottle is provided\. Dependencies will still be installed from bottles if they are available\.
. .
.IP .IP
If \fBHOMEBREW_BUILD_FROM_SOURCE\fR is set, regardless of whether \fB\-\-build\-from\-source\fR was passed, then both \fIformula\fR and the dependencies installed as part of this process are built from source even if bottles are available\.
.
.IP
If \fB\-\-force\-bottle\fR is passed, install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation\. If \fB\-\-force\-bottle\fR is passed, install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation\.
. .
.IP .IP
@ -435,9 +432,6 @@ Uninstall and then install \fIformula\fR (with existing install options)\.
.IP .IP
If \fB\-\-display\-times\fR is passed, install times for each formula are printed at the end of the run\. If \fB\-\-display\-times\fR is passed, install times for each formula are printed at the end of the run\.
. .
.IP
If \fBHOMEBREW_INSTALL_CLEANUP\fR is set then remove previously installed versions of upgraded \fIformulae\fR as well as the HOMEBREW_CACHE for that formula\.
.
.TP .TP
\fBsearch\fR, \fB\-S\fR \fBsearch\fR, \fB\-S\fR
Display all locally available formulae (including tapped ones)\. No online search is performed\. Display all locally available formulae (including tapped ones)\. No online search is performed\.
@ -1312,16 +1306,6 @@ Text printed before the installation summary of each successful build\.
\fIDefault:\fR the beer emoji\. \fIDefault:\fR the beer emoji\.
. .
.TP .TP
\fBHOMEBREW_INSTALL_CLEANUP\fR
If set, \fBbrew install\fR, \fBbrew upgrade\fR and \fBbrew reinstall\fR will remove previously installed version(s) of the installed/upgraded formulae\.
.
.IP
If \fBbrew cleanup\fR has not been run in 30 days then it will be run at this time\.
.
.IP
This will become the default in a later version of Homebrew\. To opt\-out see \fBHOMEBREW_NO_INSTALL_CLEANUP\fR\.
.
.TP
\fBHOMEBREW_LOGS\fR \fBHOMEBREW_LOGS\fR
If set, Homebrew will use the specified directory to store log files\. If set, Homebrew will use the specified directory to store log files\.
. .