Skip to content
Snippets Groups Projects
Unverified Commit 170c5493 authored by Mike McQuaid's avatar Mike McQuaid
Browse files

Update deprecations

- Add some `odeprecated`
- Make some `odeprecated` now `odisabled`
- Remove `odisabled` code.
- Remove old update migrations
- Remove GCC 4.0 compiler
- Remove Tiger-only code
- Remove 32-bit-only code
- Remove use of LD64
- Remove GCC 4.3 - 4.8 support.
parent 1b15ff14
No related branches found
No related tags found
No related merge requests found
Showing
with 102 additions and 202 deletions
......@@ -12,8 +12,6 @@ end
require_relative "global"
require "update_migrator"
begin
trap("INT", std_trap) # restore default CTRL-C handler
......@@ -77,14 +75,15 @@ begin
# `Homebrew.help` never returns, except for external/unknown commands.
end
# Migrate LinkedKegs/PinnedKegs if update didn't already do so
UpdateMigrator.migrate_legacy_keg_symlinks_if_necessary
# Uninstall old brew-cask if it's still around; we just use the tap now.
if cmd == "cask" && (HOMEBREW_CELLAR/"brew-cask").exist?
system(HOMEBREW_BREW_FILE, "uninstall", "--force", "brew-cask")
end
if ENV["HOMEBREW_BUILD_FROM_SOURCE"]
odeprecated("HOMEBREW_BUILD_FROM_SOURCE", "--build-from-source")
end
if internal_cmd
Homebrew.send cmd.to_s.tr("-", "_").downcase
elsif which "brew-#{cmd}"
......
......@@ -105,6 +105,18 @@ then
HOMEBREW_FORCE_BREWED_CURL="1"
fi
# Announce pre-Mavericks deprecation now
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "100900" ]]
then
printf "WARNING: Your version of macOS (%s) will not be able to run Homebrew when\n" "$HOMEBREW_MACOS_VERSION" >&2
printf " version 2.0.0 is released (Q1 2019)!\n" >&2
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "100700" ]]
then
printf " For 10.4 - 10.6 support see: https://github.com/mistydemeo/tigerbrew\n" >&2
fi
printf "\n" >&2
fi
# The system Git on macOS versions before Sierra is too old for some Homebrew functionality we rely on.
HOMEBREW_MINIMUM_GIT_VERSION="2.14.3"
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101200" ]]
......
......@@ -21,10 +21,9 @@
#:
#: If `--cc=`<compiler> is passed, attempt to compile using <compiler>.
#: <compiler> should be the name of the compiler's executable, for instance
#: `gcc-8` for gcc 8, `gcc-4.2` for Apple's GCC 4.2, or `gcc-4.9` for a
#: Homebrew-provided GCC 4.9. In order to use LLVM's clang, use
#: `llvm_clang`. To specify the Apple-provided clang, use `clang`. This
#: parameter will only accept compilers that are provided by Homebrew or
#: `gcc-7` for GCC 7. In order to use LLVM's clang, use `llvm_clang`.
#: To specify the Apple-provided clang, use `clang`.
#: This parameter will only accept compilers that are provided by Homebrew or
#: bundled with macOS. Please do not file issues if you encounter errors
#: while using this flag.
#:
......
......@@ -25,8 +25,7 @@ module Homebrew
def prune
prune_args.parse
# TODO: deprecate and hide from manpage for next minor release.
# odeprecated("'brew prune'", "'brew cleanup'")
odeprecated("'brew prune'", "'brew cleanup'")
Cleanup.new(dry_run: args.dry_run?).prune_prefix_symlinks_and_directories
end
end
......@@ -7,7 +7,6 @@ require "migrator"
require "formulary"
require "descriptions"
require "cleanup"
require "update_migrator"
require "description_cache_store"
module Homebrew
......@@ -83,13 +82,6 @@ module Homebrew
updated = true
end
out, _, status = system_command("git",
args: ["describe", "--tags", "--abbrev=0", initial_revision],
chdir: HOMEBREW_REPOSITORY,
print_stderr: false)
initial_version = Version.new(out) if status.success?
updated_taps = []
Tap.each do |tap|
next unless tap.git?
......@@ -112,11 +104,6 @@ module Homebrew
updated = true
end
UpdateMigrator.migrate_legacy_cache_if_necessary
UpdateMigrator.migrate_cache_entries_to_double_dashes(initial_version)
UpdateMigrator.migrate_cache_entries_to_symlinks(initial_version)
UpdateMigrator.migrate_legacy_keg_symlinks_if_necessary
if !updated
if !ARGV.include?("--preinstall") && !ENV["HOMEBREW_UPDATE_FAILED"]
puts "Already up-to-date."
......@@ -140,12 +127,6 @@ module Homebrew
Tap.each(&:link_completions_and_manpages)
Homebrew.failed = true if ENV["HOMEBREW_UPDATE_FAILED"]
# This should always be the last thing to run (but skip on auto-update).
if !ARGV.include?("--preinstall") ||
ENV["HOMEBREW_ENABLE_AUTO_UPDATE_MIGRATION"]
UpdateMigrator.migrate_legacy_repository_if_necessary
end
end
def shorten_revision(revision)
......
......@@ -66,39 +66,6 @@ git_init_if_necessary() {
fi
}
rename_taps_dir_if_necessary() {
local tap_dir
local tap_dir_basename
local tap_dir_hyphens
local user
local repo
for tap_dir in "$HOMEBREW_LIBRARY"/Taps/*
do
[[ -d "$tap_dir/.git" ]] || continue
tap_dir_basename="${tap_dir##*/}"
if [[ "$tap_dir_basename" = *"-"* ]]
then
# only replace the *last* dash: yes, tap filenames suck
user="$(echo "${tap_dir_basename%-*}" | tr "[:upper:]" "[:lower:]")"
repo="$(echo "${tap_dir_basename:${#user}+1}" | tr "[:upper:]" "[:lower:]")"
mkdir -p "$HOMEBREW_LIBRARY/Taps/$user"
mv "$tap_dir" "$HOMEBREW_LIBRARY/Taps/$user/homebrew-$repo"
tap_dir_hyphens="${tap_dir_basename//[^\-]}"
if [[ ${#tap_dir_hyphens} -gt 1 ]]
then
echo "Homebrew changed the structure of Taps like <someuser>/<sometap>." >&2
echo "So you may need to rename $HOMEBREW_LIBRARY/Taps/$user/homebrew-$repo manually." >&2
fi
else
echo "Homebrew changed the structure of Taps like <someuser>/<sometap>. " >&2
echo "$tap_dir is an incorrect Tap path." >&2
echo "So you may need to rename it to $HOMEBREW_LIBRARY/Taps/<someuser>/homebrew-<sometap> manually." >&2
fi
done
}
repo_var() {
local repo_var
......@@ -427,15 +394,12 @@ EOS
lock update
git_init_if_necessary
# rename Taps directories
# this procedure will be removed in the future if it seems unnecessary
rename_taps_dir_if_necessary
safe_cd "$HOMEBREW_REPOSITORY"
# if an older system had a newer curl installed, change each repo's remote URL from GIT to HTTPS
if [[ -n "$HOMEBREW_SYSTEM_CURL_TOO_OLD" &&
-x "$HOMEBREW_PREFIX/opt/curl/bin/curl" &&
-x "$HOMEBREW_PREFIX/opt/curl/bin/curl" &&
"$(git config remote.origin.url)" =~ ^git:// ]]
then
git config remote.origin.url "$BREW_OFFICIAL_REMOTE"
......
......@@ -31,10 +31,10 @@ module Homebrew
# TODO: deprecate for next minor release.
if ARGV.include?("--cleanup")
ENV["HOMEBREW_INSTALL_CLEANUP"] = "1"
# odeprecated("'brew upgrade --cleanup'", "'HOMEBREW_INSTALL_CLEANUP'")
odeprecated("'brew upgrade --cleanup'", "'HOMEBREW_INSTALL_CLEANUP'")
elsif ENV["HOMEBREW_UPGRADE_CLEANUP"]
ENV["HOMEBREW_INSTALL_CLEANUP"] = "1"
# odeprecated("'HOMEBREW_UPGRADE_CLEANUP'", "'HOMEBREW_INSTALL_CLEANUP'")
odeprecated("'HOMEBREW_UPGRADE_CLEANUP'", "'HOMEBREW_INSTALL_CLEANUP'")
end
FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed?
......
require "compat/extend/os/mac/utils/bottles"
require "compat/os/mac"
require "compat/requirements/x11_requirement"
require "compat/requirements/xcode_requirement"
require "compat/cask"
require "compat/download_strategy"
require "compat/fileutils"
require "compat/formula"
require "compat/tap"
require "compat/cask/cask_loader"
require "compat/cask/cmd/--version"
require "compat/cask/cmd/cleanup"
require "compat/cask/cmd/search"
require "compat/cask/cache"
require "compat/cask/cask_loader"
require "compat/cask/caskroom"
require "compat/cask/dsl"
......
require "cask/cmd/abstract_command"
require "cmd/--version"
module Cask
class Cmd
class Version < AbstractCommand
def self.command_name
"--#{super}"
end
def initialize(*)
super
return if args.empty?
raise ArgumentError, "#{self.class.command_name} does not take arguments."
end
def run
odisabled "`brew cask --version`", "`brew --version`"
end
def self.help
"displays the Homebrew Cask version"
end
def self.visible
false
end
end
end
end
require "cask/cmd/abstract_command"
require "cleanup"
using CleanupRefinement
module Cask
class Cmd
class Cleanup < AbstractCommand
def self.help
"cleans up cached downloads and tracker symlinks"
end
def self.visible
false
end
attr_reader :cache_location
def initialize(*args, cache_location: Cache.path)
super(*args)
@cache_location = Pathname.new(cache_location)
end
def run
odisabled "`brew cask cleanup`", "`brew cleanup`"
end
end
end
end
require "cask/cmd/abstract_command"
require "cmd/search"
module Cask
class Cmd
module Compat
class Search < AbstractCommand
def run
odisabled "`brew cask search`", "`brew search`"
end
def self.visible
false
end
end
end
prepend Compat
end
end
......@@ -9,7 +9,7 @@ require "download_strategy"
# distribution. (It will work for public buckets as well.)
class S3DownloadStrategy < CurlDownloadStrategy
def initialize(url, name, version, **meta)
odeprecated("S3DownloadStrategy",
odisabled("S3DownloadStrategy",
"a vendored S3DownloadStrategy in your own formula or tap (using require_relative)")
super
end
......@@ -58,7 +58,7 @@ class GitHubPrivateRepositoryDownloadStrategy < CurlDownloadStrategy
require "utils/github"
def initialize(url, name, version, **meta)
odeprecated("GitHubPrivateRepositoryDownloadStrategy",
odisabled("GitHubPrivateRepositoryDownloadStrategy",
"a vendored GitHubPrivateRepositoryDownloadStrategy in your own formula or tap (using require_relative)")
super
parse_url_pattern
......@@ -112,7 +112,7 @@ end
# environment variables HOMEBREW_GITHUB_API_TOKEN) to sign the request.
class GitHubPrivateRepositoryReleaseDownloadStrategy < GitHubPrivateRepositoryDownloadStrategy
def initialize(url, name, version, **meta)
odeprecated("GitHubPrivateRepositoryReleaseDownloadStrategy",
odisabled("GitHubPrivateRepositoryReleaseDownloadStrategy",
"a vendored GitHubPrivateRepositoryReleaseDownloadStrategy in your own formula or tap (using require_relative)")
super
end
......@@ -168,7 +168,7 @@ end
# ...
class ScpDownloadStrategy < AbstractFileDownloadStrategy
def initialize(url, name, version, **meta)
odeprecated("ScpDownloadStrategy",
odisabled("ScpDownloadStrategy",
"a vendored ScpDownloadStrategy in your own formula or tap (using require_relative)")
super
parse_url_pattern
......@@ -214,11 +214,11 @@ class DownloadStrategyDetector
def detect_from_url(url)
case url
when %r{^s3://}
odeprecated("s3://",
odisabled("s3://",
"a vendored S3DownloadStrategy in your own formula or tap (using require_relative)")
S3DownloadStrategy
when %r{^scp://}
odeprecated("scp://",
odisabled("scp://",
"a vendored ScpDownloadStrategy in your own formula or tap (using require_relative)")
ScpDownloadStrategy
else
......@@ -229,20 +229,20 @@ class DownloadStrategyDetector
def detect_from_symbol(symbol)
case symbol
when :github_private_repo
odeprecated(":github_private_repo",
odisabled(":github_private_repo",
"a vendored GitHubPrivateRepositoryDownloadStrategy in your own formula or tap (using require_relative)")
GitHubPrivateRepositoryDownloadStrategy
when :github_private_release
odeprecated(":github_private_repo",
odisabled(":github_private_repo",
"a vendored GitHubPrivateRepositoryReleaseDownloadStrategy in your own formula or tap "\
"(using require_relative)")
GitHubPrivateRepositoryReleaseDownloadStrategy
when :s3
odeprecated(":s3",
odisabled(":s3",
"a vendored S3DownloadStrategy in your own formula or tap (using require_relative)")
S3DownloadStrategy
when :scp
odeprecated(":scp",
odisabled(":scp",
"a vendored ScpDownloadStrategy in your own formula or tap (using require_relative)")
ScpDownloadStrategy
else
......
......@@ -7,7 +7,7 @@ module Utils
def tag_without_or_later(tag)
return super unless tag.to_s.end_with?("_or_later")
odeprecated "`or_later` bottles",
odisabled "`or_later` bottles",
"bottles without `or_later` (or_later is implied now)"
tag.to_s[/(\w+)_or_later$/, 1].to_sym
end
......
require "fileutils"
module FileUtils
module Compat
def ruby(*)
odisabled "ruby", 'system "ruby"'
end
def mktemp(*)
odisabled("FileUtils.mktemp", "mktemp")
end
module_function :mktemp
end
prepend Compat
end
class Formula
module Compat
# Run `scons` using a Homebrew-installed version rather than whatever is
# in the `PATH`.
# TODO: deprecate
def scons(*args)
odeprecated("scons", 'system "scons"')
system Formulary.factory("scons").opt_bin/"scons", *args
end
# Run `make` 3.81 or newer.
# Uses the system make on Leopard and newer, and the
# path to the actually-installed make on Tiger or older.
# TODO: deprecate
def make(*args)
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
prepend Compat
end
module OS
module Mac
module Compat
module_function
def prefer_64_bit?
odeprecated("MacOS.prefer_64_bit?")
Hardware::CPU.is_64_bit?
end
end
prepend Compat
end
end
......@@ -4,8 +4,7 @@ class X11Requirement < Requirement
module Compat
def initialize(tags = [])
if tags.first.to_s.match?(/(\d\.)+\d/)
odeprecated('depends_on :x11 => "X.Y.Z"')
tags.shift
odisabled('depends_on :x11 => "X.Y.Z"')
end
super(tags)
......
......@@ -8,7 +8,7 @@ class XcodeRequirement < Requirement
else
tags.find do |tag|
next unless tag.to_s.match?(/(\d\.)+\d/)
odeprecated('depends_on :xcode => [..., "X.Y.Z"]')
odisabled('depends_on :xcode => [..., "X.Y.Z"]')
tags.delete(tag)
end
end
......
# @private
module CompilerConstants
GNU_GCC_VERSIONS = %w[4.4 4.5 4.6 4.7 4.8 4.9 5 6 7 8].freeze
GNU_GCC_REGEXP = /^gcc-(4\.[4-9]|[5-8])$/.freeze
GNU_GCC_VERSIONS = %w[4.9 5 6 7 8].freeze
GNU_GCC_REGEXP = /^gcc-(4\.9|[5-8])$/.freeze
COMPILER_SYMBOL_MAP = {
"gcc" => :gcc,
"gcc-4.0" => :gcc_4_0,
"gcc-4.2" => :gcc_4_2,
"clang" => :clang,
"llvm_clang" => :llvm_clang,
......@@ -43,7 +42,7 @@ class CompilerFailure
if spec.is_a?(Hash)
_, major_version = spec.first
name = "gcc-#{major_version}"
# so fails_with :gcc => '4.8' simply marks all 4.8 releases incompatible
# so fails_with :gcc => '7' simply marks all 7 releases incompatible
version = "#{major_version}.999"
else
name = spec
......@@ -68,22 +67,12 @@ class CompilerFailure
COLLECTIONS = {
cxx11: [
create(:gcc_4_0),
create(:gcc_4_2),
create(:clang) { build 425 },
create(gcc: "4.4"),
create(gcc: "4.5"),
create(gcc: "4.6"),
],
cxx14: [
create(:clang) { build 600 },
create(:gcc_4_0),
create(:gcc_4_2),
create(gcc: "4.4"),
create(gcc: "4.5"),
create(gcc: "4.6"),
create(gcc: "4.7"),
create(gcc: "4.8"),
],
openmp: [
create(:clang),
......@@ -97,10 +86,9 @@ class CompilerSelector
Compiler = Struct.new(:name, :version)
COMPILER_PRIORITY = {
clang: [:clang, :gcc_4_2, :gnu, :gcc_4_0, :llvm_clang],
gcc_4_2: [:gcc_4_2, :gnu, :clang, :gcc_4_0],
gcc_4_0: [:gcc_4_0, :gcc_4_2, :gnu, :clang],
gcc: [:gnu, :gcc, :llvm_clang, :clang, :gcc_4_2, :gcc_4_0],
clang: [:clang, :gcc_4_2, :gnu, :llvm_clang],
gcc_4_2: [:gcc_4_2, :gnu, :clang],
gcc: [:gnu, :gcc, :llvm_clang, :clang, :gcc_4_2],
}.freeze
def self.select_for(formula, compilers = self.compilers)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment