Merge pull request #5477 from MikeMcQuaid/deprecations
Update deprecations
This commit is contained in:
commit
d9a9ceae70
@ -12,8 +12,6 @@ end
|
|||||||
|
|
||||||
require_relative "global"
|
require_relative "global"
|
||||||
|
|
||||||
require "update_migrator"
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
trap("INT", std_trap) # restore default CTRL-C handler
|
trap("INT", std_trap) # restore default CTRL-C handler
|
||||||
|
|
||||||
@ -77,14 +75,15 @@ begin
|
|||||||
# `Homebrew.help` never returns, except for external/unknown commands.
|
# `Homebrew.help` never returns, except for external/unknown commands.
|
||||||
end
|
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.
|
# Uninstall old brew-cask if it's still around; we just use the tap now.
|
||||||
if cmd == "cask" && (HOMEBREW_CELLAR/"brew-cask").exist?
|
if cmd == "cask" && (HOMEBREW_CELLAR/"brew-cask").exist?
|
||||||
system(HOMEBREW_BREW_FILE, "uninstall", "--force", "brew-cask")
|
system(HOMEBREW_BREW_FILE, "uninstall", "--force", "brew-cask")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if ENV["HOMEBREW_BUILD_FROM_SOURCE"]
|
||||||
|
odeprecated("HOMEBREW_BUILD_FROM_SOURCE", "--build-from-source")
|
||||||
|
end
|
||||||
|
|
||||||
if internal_cmd
|
if internal_cmd
|
||||||
Homebrew.send cmd.to_s.tr("-", "_").downcase
|
Homebrew.send cmd.to_s.tr("-", "_").downcase
|
||||||
elsif which "brew-#{cmd}"
|
elsif which "brew-#{cmd}"
|
||||||
|
@ -105,6 +105,18 @@ then
|
|||||||
HOMEBREW_FORCE_BREWED_CURL="1"
|
HOMEBREW_FORCE_BREWED_CURL="1"
|
||||||
fi
|
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.
|
# 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"
|
HOMEBREW_MINIMUM_GIT_VERSION="2.14.3"
|
||||||
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101200" ]]
|
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101200" ]]
|
||||||
|
@ -21,10 +21,9 @@
|
|||||||
#:
|
#:
|
||||||
#: If `--cc=`<compiler> is passed, attempt to compile using <compiler>.
|
#: If `--cc=`<compiler> is passed, attempt to compile using <compiler>.
|
||||||
#: <compiler> should be the name of the compiler's executable, for instance
|
#: <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
|
#: `gcc-7` for GCC 7. In order to use LLVM's clang, use `llvm_clang`.
|
||||||
#: Homebrew-provided GCC 4.9. In order to use LLVM's clang, use
|
#: To specify the Apple-provided clang, use `clang`.
|
||||||
#: `llvm_clang`. To specify the Apple-provided clang, use `clang`. This
|
#: This parameter will only accept compilers that are provided by Homebrew or
|
||||||
#: parameter will only accept compilers that are provided by Homebrew or
|
|
||||||
#: bundled with macOS. Please do not file issues if you encounter errors
|
#: bundled with macOS. Please do not file issues if you encounter errors
|
||||||
#: while using this flag.
|
#: while using this flag.
|
||||||
#:
|
#:
|
||||||
|
@ -25,8 +25,7 @@ module Homebrew
|
|||||||
def prune
|
def prune
|
||||||
prune_args.parse
|
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
|
Cleanup.new(dry_run: args.dry_run?).prune_prefix_symlinks_and_directories
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,6 @@ require "migrator"
|
|||||||
require "formulary"
|
require "formulary"
|
||||||
require "descriptions"
|
require "descriptions"
|
||||||
require "cleanup"
|
require "cleanup"
|
||||||
require "update_migrator"
|
|
||||||
require "description_cache_store"
|
require "description_cache_store"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
@ -83,13 +82,6 @@ module Homebrew
|
|||||||
updated = true
|
updated = true
|
||||||
end
|
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 = []
|
updated_taps = []
|
||||||
Tap.each do |tap|
|
Tap.each do |tap|
|
||||||
next unless tap.git?
|
next unless tap.git?
|
||||||
@ -112,11 +104,6 @@ module Homebrew
|
|||||||
updated = true
|
updated = true
|
||||||
end
|
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 !updated
|
||||||
if !ARGV.include?("--preinstall") && !ENV["HOMEBREW_UPDATE_FAILED"]
|
if !ARGV.include?("--preinstall") && !ENV["HOMEBREW_UPDATE_FAILED"]
|
||||||
puts "Already up-to-date."
|
puts "Already up-to-date."
|
||||||
@ -140,12 +127,6 @@ module Homebrew
|
|||||||
Tap.each(&:link_completions_and_manpages)
|
Tap.each(&:link_completions_and_manpages)
|
||||||
|
|
||||||
Homebrew.failed = true if ENV["HOMEBREW_UPDATE_FAILED"]
|
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
|
end
|
||||||
|
|
||||||
def shorten_revision(revision)
|
def shorten_revision(revision)
|
||||||
|
@ -66,39 +66,6 @@ git_init_if_necessary() {
|
|||||||
fi
|
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() {
|
repo_var() {
|
||||||
local repo_var
|
local repo_var
|
||||||
|
|
||||||
@ -427,9 +394,6 @@ EOS
|
|||||||
lock update
|
lock update
|
||||||
|
|
||||||
git_init_if_necessary
|
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"
|
safe_cd "$HOMEBREW_REPOSITORY"
|
||||||
|
|
||||||
|
@ -31,10 +31,10 @@ module Homebrew
|
|||||||
# TODO: deprecate for next minor release.
|
# TODO: deprecate for next minor release.
|
||||||
if ARGV.include?("--cleanup")
|
if ARGV.include?("--cleanup")
|
||||||
ENV["HOMEBREW_INSTALL_CLEANUP"] = "1"
|
ENV["HOMEBREW_INSTALL_CLEANUP"] = "1"
|
||||||
# odeprecated("'brew upgrade --cleanup'", "'HOMEBREW_INSTALL_CLEANUP'")
|
odeprecated("'brew upgrade --cleanup'", "'HOMEBREW_INSTALL_CLEANUP'")
|
||||||
elsif ENV["HOMEBREW_UPGRADE_CLEANUP"]
|
elsif ENV["HOMEBREW_UPGRADE_CLEANUP"]
|
||||||
ENV["HOMEBREW_INSTALL_CLEANUP"] = "1"
|
ENV["HOMEBREW_INSTALL_CLEANUP"] = "1"
|
||||||
# odeprecated("'HOMEBREW_UPGRADE_CLEANUP'", "'HOMEBREW_INSTALL_CLEANUP'")
|
odeprecated("'HOMEBREW_UPGRADE_CLEANUP'", "'HOMEBREW_INSTALL_CLEANUP'")
|
||||||
end
|
end
|
||||||
|
|
||||||
FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed?
|
FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed?
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
require "compat/extend/os/mac/utils/bottles"
|
require "compat/extend/os/mac/utils/bottles"
|
||||||
|
require "compat/os/mac"
|
||||||
require "compat/requirements/x11_requirement"
|
require "compat/requirements/x11_requirement"
|
||||||
require "compat/requirements/xcode_requirement"
|
require "compat/requirements/xcode_requirement"
|
||||||
require "compat/cask"
|
require "compat/cask"
|
||||||
require "compat/download_strategy"
|
require "compat/download_strategy"
|
||||||
require "compat/fileutils"
|
require "compat/formula"
|
||||||
require "compat/tap"
|
require "compat/tap"
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
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/cache"
|
||||||
|
require "compat/cask/cask_loader"
|
||||||
require "compat/cask/caskroom"
|
require "compat/cask/caskroom"
|
||||||
require "compat/cask/dsl"
|
require "compat/cask/dsl"
|
||||||
|
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
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
|
|
@ -1,29 +0,0 @@
|
|||||||
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
|
|
@ -1,20 +0,0 @@
|
|||||||
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.)
|
# distribution. (It will work for public buckets as well.)
|
||||||
class S3DownloadStrategy < CurlDownloadStrategy
|
class S3DownloadStrategy < CurlDownloadStrategy
|
||||||
def initialize(url, name, version, **meta)
|
def initialize(url, name, version, **meta)
|
||||||
odeprecated("S3DownloadStrategy",
|
odisabled("S3DownloadStrategy",
|
||||||
"a vendored S3DownloadStrategy in your own formula or tap (using require_relative)")
|
"a vendored S3DownloadStrategy in your own formula or tap (using require_relative)")
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
@ -58,7 +58,7 @@ class GitHubPrivateRepositoryDownloadStrategy < CurlDownloadStrategy
|
|||||||
require "utils/github"
|
require "utils/github"
|
||||||
|
|
||||||
def initialize(url, name, version, **meta)
|
def initialize(url, name, version, **meta)
|
||||||
odeprecated("GitHubPrivateRepositoryDownloadStrategy",
|
odisabled("GitHubPrivateRepositoryDownloadStrategy",
|
||||||
"a vendored GitHubPrivateRepositoryDownloadStrategy in your own formula or tap (using require_relative)")
|
"a vendored GitHubPrivateRepositoryDownloadStrategy in your own formula or tap (using require_relative)")
|
||||||
super
|
super
|
||||||
parse_url_pattern
|
parse_url_pattern
|
||||||
@ -112,7 +112,7 @@ end
|
|||||||
# environment variables HOMEBREW_GITHUB_API_TOKEN) to sign the request.
|
# environment variables HOMEBREW_GITHUB_API_TOKEN) to sign the request.
|
||||||
class GitHubPrivateRepositoryReleaseDownloadStrategy < GitHubPrivateRepositoryDownloadStrategy
|
class GitHubPrivateRepositoryReleaseDownloadStrategy < GitHubPrivateRepositoryDownloadStrategy
|
||||||
def initialize(url, name, version, **meta)
|
def initialize(url, name, version, **meta)
|
||||||
odeprecated("GitHubPrivateRepositoryReleaseDownloadStrategy",
|
odisabled("GitHubPrivateRepositoryReleaseDownloadStrategy",
|
||||||
"a vendored GitHubPrivateRepositoryReleaseDownloadStrategy in your own formula or tap (using require_relative)")
|
"a vendored GitHubPrivateRepositoryReleaseDownloadStrategy in your own formula or tap (using require_relative)")
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
@ -168,7 +168,7 @@ end
|
|||||||
# ...
|
# ...
|
||||||
class ScpDownloadStrategy < AbstractFileDownloadStrategy
|
class ScpDownloadStrategy < AbstractFileDownloadStrategy
|
||||||
def initialize(url, name, version, **meta)
|
def initialize(url, name, version, **meta)
|
||||||
odeprecated("ScpDownloadStrategy",
|
odisabled("ScpDownloadStrategy",
|
||||||
"a vendored ScpDownloadStrategy in your own formula or tap (using require_relative)")
|
"a vendored ScpDownloadStrategy in your own formula or tap (using require_relative)")
|
||||||
super
|
super
|
||||||
parse_url_pattern
|
parse_url_pattern
|
||||||
@ -214,11 +214,11 @@ class DownloadStrategyDetector
|
|||||||
def detect_from_url(url)
|
def detect_from_url(url)
|
||||||
case url
|
case url
|
||||||
when %r{^s3://}
|
when %r{^s3://}
|
||||||
odeprecated("s3://",
|
odisabled("s3://",
|
||||||
"a vendored S3DownloadStrategy in your own formula or tap (using require_relative)")
|
"a vendored S3DownloadStrategy in your own formula or tap (using require_relative)")
|
||||||
S3DownloadStrategy
|
S3DownloadStrategy
|
||||||
when %r{^scp://}
|
when %r{^scp://}
|
||||||
odeprecated("scp://",
|
odisabled("scp://",
|
||||||
"a vendored ScpDownloadStrategy in your own formula or tap (using require_relative)")
|
"a vendored ScpDownloadStrategy in your own formula or tap (using require_relative)")
|
||||||
ScpDownloadStrategy
|
ScpDownloadStrategy
|
||||||
else
|
else
|
||||||
@ -229,20 +229,20 @@ class DownloadStrategyDetector
|
|||||||
def detect_from_symbol(symbol)
|
def detect_from_symbol(symbol)
|
||||||
case symbol
|
case symbol
|
||||||
when :github_private_repo
|
when :github_private_repo
|
||||||
odeprecated(":github_private_repo",
|
odisabled(":github_private_repo",
|
||||||
"a vendored GitHubPrivateRepositoryDownloadStrategy in your own formula or tap (using require_relative)")
|
"a vendored GitHubPrivateRepositoryDownloadStrategy in your own formula or tap (using require_relative)")
|
||||||
GitHubPrivateRepositoryDownloadStrategy
|
GitHubPrivateRepositoryDownloadStrategy
|
||||||
when :github_private_release
|
when :github_private_release
|
||||||
odeprecated(":github_private_repo",
|
odisabled(":github_private_repo",
|
||||||
"a vendored GitHubPrivateRepositoryReleaseDownloadStrategy in your own formula or tap "\
|
"a vendored GitHubPrivateRepositoryReleaseDownloadStrategy in your own formula or tap "\
|
||||||
"(using require_relative)")
|
"(using require_relative)")
|
||||||
GitHubPrivateRepositoryReleaseDownloadStrategy
|
GitHubPrivateRepositoryReleaseDownloadStrategy
|
||||||
when :s3
|
when :s3
|
||||||
odeprecated(":s3",
|
odisabled(":s3",
|
||||||
"a vendored S3DownloadStrategy in your own formula or tap (using require_relative)")
|
"a vendored S3DownloadStrategy in your own formula or tap (using require_relative)")
|
||||||
S3DownloadStrategy
|
S3DownloadStrategy
|
||||||
when :scp
|
when :scp
|
||||||
odeprecated(":scp",
|
odisabled(":scp",
|
||||||
"a vendored ScpDownloadStrategy in your own formula or tap (using require_relative)")
|
"a vendored ScpDownloadStrategy in your own formula or tap (using require_relative)")
|
||||||
ScpDownloadStrategy
|
ScpDownloadStrategy
|
||||||
else
|
else
|
||||||
|
@ -7,7 +7,7 @@ module Utils
|
|||||||
def tag_without_or_later(tag)
|
def tag_without_or_later(tag)
|
||||||
return super unless tag.to_s.end_with?("_or_later")
|
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)"
|
"bottles without `or_later` (or_later is implied now)"
|
||||||
tag.to_s[/(\w+)_or_later$/, 1].to_sym
|
tag.to_s[/(\w+)_or_later$/, 1].to_sym
|
||||||
end
|
end
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
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
|
|
43
Library/Homebrew/compat/formula.rb
Normal file
43
Library/Homebrew/compat/formula.rb
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
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
|
14
Library/Homebrew/compat/os/mac.rb
Normal file
14
Library/Homebrew/compat/os/mac.rb
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
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
|
module Compat
|
||||||
def initialize(tags = [])
|
def initialize(tags = [])
|
||||||
if tags.first.to_s.match?(/(\d\.)+\d/)
|
if tags.first.to_s.match?(/(\d\.)+\d/)
|
||||||
odeprecated('depends_on :x11 => "X.Y.Z"')
|
odisabled('depends_on :x11 => "X.Y.Z"')
|
||||||
tags.shift
|
|
||||||
end
|
end
|
||||||
|
|
||||||
super(tags)
|
super(tags)
|
||||||
|
@ -8,7 +8,7 @@ class XcodeRequirement < Requirement
|
|||||||
else
|
else
|
||||||
tags.find do |tag|
|
tags.find do |tag|
|
||||||
next unless tag.to_s.match?(/(\d\.)+\d/)
|
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)
|
tags.delete(tag)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
# @private
|
# @private
|
||||||
module CompilerConstants
|
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_VERSIONS = %w[4.9 5 6 7 8].freeze
|
||||||
GNU_GCC_REGEXP = /^gcc-(4\.[4-9]|[5-8])$/.freeze
|
GNU_GCC_REGEXP = /^gcc-(4\.9|[5-8])$/.freeze
|
||||||
COMPILER_SYMBOL_MAP = {
|
COMPILER_SYMBOL_MAP = {
|
||||||
"gcc" => :gcc,
|
"gcc" => :gcc,
|
||||||
"gcc-4.0" => :gcc_4_0,
|
|
||||||
"gcc-4.2" => :gcc_4_2,
|
"gcc-4.2" => :gcc_4_2,
|
||||||
"clang" => :clang,
|
"clang" => :clang,
|
||||||
"llvm_clang" => :llvm_clang,
|
"llvm_clang" => :llvm_clang,
|
||||||
@ -43,7 +42,7 @@ class CompilerFailure
|
|||||||
if spec.is_a?(Hash)
|
if spec.is_a?(Hash)
|
||||||
_, major_version = spec.first
|
_, major_version = spec.first
|
||||||
name = "gcc-#{major_version}"
|
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"
|
version = "#{major_version}.999"
|
||||||
else
|
else
|
||||||
name = spec
|
name = spec
|
||||||
@ -68,22 +67,12 @@ class CompilerFailure
|
|||||||
|
|
||||||
COLLECTIONS = {
|
COLLECTIONS = {
|
||||||
cxx11: [
|
cxx11: [
|
||||||
create(:gcc_4_0),
|
|
||||||
create(:gcc_4_2),
|
create(:gcc_4_2),
|
||||||
create(:clang) { build 425 },
|
create(:clang) { build 425 },
|
||||||
create(gcc: "4.4"),
|
|
||||||
create(gcc: "4.5"),
|
|
||||||
create(gcc: "4.6"),
|
|
||||||
],
|
],
|
||||||
cxx14: [
|
cxx14: [
|
||||||
create(:clang) { build 600 },
|
create(:clang) { build 600 },
|
||||||
create(:gcc_4_0),
|
|
||||||
create(:gcc_4_2),
|
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: [
|
openmp: [
|
||||||
create(:clang),
|
create(:clang),
|
||||||
@ -97,10 +86,9 @@ class CompilerSelector
|
|||||||
Compiler = Struct.new(:name, :version)
|
Compiler = Struct.new(:name, :version)
|
||||||
|
|
||||||
COMPILER_PRIORITY = {
|
COMPILER_PRIORITY = {
|
||||||
clang: [:clang, :gcc_4_2, :gnu, :gcc_4_0, :llvm_clang],
|
clang: [:clang, :gcc_4_2, :gnu, :llvm_clang],
|
||||||
gcc_4_2: [:gcc_4_2, :gnu, :clang, :gcc_4_0],
|
gcc_4_2: [:gcc_4_2, :gnu, :clang],
|
||||||
gcc_4_0: [:gcc_4_0, :gcc_4_2, :gnu, :clang],
|
gcc: [:gnu, :gcc, :llvm_clang, :clang, :gcc_4_2],
|
||||||
gcc: [:gnu, :gcc, :llvm_clang, :clang, :gcc_4_2, :gcc_4_0],
|
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
def self.select_for(formula, compilers = self.compilers)
|
def self.select_for(formula, compilers = self.compilers)
|
||||||
|
@ -83,8 +83,6 @@ class DependencyCollector
|
|||||||
JavaRequirement.new(tags)
|
JavaRequirement.new(tags)
|
||||||
end
|
end
|
||||||
|
|
||||||
def ld64_dep_if_needed(*); end
|
|
||||||
|
|
||||||
def self.tar_needs_xz_dependency?
|
def self.tar_needs_xz_dependency?
|
||||||
!new.xz_dep_if_needed([]).nil?
|
!new.xz_dep_if_needed([]).nil?
|
||||||
end
|
end
|
||||||
@ -130,7 +128,6 @@ class DependencyCollector
|
|||||||
when :tuntap then TuntapRequirement.new(tags)
|
when :tuntap then TuntapRequirement.new(tags)
|
||||||
when :x11 then X11Requirement.new(tags)
|
when :x11 then X11Requirement.new(tags)
|
||||||
when :xcode then XcodeRequirement.new(tags)
|
when :xcode then XcodeRequirement.new(tags)
|
||||||
when :ld64 then ld64_dep_if_needed(tags)
|
|
||||||
else
|
else
|
||||||
raise ArgumentError, "Unsupported special dependency #{spec.inspect}"
|
raise ArgumentError, "Unsupported special dependency #{spec.inspect}"
|
||||||
end
|
end
|
||||||
|
@ -37,21 +37,10 @@ class DevelopmentTools
|
|||||||
:clang
|
:clang
|
||||||
end
|
end
|
||||||
|
|
||||||
def gcc_4_0_build_version
|
|
||||||
@gcc_4_0_build_version ||= begin
|
|
||||||
if (path = locate("gcc-4.0")) &&
|
|
||||||
build_version = `#{path} --version 2>/dev/null`[/build (\d{4,})/, 1]
|
|
||||||
Version.new build_version
|
|
||||||
else
|
|
||||||
Version::NULL
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def gcc_4_2_build_version
|
def gcc_4_2_build_version
|
||||||
@gcc_4_2_build_version ||= begin
|
@gcc_4_2_build_version ||= begin
|
||||||
gcc = locate("gcc-4.2") || HOMEBREW_PREFIX/"opt/apple-gcc42/bin/gcc-4.2"
|
if (gcc = locate("gcc-4.2")) &&
|
||||||
if gcc.exist? && !gcc.realpath.basename.to_s.start_with?("llvm") &&
|
!gcc.realpath.basename.to_s.start_with?("llvm") &&
|
||||||
build_version = `#{gcc} --version 2>/dev/null`[/build (\d{4,})/, 1]
|
build_version = `#{gcc} --version 2>/dev/null`[/build (\d{4,})/, 1]
|
||||||
Version.new build_version
|
Version.new build_version
|
||||||
else
|
else
|
||||||
@ -109,7 +98,7 @@ class DevelopmentTools
|
|||||||
end
|
end
|
||||||
|
|
||||||
def clear_version_cache
|
def clear_version_cache
|
||||||
@gcc_4_0_build_version = @gcc_4_2_build_version = nil
|
@gcc_4_2_build_version = nil
|
||||||
@clang_version = @clang_build_version = nil
|
@clang_version = @clang_build_version = nil
|
||||||
@non_apple_gcc_version = {}
|
@non_apple_gcc_version = {}
|
||||||
end
|
end
|
||||||
|
@ -266,14 +266,6 @@ module SharedEnvExtension
|
|||||||
set_cpu_flags(flags)
|
set_cpu_flags(flags)
|
||||||
end
|
end
|
||||||
|
|
||||||
# ld64 is a newer linker provided for Xcode 2.5
|
|
||||||
# @private
|
|
||||||
def ld64
|
|
||||||
ld64 = Formulary.factory("ld64")
|
|
||||||
self["LD"] = ld64.bin/"ld"
|
|
||||||
append "LDFLAGS", "-B#{ld64.bin}/"
|
|
||||||
end
|
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def effective_arch
|
def effective_arch
|
||||||
if ARGV.build_bottle? && ARGV.bottle_arch
|
if ARGV.build_bottle? && ARGV.bottle_arch
|
||||||
|
@ -100,11 +100,6 @@ module Stdenv
|
|||||||
dir/base.to_s.sub("gcc", "g++").sub("clang", "clang++")
|
dir/base.to_s.sub("gcc", "g++").sub("clang", "clang++")
|
||||||
end
|
end
|
||||||
|
|
||||||
def gcc_4_0
|
|
||||||
super
|
|
||||||
set_cpu_cflags
|
|
||||||
end
|
|
||||||
|
|
||||||
def gcc_4_2
|
def gcc_4_2
|
||||||
super
|
super
|
||||||
set_cpu_cflags
|
set_cpu_cflags
|
||||||
@ -126,21 +121,6 @@ module Stdenv
|
|||||||
set_cpu_cflags map
|
set_cpu_cflags map
|
||||||
end
|
end
|
||||||
|
|
||||||
def minimal_optimization
|
|
||||||
define_cflags "-Os #{SAFE_CFLAGS_FLAGS}"
|
|
||||||
end
|
|
||||||
alias generic_minimal_optimization minimal_optimization
|
|
||||||
|
|
||||||
def no_optimization
|
|
||||||
define_cflags SAFE_CFLAGS_FLAGS
|
|
||||||
end
|
|
||||||
alias generic_no_optimization no_optimization
|
|
||||||
|
|
||||||
# we've seen some packages fail to build when warnings are disabled!
|
|
||||||
def enable_warnings
|
|
||||||
remove_from_cflags "-w"
|
|
||||||
end
|
|
||||||
|
|
||||||
def m64
|
def m64
|
||||||
append_to_cflags "-m64"
|
append_to_cflags "-m64"
|
||||||
append "LDFLAGS", "-arch #{Hardware::CPU.arch_64_bit}"
|
append "LDFLAGS", "-arch #{Hardware::CPU.arch_64_bit}"
|
||||||
@ -208,7 +188,6 @@ module Stdenv
|
|||||||
append flags, xarch unless xarch.empty?
|
append flags, xarch unless xarch.empty?
|
||||||
append flags, map.fetch(effective_arch)
|
append flags, map.fetch(effective_arch)
|
||||||
end
|
end
|
||||||
alias generic_set_cpu_flags set_cpu_flags
|
|
||||||
|
|
||||||
def x11; end
|
def x11; end
|
||||||
|
|
||||||
|
@ -264,15 +264,6 @@ module Superenv
|
|||||||
check_for_compiler_universal_support
|
check_for_compiler_universal_support
|
||||||
|
|
||||||
self["HOMEBREW_ARCHFLAGS"] = Hardware::CPU.universal_archs.as_arch_flags
|
self["HOMEBREW_ARCHFLAGS"] = Hardware::CPU.universal_archs.as_arch_flags
|
||||||
|
|
||||||
# GCC doesn't accept "-march" for a 32-bit CPU with "-arch x86_64"
|
|
||||||
return if compiler_any_clang?
|
|
||||||
return unless Hardware::CPU.is_32_bit?
|
|
||||||
|
|
||||||
self["HOMEBREW_OPTFLAGS"] = self["HOMEBREW_OPTFLAGS"].sub(
|
|
||||||
/-march=\S*/,
|
|
||||||
"-Xarch_#{Hardware::CPU.arch_32_bit} \\0",
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def permit_arch_flags
|
def permit_arch_flags
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
require "os/mac/ld64_dependency"
|
|
||||||
|
|
||||||
class DependencyCollector
|
class DependencyCollector
|
||||||
undef git_dep_if_needed, subversion_dep_if_needed, cvs_dep_if_needed,
|
undef git_dep_if_needed, subversion_dep_if_needed, cvs_dep_if_needed,
|
||||||
xz_dep_if_needed, unzip_dep_if_needed, bzip2_dep_if_needed,
|
xz_dep_if_needed, unzip_dep_if_needed, bzip2_dep_if_needed
|
||||||
ld64_dep_if_needed
|
|
||||||
|
|
||||||
def git_dep_if_needed(tags)
|
def git_dep_if_needed(tags)
|
||||||
return if MacOS.version >= :lion
|
return if MacOS.version >= :lion
|
||||||
@ -28,11 +25,4 @@ class DependencyCollector
|
|||||||
def unzip_dep_if_needed(tags); end
|
def unzip_dep_if_needed(tags); end
|
||||||
|
|
||||||
def bzip2_dep_if_needed(tags); end
|
def bzip2_dep_if_needed(tags); end
|
||||||
|
|
||||||
def ld64_dep_if_needed(*)
|
|
||||||
# Tiger's ld is too old to properly link some software
|
|
||||||
return if MacOS.version > :tiger
|
|
||||||
|
|
||||||
LD64Dependency.new
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -11,7 +11,7 @@ class DevelopmentTools
|
|||||||
(@locate ||= {}).fetch(tool) do |key|
|
(@locate ||= {}).fetch(tool) do |key|
|
||||||
@locate[key] = if (located_tool = generic_locate(tool))
|
@locate[key] = if (located_tool = generic_locate(tool))
|
||||||
located_tool
|
located_tool
|
||||||
elsif MacOS.version > :tiger
|
else
|
||||||
path = Utils.popen_read("/usr/bin/xcrun", "-no-cache", "-find", tool, err: :close).chomp
|
path = Utils.popen_read("/usr/bin/xcrun", "-no-cache", "-find", tool, err: :close).chomp
|
||||||
Pathname.new(path) if File.executable?(path)
|
Pathname.new(path) if File.executable?(path)
|
||||||
end
|
end
|
||||||
@ -27,9 +27,6 @@ class DevelopmentTools
|
|||||||
|
|
||||||
def default_compiler
|
def default_compiler
|
||||||
case default_cc
|
case default_cc
|
||||||
# if GCC 4.2 is installed, e.g. via Tigerbrew, prefer it
|
|
||||||
# over the system's GCC 4.0
|
|
||||||
when /^gcc-4\.0/ then gcc_4_2_build_version ? :gcc_4_2 : :gcc_4_0
|
|
||||||
when /^gcc/ then :gcc_4_2
|
when /^gcc/ then :gcc_4_2
|
||||||
when "clang" then :clang
|
when "clang" then :clang
|
||||||
else
|
else
|
||||||
@ -75,26 +72,10 @@ class DevelopmentTools
|
|||||||
end
|
end
|
||||||
|
|
||||||
def custom_installation_instructions
|
def custom_installation_instructions
|
||||||
if MacOS.version > :leopard
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
Install GNU's GCC
|
Install GNU's GCC
|
||||||
brew install gcc
|
brew install gcc
|
||||||
EOS
|
EOS
|
||||||
elsif MacOS.version > :tiger
|
|
||||||
<<~EOS
|
|
||||||
Install GNU's GCC
|
|
||||||
brew install gcc@4.6
|
|
||||||
EOS
|
|
||||||
else
|
|
||||||
# Tiger doesn't ship with apple-gcc42, and this is required to build
|
|
||||||
# some software that doesn't build properly with FSF GCC.
|
|
||||||
<<~EOS
|
|
||||||
Install Apple's GCC
|
|
||||||
brew install apple-gcc42
|
|
||||||
or GNU's GCC
|
|
||||||
brew install gcc@4.6
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -54,36 +54,9 @@ module Stdenv
|
|||||||
|
|
||||||
# Leopard's ld needs some convincing that it's building 64-bit
|
# Leopard's ld needs some convincing that it's building 64-bit
|
||||||
# See: https://github.com/mistydemeo/tigerbrew/issues/59
|
# See: https://github.com/mistydemeo/tigerbrew/issues/59
|
||||||
return unless MacOS.version == :leopard && MacOS.prefer_64_bit?
|
return unless MacOS.version == :leopard
|
||||||
|
|
||||||
append "LDFLAGS", "-arch #{Hardware::CPU.arch_64_bit}"
|
append "LDFLAGS", "-arch #{Hardware::CPU.arch_64_bit}"
|
||||||
|
|
||||||
# Many, many builds are broken thanks to Leopard's buggy ld.
|
|
||||||
# Our ld64 fixes many of those builds, though of course we can't
|
|
||||||
# depend on it already being installed to build itself.
|
|
||||||
ld64 if Formula["ld64"].installed?
|
|
||||||
end
|
|
||||||
|
|
||||||
# Sets architecture-specific flags for every environment variable
|
|
||||||
# given in the list `flags`.
|
|
||||||
# @private
|
|
||||||
def set_cpu_flags(flags, map = Hardware::CPU.optimization_flags)
|
|
||||||
generic_set_cpu_flags(flags, map)
|
|
||||||
|
|
||||||
# Works around a buggy system header on Tiger
|
|
||||||
append flags, "-faltivec" if MacOS.version == :tiger
|
|
||||||
end
|
|
||||||
|
|
||||||
def minimal_optimization
|
|
||||||
generic_minimal_optimization
|
|
||||||
|
|
||||||
macosxsdk unless MacOS::CLT.installed?
|
|
||||||
end
|
|
||||||
|
|
||||||
def no_optimization
|
|
||||||
generic_no_optimization
|
|
||||||
|
|
||||||
macosxsdk unless MacOS::CLT.installed?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_macosxsdk(version = MacOS.version)
|
def remove_macosxsdk(version = MacOS.version)
|
||||||
|
@ -66,9 +66,7 @@ module Hardware
|
|||||||
when 11
|
when 11
|
||||||
:g4e # PowerPC 7450
|
:g4e # PowerPC 7450
|
||||||
when 100
|
when 100
|
||||||
# This is the only 64-bit PPC CPU type, so it's useful
|
:g5_64 # PowerPC 970
|
||||||
# to distinguish in `brew config` output and in bottle tags
|
|
||||||
MacOS.prefer_64_bit? ? :g5_64 : :g5 # PowerPC 970
|
|
||||||
else
|
else
|
||||||
:dunno
|
:dunno
|
||||||
end
|
end
|
||||||
@ -78,18 +76,12 @@ module Hardware
|
|||||||
# Returns an array that's been extended with ArchitectureListExtension,
|
# Returns an array that's been extended with ArchitectureListExtension,
|
||||||
# which provides helpers like #as_arch_flags and #as_cmake_arch_flags.
|
# which provides helpers like #as_arch_flags and #as_cmake_arch_flags.
|
||||||
def universal_archs
|
def universal_archs
|
||||||
# Building 64-bit is a no-go on Tiger, and pretty hit or miss on Leopard.
|
|
||||||
# Don't even try unless Tigerbrew's experimental 64-bit Leopard support is enabled.
|
|
||||||
if MacOS.version <= :leopard && !MacOS.prefer_64_bit?
|
|
||||||
[arch_32_bit].extend ArchitectureListExtension
|
|
||||||
else
|
|
||||||
# Amazingly, this order (64, then 32) matters. It shouldn't, but it
|
# Amazingly, this order (64, then 32) matters. It shouldn't, but it
|
||||||
# does. GCC (some versions? some systems?) can blow up if the other
|
# does. GCC (some versions? some systems?) can blow up if the other
|
||||||
# order is used.
|
# order is used.
|
||||||
# https://superuser.com/questions/740563/gcc-4-8-on-macos-fails-depending-on-arch-order
|
# https://superuser.com/questions/740563/gcc-4-8-on-macos-fails-depending-on-arch-order
|
||||||
[arch_64_bit, arch_32_bit].extend ArchitectureListExtension
|
[arch_64_bit, arch_32_bit].extend ArchitectureListExtension
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
# Determines whether the current CPU and macOS combination
|
# Determines whether the current CPU and macOS combination
|
||||||
# can run an executable of the specified architecture.
|
# can run an executable of the specified architecture.
|
||||||
|
@ -9,13 +9,7 @@ module Utils
|
|||||||
elsif MacOS.version == :snow_leopard
|
elsif MacOS.version == :snow_leopard
|
||||||
Hardware::CPU.is_64_bit? ? :snow_leopard : :snow_leopard_32
|
Hardware::CPU.is_64_bit? ? :snow_leopard : :snow_leopard_32
|
||||||
else
|
else
|
||||||
# Return, e.g., :tiger_g3, :leopard_g5_64, :leopard_64 (which is Intel)
|
"#{MacOS.cat}_64".to_sym
|
||||||
if Hardware::CPU.type == :ppc
|
|
||||||
tag = "#{MacOS.cat}_#{Hardware::CPU.family}".to_sym
|
|
||||||
else
|
|
||||||
tag = MacOS.cat
|
|
||||||
end
|
|
||||||
MacOS.prefer_64_bit? ? "#{tag}_64".to_sym : tag
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -27,21 +21,9 @@ module Utils
|
|||||||
|
|
||||||
def find_matching_tag(tag)
|
def find_matching_tag(tag)
|
||||||
generic_find_matching_tag(tag) ||
|
generic_find_matching_tag(tag) ||
|
||||||
find_altivec_tag(tag) ||
|
|
||||||
find_older_compatible_tag(tag)
|
find_older_compatible_tag(tag)
|
||||||
end
|
end
|
||||||
|
|
||||||
# This allows generic Altivec PPC bottles to be supported in some
|
|
||||||
# formulae, while also allowing specific bottles in others; e.g.,
|
|
||||||
# sometimes a formula has just :tiger_altivec, other times it has
|
|
||||||
# :tiger_g4, :tiger_g5, etc.
|
|
||||||
def find_altivec_tag(tag)
|
|
||||||
return unless tag.to_s =~ /(\w+)_(g4|g4e|g5)$/
|
|
||||||
|
|
||||||
altivec_tag = "#{Regexp.last_match(1)}_altivec".to_sym
|
|
||||||
altivec_tag if key?(altivec_tag)
|
|
||||||
end
|
|
||||||
|
|
||||||
def tag_without_or_later(tag)
|
def tag_without_or_later(tag)
|
||||||
tag
|
tag
|
||||||
end
|
end
|
||||||
|
@ -1983,38 +1983,6 @@ class Formula
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Run `scons` using a Homebrew-installed version rather than whatever is
|
|
||||||
# in the `PATH`.
|
|
||||||
def scons(*args)
|
|
||||||
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.
|
|
||||||
def make(*args)
|
|
||||||
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
|
|
||||||
|
|
||||||
# Run `xcodebuild` without Homebrew's compiler environment variables set.
|
# Run `xcodebuild` without Homebrew's compiler environment variables set.
|
||||||
def xcodebuild(*args)
|
def xcodebuild(*args)
|
||||||
removed = ENV.remove_cc_etc
|
removed = ENV.remove_cc_etc
|
||||||
@ -2388,7 +2356,6 @@ class Formula
|
|||||||
# depends_on :arch => :intel # If this formula only builds on Intel architecture.
|
# depends_on :arch => :intel # If this formula only builds on Intel architecture.
|
||||||
# depends_on :arch => :x86_64 # If this formula only builds on Intel x86 64-bit.
|
# depends_on :arch => :x86_64 # If this formula only builds on Intel x86 64-bit.
|
||||||
# depends_on :arch => :ppc # Only builds on PowerPC?
|
# depends_on :arch => :ppc # Only builds on PowerPC?
|
||||||
# depends_on :ld64 # Sometimes ld fails on `MacOS.version < :leopard`. Then use this.
|
|
||||||
# depends_on :x11 => :optional # X11/XQuartz components.
|
# depends_on :x11 => :optional # X11/XQuartz components.
|
||||||
# depends_on :osxfuse # Permits the use of the upstream signed binary or our source package.
|
# depends_on :osxfuse # Permits the use of the upstream signed binary or our source package.
|
||||||
# depends_on :tuntap # Does the same thing as above. This is vital for Yosemite and above.</pre>
|
# depends_on :tuntap # Does the same thing as above. This is vital for Yosemite and above.</pre>
|
||||||
@ -2532,17 +2499,18 @@ class Formula
|
|||||||
# if so, then the compiler will be blacklisted for *all* versions.
|
# if so, then the compiler will be blacklisted for *all* versions.
|
||||||
#
|
#
|
||||||
# `major_version` should be the major release number only, for instance
|
# `major_version` should be the major release number only, for instance
|
||||||
# '4.8' for the GCC 4.8 series (4.8.0, 4.8.1, etc.).
|
# '7' for the GCC 7 series (7.0, 7.1, etc.).
|
||||||
# If `version` or the block is omitted, then the compiler will be
|
# If `version` or the block is omitted, then the compiler will be
|
||||||
# blacklisted for all compilers in that series.
|
# blacklisted for all compilers in that series.
|
||||||
#
|
#
|
||||||
# For example, if a bug is only triggered on GCC 4.8.1 but is not
|
# For example, if a bug is only triggered on GCC 7.1 but is not
|
||||||
# encountered on 4.8.2:
|
# encountered on 7.2:
|
||||||
#
|
#
|
||||||
# <pre>fails_with :gcc => '4.8' do
|
# <pre>fails_with :gcc => '7' do
|
||||||
# version '4.8.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
|
||||||
specs.each { |spec| spec.fails_with(compiler, &block) }
|
specs.each { |spec| spec.fails_with(compiler, &block) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ module Homebrew
|
|||||||
module Install
|
module Install
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
def check_ppc
|
def check_cpu
|
||||||
case Hardware::CPU.type
|
case Hardware::CPU.type
|
||||||
when :ppc
|
when :ppc
|
||||||
abort <<~EOS
|
abort <<~EOS
|
||||||
@ -32,7 +32,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def perform_preinstall_checks
|
def perform_preinstall_checks
|
||||||
check_ppc
|
check_cpu
|
||||||
attempt_directory_creation
|
attempt_directory_creation
|
||||||
fatal_checks(:fatal_install_checks)
|
fatal_checks(:fatal_install_checks)
|
||||||
end
|
end
|
||||||
|
@ -140,12 +140,6 @@ Note that environment variables must have a value set to be detected. For exampl
|
|||||||
If set, Homebrew uses this setting as the browser when opening project
|
If set, Homebrew uses this setting as the browser when opening project
|
||||||
homepages, instead of the OS default browser.
|
homepages, instead of the OS default browser.
|
||||||
|
|
||||||
* `HOMEBREW_BUILD_FROM_SOURCE`:
|
|
||||||
If set, instructs Homebrew to compile from source even when a formula
|
|
||||||
provides a bottle. This environment variable is intended for use by
|
|
||||||
Homebrew developers. Please do not file issues if you encounter errors when
|
|
||||||
using this environment variable.
|
|
||||||
|
|
||||||
* `HOMEBREW_CACHE`:
|
* `HOMEBREW_CACHE`:
|
||||||
If set, instructs Homebrew to use the specified directory as the download cache.
|
If set, instructs Homebrew to use the specified directory as the download cache.
|
||||||
|
|
||||||
|
@ -7,10 +7,6 @@ module OS
|
|||||||
|
|
||||||
raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
||||||
|
|
||||||
def prefer_64_bit?
|
|
||||||
Hardware::CPU.is_64_bit?
|
|
||||||
end
|
|
||||||
|
|
||||||
def version
|
def version
|
||||||
Version::NULL
|
Version::NULL
|
||||||
end
|
end
|
||||||
|
@ -158,16 +158,8 @@ module OS
|
|||||||
paths.uniq
|
paths.uniq
|
||||||
end
|
end
|
||||||
|
|
||||||
def prefer_64_bit?
|
|
||||||
if ENV["HOMEBREW_PREFER_64_BIT"] && version == :leopard
|
|
||||||
Hardware::CPU.is_64_bit?
|
|
||||||
else
|
|
||||||
Hardware::CPU.is_64_bit? && version > :leopard
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def preferred_arch
|
def preferred_arch
|
||||||
if prefer_64_bit?
|
if Hardware::CPU.is_64_bit?
|
||||||
Hardware::CPU.arch_64_bit
|
Hardware::CPU.arch_64_bit
|
||||||
else
|
else
|
||||||
Hardware::CPU.arch_32_bit
|
Hardware::CPU.arch_32_bit
|
||||||
@ -175,13 +167,11 @@ module OS
|
|||||||
end
|
end
|
||||||
|
|
||||||
STANDARD_COMPILERS = {
|
STANDARD_COMPILERS = {
|
||||||
"2.0" => { gcc_4_0_build: 4061 },
|
"3.1.4" => { gcc_4_2_build: 5577 },
|
||||||
"2.5" => { gcc_4_0_build: 5370 },
|
"3.2.6" => { gcc_4_2_build: 5666, clang: "1.7", clang_build: 77 },
|
||||||
"3.1.4" => { gcc_4_0_build: 5493, gcc_4_2_build: 5577 },
|
"4.0" => { gcc_4_2_build: 5666, clang: "2.0", clang_build: 137 },
|
||||||
"3.2.6" => { gcc_4_0_build: 5494, gcc_4_2_build: 5666, clang: "1.7", clang_build: 77 },
|
"4.0.1" => { gcc_4_2_build: 5666, clang: "2.0", clang_build: 137 },
|
||||||
"4.0" => { gcc_4_0_build: 5494, gcc_4_2_build: 5666, clang: "2.0", clang_build: 137 },
|
"4.0.2" => { gcc_4_2_build: 5666, clang: "2.0", clang_build: 137 },
|
||||||
"4.0.1" => { gcc_4_0_build: 5494, gcc_4_2_build: 5666, clang: "2.0", clang_build: 137 },
|
|
||||||
"4.0.2" => { gcc_4_0_build: 5494, gcc_4_2_build: 5666, clang: "2.0", clang_build: 137 },
|
|
||||||
"4.2" => { clang: "3.0", clang_build: 211 },
|
"4.2" => { clang: "3.0", clang_build: 211 },
|
||||||
"4.3" => { clang: "3.1", clang_build: 318 },
|
"4.3" => { clang: "3.1", clang_build: 318 },
|
||||||
"4.3.1" => { clang: "3.1", clang_build: 318 },
|
"4.3.1" => { clang: "3.1", clang_build: 318 },
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
require "dependency"
|
|
||||||
|
|
||||||
# This special dependency ensures that the Tigerbrew ld64
|
|
||||||
# formula is used as gcc's ld in place of the old version
|
|
||||||
# that comes with the OS.
|
|
||||||
class LD64Dependency < Dependency
|
|
||||||
def initialize(name = "ld64", tags = [:build], env_proc = nil)
|
|
||||||
super
|
|
||||||
@env_proc = proc { ENV.ld64 }
|
|
||||||
end
|
|
||||||
end
|
|
@ -15,7 +15,6 @@ module OS
|
|||||||
snow_leopard: "10.6",
|
snow_leopard: "10.6",
|
||||||
leopard_64: "10.5",
|
leopard_64: "10.5",
|
||||||
leopard: "10.5",
|
leopard: "10.5",
|
||||||
tiger: "10.4",
|
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
def self.from_symbol(sym)
|
def self.from_symbol(sym)
|
||||||
|
@ -9,7 +9,6 @@ module OS
|
|||||||
|
|
||||||
def latest_version
|
def latest_version
|
||||||
case MacOS.version
|
case MacOS.version
|
||||||
when "10.4" then "2.5"
|
|
||||||
when "10.5" then "3.1.4"
|
when "10.5" then "3.1.4"
|
||||||
when "10.6" then "3.2.6"
|
when "10.6" then "3.2.6"
|
||||||
when "10.7" then "4.6.3"
|
when "10.7" then "4.6.3"
|
||||||
|
@ -92,7 +92,6 @@ module OS
|
|||||||
# educated guess as to what version is installed.
|
# educated guess as to what version is installed.
|
||||||
def guess_system_version
|
def guess_system_version
|
||||||
case MacOS.version
|
case MacOS.version
|
||||||
when "10.4" then "1.1.3"
|
|
||||||
when "10.5" then "2.1.6"
|
when "10.5" then "2.1.6"
|
||||||
when "10.6" then "2.3.6"
|
when "10.6" then "2.3.6"
|
||||||
when "10.7" then "2.6.3"
|
when "10.7" then "2.6.3"
|
||||||
|
@ -10,7 +10,7 @@ class ArchRequirement < Requirement
|
|||||||
|
|
||||||
satisfy(build_env: false) do
|
satisfy(build_env: false) do
|
||||||
case @arch
|
case @arch
|
||||||
when :x86_64 then MacOS.prefer_64_bit?
|
when :x86_64 then Hardware::CPU.is_64_bit?
|
||||||
when :intel, :ppc then Hardware::CPU.type == @arch
|
when :intel, :ppc then Hardware::CPU.type == @arch
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -312,8 +312,6 @@ module RuboCop
|
|||||||
end
|
end
|
||||||
|
|
||||||
find_method_with_args(body_node, :system, /^(otool|install_name_tool|lipo)/) do
|
find_method_with_args(body_node, :system, /^(otool|install_name_tool|lipo)/) do
|
||||||
next if @formula_name == "cctools"
|
|
||||||
|
|
||||||
problem "Use ruby-macho instead of calling #{@offensive_node.source}"
|
problem "Use ruby-macho instead of calling #{@offensive_node.source}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -1 +0,0 @@
|
|||||||
cc
|
|
@ -131,10 +131,6 @@ class SoftwareSpec
|
|||||||
|
|
||||||
def option(name, description = "")
|
def option(name, description = "")
|
||||||
opt = PREDEFINED_OPTIONS.fetch(name) do
|
opt = PREDEFINED_OPTIONS.fetch(name) do
|
||||||
if name.is_a?(Symbol)
|
|
||||||
odisabled "passing arbitrary symbols (i.e. #{name.inspect}) to `option`"
|
|
||||||
end
|
|
||||||
|
|
||||||
unless name.is_a?(String)
|
unless name.is_a?(String)
|
||||||
raise ArgumentError, "option name must be string or symbol; got a #{name.class}: #{name}"
|
raise ArgumentError, "option name must be string or symbol; got a #{name.class}: #{name}"
|
||||||
end
|
end
|
||||||
@ -212,6 +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
|
||||||
compiler_failures << CompilerFailure.create(compiler, &block)
|
compiler_failures << CompilerFailure.create(compiler, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ shared_examples EnvActivation do
|
|||||||
|
|
||||||
describe "#compiler" do
|
describe "#compiler" do
|
||||||
it "allows switching compilers" do
|
it "allows switching compilers" do
|
||||||
[:clang, :gcc_4_2, :gcc_4_0].each do |compiler|
|
[:clang, :gcc_4_2].each do |compiler|
|
||||||
subject.public_send(compiler)
|
subject.public_send(compiler)
|
||||||
expect(subject.compiler).to eq(compiler)
|
expect(subject.compiler).to eq(compiler)
|
||||||
end
|
end
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
describe "brew prune", :integration_test do
|
|
||||||
it "removes empty directories and broken symlinks" do
|
|
||||||
share = (HOMEBREW_PREFIX/"share")
|
|
||||||
|
|
||||||
(share/"pruneable/directory/here").mkpath
|
|
||||||
(share/"notpruneable/file").write "I'm here"
|
|
||||||
FileUtils.ln_s "/i/dont/exist/no/really/i/dont", share/"pruneable_symlink"
|
|
||||||
|
|
||||||
expect { brew "prune", "--dry-run" }
|
|
||||||
.to output(%r{Would remove \(empty directory\): .*/pruneable/directory/here}).to_stdout
|
|
||||||
.and not_to_output.to_stderr
|
|
||||||
.and be_a_success
|
|
||||||
|
|
||||||
expect { brew "prune" }
|
|
||||||
.to output(/Pruned 1 symbolic links and 3 directories/).to_stdout
|
|
||||||
.and not_to_output.to_stderr
|
|
||||||
.and be_a_success
|
|
||||||
|
|
||||||
expect(share/"pruneable").not_to be_a_directory
|
|
||||||
expect(share/"notpruneable").to be_a_directory
|
|
||||||
expect(share/"pruneable_symlink").not_to be_a_symlink
|
|
||||||
end
|
|
||||||
end
|
|
@ -21,17 +21,17 @@ describe CompilerFailure do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "creates a failure when given a hash" do
|
it "creates a failure when given a hash" do
|
||||||
failure = described_class.create(gcc: "4.8")
|
failure = described_class.create(gcc: "7")
|
||||||
expect(failure).to fail_with(double("Compiler", name: "gcc-4.8", version: "4.8"))
|
expect(failure).to fail_with(double("Compiler", name: "gcc-7", version: "7"))
|
||||||
expect(failure).to fail_with(double("Compiler", name: "gcc-4.8", version: "4.8.1"))
|
expect(failure).to fail_with(double("Compiler", name: "gcc-7", version: "7.1"))
|
||||||
expect(failure).not_to fail_with(double("Compiler", name: "gcc-4.7", version: "4.7"))
|
expect(failure).not_to fail_with(double("Compiler", name: "gcc-6", version: "6.0"))
|
||||||
end
|
end
|
||||||
|
|
||||||
it "creates a failure when given a hash and a block with aversion" do
|
it "creates a failure when given a hash and a block with aversion" do
|
||||||
failure = described_class.create(gcc: "4.8") { version "4.8.1" }
|
failure = described_class.create(gcc: "7") { version "7.1" }
|
||||||
expect(failure).to fail_with(double("Compiler", name: "gcc-4.8", version: "4.8"))
|
expect(failure).to fail_with(double("Compiler", name: "gcc-7", version: "7"))
|
||||||
expect(failure).to fail_with(double("Compiler", name: "gcc-4.8", version: "4.8.1"))
|
expect(failure).to fail_with(double("Compiler", name: "gcc-7", version: "7.1"))
|
||||||
expect(failure).not_to fail_with(double("Compiler", name: "gcc-4.8", version: "4.8.2"))
|
expect(failure).not_to fail_with(double("Compiler", name: "gcc-7", version: "7.2"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,6 @@ describe CompilerSelector do
|
|||||||
let(:cc) { :clang }
|
let(:cc) { :clang }
|
||||||
let(:versions) do
|
let(:versions) do
|
||||||
double(
|
double(
|
||||||
gcc_4_0_build_version: Version::NULL,
|
|
||||||
gcc_4_2_build_version: Version.create("5666"),
|
gcc_4_2_build_version: Version.create("5666"),
|
||||||
llvm_build_version: Version::NULL,
|
llvm_build_version: Version::NULL,
|
||||||
clang_build_version: Version.create("425"),
|
clang_build_version: Version.create("425"),
|
||||||
@ -19,8 +18,8 @@ describe CompilerSelector do
|
|||||||
before do
|
before do
|
||||||
allow(versions).to receive(:non_apple_gcc_version) do |name|
|
allow(versions).to receive(:non_apple_gcc_version) do |name|
|
||||||
case name
|
case name
|
||||||
when "gcc-4.8" then Version.create("4.8.1")
|
when "gcc-7" then Version.create("7.1")
|
||||||
when "gcc-4.7" then Version.create("4.7.1")
|
when "gcc-6" then Version.create("6.1")
|
||||||
else Version::NULL
|
else Version::NULL
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -32,14 +31,14 @@ describe CompilerSelector do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "returns clang if it fails with non-Apple gcc" do
|
it "returns clang if it fails with non-Apple gcc" do
|
||||||
software_spec.fails_with(gcc: "4.8")
|
software_spec.fails_with(gcc: "7")
|
||||||
expect(subject.compiler).to eq(:clang)
|
expect(subject.compiler).to eq(:clang)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "still returns gcc-4.8 if it fails with gcc without a specific version" do
|
it "still returns gcc-7 if it fails with gcc without a specific version" do
|
||||||
software_spec.fails_with(:clang)
|
software_spec.fails_with(:clang)
|
||||||
software_spec.fails_with(:gcc_4_2)
|
software_spec.fails_with(:gcc_4_2)
|
||||||
expect(subject.compiler).to eq("gcc-4.8")
|
expect(subject.compiler).to eq("gcc-7")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns gcc if it fails with clang and llvm" do
|
it "returns gcc if it fails with clang and llvm" do
|
||||||
@ -54,23 +53,23 @@ describe CompilerSelector do
|
|||||||
|
|
||||||
example "returns gcc if it fails with a specific gcc version" do
|
example "returns gcc if it fails with a specific gcc version" do
|
||||||
software_spec.fails_with(:clang)
|
software_spec.fails_with(:clang)
|
||||||
software_spec.fails_with(gcc: "4.8")
|
software_spec.fails_with(gcc: "7")
|
||||||
expect(subject.compiler).to eq(:gcc_4_2)
|
expect(subject.compiler).to eq(:gcc_4_2)
|
||||||
end
|
end
|
||||||
|
|
||||||
example "returns a lower version of gcc if it fails with the highest version" do
|
example "returns a lower version of gcc if it fails with the highest version" do
|
||||||
software_spec.fails_with(:clang)
|
software_spec.fails_with(:clang)
|
||||||
software_spec.fails_with(:gcc_4_2)
|
software_spec.fails_with(:gcc_4_2)
|
||||||
software_spec.fails_with(gcc: "4.8")
|
software_spec.fails_with(gcc: "7")
|
||||||
expect(subject.compiler).to eq("gcc-4.7")
|
expect(subject.compiler).to eq("gcc-6")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "raises an error when gcc or llvm is missing" do
|
it "raises an error when gcc or llvm is missing" do
|
||||||
allow(versions).to receive(:gcc_4_2_build_version).and_return(Version::NULL)
|
allow(versions).to receive(:gcc_4_2_build_version).and_return(Version::NULL)
|
||||||
|
|
||||||
software_spec.fails_with(:clang)
|
software_spec.fails_with(:clang)
|
||||||
software_spec.fails_with(gcc: "4.8")
|
software_spec.fails_with(gcc: "7")
|
||||||
software_spec.fails_with(gcc: "4.7")
|
software_spec.fails_with(gcc: "6")
|
||||||
|
|
||||||
expect { subject.compiler }.to raise_error(CompilerSelectionError)
|
expect { subject.compiler }.to raise_error(CompilerSelectionError)
|
||||||
end
|
end
|
||||||
|
@ -4,10 +4,9 @@ require "cxxstdlib"
|
|||||||
describe CxxStdlib do
|
describe CxxStdlib do
|
||||||
let(:clang) { described_class.create(:libstdcxx, :clang) }
|
let(:clang) { described_class.create(:libstdcxx, :clang) }
|
||||||
let(:gcc) { described_class.create(:libstdcxx, :gcc) }
|
let(:gcc) { described_class.create(:libstdcxx, :gcc) }
|
||||||
let(:gcc40) { described_class.create(:libstdcxx, :gcc_4_0) }
|
|
||||||
let(:gcc42) { described_class.create(:libstdcxx, :gcc_4_2) }
|
let(:gcc42) { described_class.create(:libstdcxx, :gcc_4_2) }
|
||||||
let(:gcc48) { described_class.create(:libstdcxx, "gcc-4.8") }
|
let(:gcc6) { described_class.create(:libstdcxx, "gcc-6") }
|
||||||
let(:gcc49) { described_class.create(:libstdcxx, "gcc-4.9") }
|
let(:gcc7) { described_class.create(:libstdcxx, "gcc-7") }
|
||||||
let(:lcxx) { described_class.create(:libcxx, :clang) }
|
let(:lcxx) { described_class.create(:libcxx, :clang) }
|
||||||
let(:purec) { described_class.create(nil, :clang) }
|
let(:purec) { described_class.create(nil, :clang) }
|
||||||
|
|
||||||
@ -19,18 +18,18 @@ describe CxxStdlib do
|
|||||||
|
|
||||||
specify "compatibility with itself" do
|
specify "compatibility with itself" do
|
||||||
expect(gcc).to be_compatible_with(gcc)
|
expect(gcc).to be_compatible_with(gcc)
|
||||||
expect(gcc48).to be_compatible_with(gcc48)
|
expect(gcc7).to be_compatible_with(gcc7)
|
||||||
expect(clang).to be_compatible_with(clang)
|
expect(clang).to be_compatible_with(clang)
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "Apple/GNU libstdcxx incompatibility" do
|
specify "Apple/GNU libstdcxx incompatibility" do
|
||||||
expect(clang).not_to be_compatible_with(gcc48)
|
expect(clang).not_to be_compatible_with(gcc7)
|
||||||
expect(gcc48).not_to be_compatible_with(clang)
|
expect(gcc7).not_to be_compatible_with(clang)
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "GNU cross-version incompatibility" do
|
specify "GNU cross-version incompatibility" do
|
||||||
expect(gcc48).not_to be_compatible_with(gcc49)
|
expect(gcc6).not_to be_compatible_with(gcc7)
|
||||||
expect(gcc49).not_to be_compatible_with(gcc48)
|
expect(gcc7).not_to be_compatible_with(gcc6)
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "libstdcxx and libcxx incompatibility" do
|
specify "libstdcxx and libcxx incompatibility" do
|
||||||
@ -42,8 +41,8 @@ describe CxxStdlib do
|
|||||||
expect(purec).to be_compatible_with(clang)
|
expect(purec).to be_compatible_with(clang)
|
||||||
expect(clang).to be_compatible_with(purec)
|
expect(clang).to be_compatible_with(purec)
|
||||||
expect(purec).to be_compatible_with(purec)
|
expect(purec).to be_compatible_with(purec)
|
||||||
expect(purec).to be_compatible_with(gcc48)
|
expect(purec).to be_compatible_with(gcc7)
|
||||||
expect(gcc48).to be_compatible_with(purec)
|
expect(gcc7).to be_compatible_with(purec)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -55,7 +54,7 @@ describe CxxStdlib do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "returns false for non-Apple compilers" do
|
it "returns false for non-Apple compilers" do
|
||||||
expect(gcc48).not_to be_an_apple_compiler
|
expect(gcc7).not_to be_an_apple_compiler
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -49,23 +49,11 @@ describe DependencyCollector do
|
|||||||
expect(find_requirement(X11Requirement).tags).to be_empty
|
expect(find_requirement(X11Requirement).tags).to be_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "x11 with (ignored) minimum version" do
|
|
||||||
subject.add x11: "2.5.1"
|
|
||||||
expect(find_requirement(X11Requirement).min_version.to_s).not_to eq("2.5.1")
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "x11 with tag" do
|
specify "x11 with tag" do
|
||||||
subject.add x11: :optional
|
subject.add x11: :optional
|
||||||
expect(find_requirement(X11Requirement)).to be_optional
|
expect(find_requirement(X11Requirement)).to be_optional
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "x11 with (ignored) minimum version and tag" do
|
|
||||||
subject.add x11: ["2.5.1", :optional]
|
|
||||||
dep = find_requirement(X11Requirement)
|
|
||||||
expect(dep.min_version.to_s).not_to eq("2.5.1")
|
|
||||||
expect(dep).to be_optional
|
|
||||||
end
|
|
||||||
|
|
||||||
it "doesn't mutate the dependency spec" do
|
it "doesn't mutate the dependency spec" do
|
||||||
spec = { "foo" => :optional }
|
spec = { "foo" => :optional }
|
||||||
copy = spec.dup
|
copy = spec.dup
|
||||||
|
@ -46,81 +46,6 @@ describe VCSDownloadStrategy do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GitHubPrivateRepositoryDownloadStrategy", :needs_compat do
|
|
||||||
subject { GitHubPrivateRepositoryDownloadStrategy.new(url, "foo", version) }
|
|
||||||
|
|
||||||
let(:url) { "https://github.com/owner/repo/archive/1.1.5.tar.gz" }
|
|
||||||
let(:version) { nil }
|
|
||||||
|
|
||||||
before do
|
|
||||||
ENV["HOMEBREW_GITHUB_API_TOKEN"] = "token"
|
|
||||||
allow(GitHub).to receive(:repository).and_return({})
|
|
||||||
end
|
|
||||||
|
|
||||||
it "sets the @github_token instance variable" do
|
|
||||||
expect(subject.instance_variable_get(:@github_token)).to eq("token")
|
|
||||||
end
|
|
||||||
|
|
||||||
it "parses the URL and sets the corresponding instance variables" do
|
|
||||||
expect(subject.instance_variable_get(:@owner)).to eq("owner")
|
|
||||||
expect(subject.instance_variable_get(:@repo)).to eq("repo")
|
|
||||||
expect(subject.instance_variable_get(:@filepath)).to eq("archive/1.1.5.tar.gz")
|
|
||||||
end
|
|
||||||
|
|
||||||
its(:download_url) { is_expected.to eq("https://token@github.com/owner/repo/archive/1.1.5.tar.gz") }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "GitHubPrivateRepositoryReleaseDownloadStrategy", :needs_compat do
|
|
||||||
subject { GitHubPrivateRepositoryReleaseDownloadStrategy.new(url, "foo", version) }
|
|
||||||
|
|
||||||
let(:url) { "https://github.com/owner/repo/releases/download/tag/foo_v0.1.0_darwin_amd64.tar.gz" }
|
|
||||||
let(:version) { nil }
|
|
||||||
|
|
||||||
before do
|
|
||||||
ENV["HOMEBREW_GITHUB_API_TOKEN"] = "token"
|
|
||||||
allow(GitHub).to receive(:repository).and_return({})
|
|
||||||
end
|
|
||||||
|
|
||||||
it "parses the URL and sets the corresponding instance variables" do
|
|
||||||
expect(subject.instance_variable_get(:@owner)).to eq("owner")
|
|
||||||
expect(subject.instance_variable_get(:@repo)).to eq("repo")
|
|
||||||
expect(subject.instance_variable_get(:@tag)).to eq("tag")
|
|
||||||
expect(subject.instance_variable_get(:@filename)).to eq("foo_v0.1.0_darwin_amd64.tar.gz")
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#download_url" do
|
|
||||||
it "returns the download URL for a given resource" do
|
|
||||||
allow(subject).to receive(:resolve_asset_id).and_return(456)
|
|
||||||
expect(subject.download_url).to eq("https://token@api.github.com/repos/owner/repo/releases/assets/456")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "#resolve_asset_id" do
|
|
||||||
release_metadata = {
|
|
||||||
"assets" => [
|
|
||||||
{
|
|
||||||
"id" => 123,
|
|
||||||
"name" => "foo_v0.1.0_linux_amd64.tar.gz",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id" => 456,
|
|
||||||
"name" => "foo_v0.1.0_darwin_amd64.tar.gz",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
allow(subject).to receive(:fetch_release_metadata).and_return(release_metadata)
|
|
||||||
expect(subject.send(:resolve_asset_id)).to eq(456)
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#fetch_release_metadata" do
|
|
||||||
it "fetches release metadata from GitHub" do
|
|
||||||
expected_release_url = "https://api.github.com/repos/owner/repo/releases/tags/tag"
|
|
||||||
expect(GitHub).to receive(:open_api).with(expected_release_url).and_return({})
|
|
||||||
subject.send(:fetch_release_metadata)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe GitHubGitDownloadStrategy do
|
describe GitHubGitDownloadStrategy do
|
||||||
subject { described_class.new(url, name, version) }
|
subject { described_class.new(url, name, version) }
|
||||||
|
|
||||||
@ -200,24 +125,6 @@ describe GitDownloadStrategy do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "S3DownloadStrategy", :needs_compat do
|
|
||||||
subject { S3DownloadStrategy.new(url, name, version) }
|
|
||||||
|
|
||||||
let(:name) { "foo" }
|
|
||||||
let(:url) { "https://bucket.s3.amazonaws.com/foo.tar.gz" }
|
|
||||||
let(:version) { nil }
|
|
||||||
|
|
||||||
describe "#fetch" do
|
|
||||||
context "when given Bad S3 URL" do
|
|
||||||
let(:url) { "https://example.com/foo.tar.gz" }
|
|
||||||
|
|
||||||
it "raises Bad S3 URL error" do
|
|
||||||
expect { subject.fetch }.to raise_error(RuntimeError, /S3/)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe CurlDownloadStrategy do
|
describe CurlDownloadStrategy do
|
||||||
subject { described_class.new(url, name, version, **specs) }
|
subject { described_class.new(url, name, version, **specs) }
|
||||||
|
|
||||||
@ -427,91 +334,6 @@ describe CurlPostDownloadStrategy do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "ScpDownloadStrategy", :needs_compat do
|
|
||||||
subject { ScpDownloadStrategy.new(url, name, version) }
|
|
||||||
|
|
||||||
let(:name) { "foo" }
|
|
||||||
let(:url) { "scp://example.com/foo.tar.gz" }
|
|
||||||
let(:version) { nil }
|
|
||||||
|
|
||||||
describe "#initialize" do
|
|
||||||
invalid_urls = %w[
|
|
||||||
https://example.com/foo.tar.gz
|
|
||||||
scp://@example.com/foo.tar.gz
|
|
||||||
scp://example.com:/foo.tar.gz
|
|
||||||
scp://example.com
|
|
||||||
]
|
|
||||||
|
|
||||||
invalid_urls.each do |invalid_url|
|
|
||||||
context "with invalid URL #{invalid_url}" do
|
|
||||||
let(:url) { invalid_url }
|
|
||||||
|
|
||||||
it "raises ScpDownloadStrategyError" do
|
|
||||||
expect { subject }.to raise_error(ScpDownloadStrategyError)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#fetch" do
|
|
||||||
before do
|
|
||||||
expect(subject.temporary_path).to receive(:rename).and_return(true)
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when given a valid URL" do
|
|
||||||
let(:url) { "scp://example.com/foo.tar.gz" }
|
|
||||||
|
|
||||||
it "copies the file via scp" do
|
|
||||||
expect(subject)
|
|
||||||
.to receive(:system_command!)
|
|
||||||
.with("scp", args: ["example.com:/foo.tar.gz", anything])
|
|
||||||
.and_return(true)
|
|
||||||
|
|
||||||
subject.fetch
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when given a URL with a username" do
|
|
||||||
let(:url) { "scp://user@example.com/foo.tar.gz" }
|
|
||||||
|
|
||||||
it "copies the file via scp" do
|
|
||||||
expect(subject)
|
|
||||||
.to receive(:system_command!)
|
|
||||||
.with("scp", args: ["user@example.com:/foo.tar.gz", anything])
|
|
||||||
.and_return(true)
|
|
||||||
|
|
||||||
subject.fetch
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when given a URL with a port" do
|
|
||||||
let(:url) { "scp://example.com:1234/foo.tar.gz" }
|
|
||||||
|
|
||||||
it "copies the file via scp" do
|
|
||||||
expect(subject)
|
|
||||||
.to receive(:system_command!)
|
|
||||||
.with("scp", args: ["-P 1234 example.com:/foo.tar.gz", anything])
|
|
||||||
.and_return(true)
|
|
||||||
|
|
||||||
subject.fetch
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when given a URL with /~/" do
|
|
||||||
let(:url) { "scp://example.com/~/foo.tar.gz" }
|
|
||||||
|
|
||||||
it "treats the path as relative to the home directory" do
|
|
||||||
expect(subject)
|
|
||||||
.to receive(:system_command!)
|
|
||||||
.with("scp", args: ["example.com:~/foo.tar.gz", anything])
|
|
||||||
.and_return(true)
|
|
||||||
|
|
||||||
subject.fetch
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe SubversionDownloadStrategy do
|
describe SubversionDownloadStrategy do
|
||||||
subject { described_class.new(url, name, version, **specs) }
|
subject { described_class.new(url, name, version, **specs) }
|
||||||
|
|
||||||
@ -565,31 +387,6 @@ describe DownloadStrategyDetector do
|
|||||||
it { is_expected.to eq(GitHubGitDownloadStrategy) }
|
it { is_expected.to eq(GitHubGitDownloadStrategy) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when given an S3 URL", :needs_compat do
|
|
||||||
let(:url) { "s3://bucket/homebrew/brew.tar.gz" }
|
|
||||||
|
|
||||||
it "returns S3DownloadStrategy" do
|
|
||||||
allow(described_class).to receive(:require_aws_sdk).and_return(true)
|
|
||||||
expect(subject).to eq(S3DownloadStrategy)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when given strategy = S3DownloadStrategy", :needs_compat do
|
|
||||||
let(:url) { "https://bkt.s3.amazonaws.com/key.tar.gz" }
|
|
||||||
let(:strategy) { S3DownloadStrategy }
|
|
||||||
|
|
||||||
it "requires aws-sdk-s3" do
|
|
||||||
allow(described_class).to receive(:require_aws_sdk).and_return(true)
|
|
||||||
expect(subject).to eq(S3DownloadStrategy)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when given an scp URL", :needs_compat do
|
|
||||||
let(:url) { "scp://example.com/brew.tar.gz" }
|
|
||||||
|
|
||||||
it { is_expected.to eq(ScpDownloadStrategy) }
|
|
||||||
end
|
|
||||||
|
|
||||||
it "defaults to cURL" do
|
it "defaults to cURL" do
|
||||||
expect(subject).to eq(CurlDownloadStrategy)
|
expect(subject).to eq(CurlDownloadStrategy)
|
||||||
end
|
end
|
||||||
|
@ -12,16 +12,6 @@ describe DependencyCollector do
|
|||||||
expect(described_class).not_to need_tar_xz_dependency
|
expect(described_class).not_to need_tar_xz_dependency
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "LD64 pre-Leopard dependency" do
|
|
||||||
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.4"))
|
|
||||||
expect(subject.build(:ld64)).to eq(LD64Dependency.new)
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "LD64 Leopard or newer dependency" do
|
|
||||||
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.5"))
|
|
||||||
expect(subject.build(:ld64)).to be nil
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "Resource xz pre-Mavericks dependency" do
|
specify "Resource xz pre-Mavericks dependency" do
|
||||||
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.8"))
|
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.8"))
|
||||||
resource = Resource.new
|
resource = Resource.new
|
||||||
|
@ -12,15 +12,5 @@ describe Requirements do
|
|||||||
subject << Requirement.new
|
subject << Requirement.new
|
||||||
expect(subject.count).to eq(2)
|
expect(subject.count).to eq(2)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "prefers the larger requirement when merging duplicates" do
|
|
||||||
subject << X11Requirement.new << X11Requirement.new(%w[2.6])
|
|
||||||
expect(subject.to_a).to eq([X11Requirement.new(%w[2.6])])
|
|
||||||
end
|
|
||||||
|
|
||||||
it "does not use the smaller requirement when merging duplicates" do
|
|
||||||
subject << X11Requirement.new(%w[2.6]) << X11Requirement.new
|
|
||||||
expect(subject.to_a).to eq([X11Requirement.new(%w[2.6])])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -451,16 +451,6 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
|
|||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
|
|
||||||
it "ruby-macho alternatives audit exempted formula" do
|
|
||||||
expect_no_offenses(<<~RUBY, "/homebrew-core/Formula/cctools.rb")
|
|
||||||
class Cctools < Formula
|
|
||||||
desc "foo"
|
|
||||||
url 'https://brew.sh/foo-1.0.tgz'
|
|
||||||
system "install_name_tool", "-id"
|
|
||||||
end
|
|
||||||
RUBY
|
|
||||||
end
|
|
||||||
|
|
||||||
it "npm install without language::Node args" do
|
it "npm install without language::Node args" do
|
||||||
expect_offense(<<~RUBY)
|
expect_offense(<<~RUBY)
|
||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
/usr/local/Homebrew/Library/Homebrew/test/support/fixtures/bottles/testball_bottle-0.1.yosemite.bottle.tar.gz
|
@ -1 +0,0 @@
|
|||||||
testball_bottle-0.1.yosemite.bottle.tar.gz
|
|
@ -6,7 +6,7 @@ cask 'with-depends-on-macos-array' do
|
|||||||
homepage 'https://brew.sh/with-depends-on-macos-array'
|
homepage 'https://brew.sh/with-depends-on-macos-array'
|
||||||
|
|
||||||
# since all OS releases are included, this should always pass
|
# since all OS releases are included, this should always pass
|
||||||
depends_on macos: ['10.4', '10.5', '10.6', '10.7', '10.8', '10.9', '10.10', MacOS.version.to_s]
|
depends_on macos: ['10.5', '10.6', '10.7', '10.8', '10.9', '10.10', MacOS.version.to_s]
|
||||||
|
|
||||||
app 'Caffeine.app'
|
app 'Caffeine.app'
|
||||||
end
|
end
|
||||||
|
@ -5,7 +5,7 @@ cask 'with-depends-on-macos-comparison' do
|
|||||||
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
|
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
|
||||||
homepage 'https://brew.sh/with-depends-on-macos-comparison'
|
homepage 'https://brew.sh/with-depends-on-macos-comparison'
|
||||||
|
|
||||||
depends_on macos: '>= 10.4'
|
depends_on macos: '>= 10.5'
|
||||||
|
|
||||||
app 'Caffeine.app'
|
app 'Caffeine.app'
|
||||||
end
|
end
|
||||||
|
@ -6,7 +6,7 @@ cask 'with-depends-on-macos-failure' do
|
|||||||
homepage 'https://brew.sh/with-depends-on-macos-failure'
|
homepage 'https://brew.sh/with-depends-on-macos-failure'
|
||||||
|
|
||||||
# guarantee a mismatched release
|
# guarantee a mismatched release
|
||||||
depends_on macos: MacOS.version.to_s == '10.4' ? '10.5' : '10.4'
|
depends_on macos: MacOS.version.to_s == '10.5' ? '10.6' : '10.5'
|
||||||
|
|
||||||
app 'Caffeine.app'
|
app 'Caffeine.app'
|
||||||
end
|
end
|
||||||
|
@ -1,86 +0,0 @@
|
|||||||
require "update_migrator"
|
|
||||||
|
|
||||||
describe UpdateMigrator do
|
|
||||||
describe "::migrate_cache_entries_to_double_dashes" do
|
|
||||||
let(:formula_name) { "foo" }
|
|
||||||
let(:f) {
|
|
||||||
formula formula_name do
|
|
||||||
url "https://brew.sh/foo-1.2.3.tar.gz"
|
|
||||||
version "1.2.3"
|
|
||||||
end
|
|
||||||
}
|
|
||||||
let(:old_cache_file) { HOMEBREW_CACHE/"#{formula_name}-1.2.3.tar.gz" }
|
|
||||||
let(:new_cache_file) { HOMEBREW_CACHE/"#{formula_name}--1.2.3.tar.gz" }
|
|
||||||
|
|
||||||
before do
|
|
||||||
FileUtils.touch old_cache_file
|
|
||||||
allow(Formula).to receive(:each).and_yield(f)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "moves old files to use double dashes when upgrading from <= 1.7.1" do
|
|
||||||
described_class.migrate_cache_entries_to_double_dashes(Version.new("1.7.1"))
|
|
||||||
|
|
||||||
expect(old_cache_file).not_to exist
|
|
||||||
expect(new_cache_file).to exist
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when the formula name contains dashes" do
|
|
||||||
let(:formula_name) { "foo-bar" }
|
|
||||||
|
|
||||||
it "does not introduce extra double dashes when called multiple times" do
|
|
||||||
described_class.migrate_cache_entries_to_double_dashes(Version.new("1.7.1"))
|
|
||||||
described_class.migrate_cache_entries_to_double_dashes(Version.new("1.7.1"))
|
|
||||||
|
|
||||||
expect(old_cache_file).not_to exist
|
|
||||||
expect(new_cache_file).to exist
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
it "does not move files if upgrading from > 1.7.1" do
|
|
||||||
described_class.migrate_cache_entries_to_double_dashes(Version.new("1.7.2"))
|
|
||||||
|
|
||||||
expect(old_cache_file).to exist
|
|
||||||
expect(new_cache_file).not_to exist
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "::migrate_cache_entries_to_symlinks" do
|
|
||||||
let(:formula_name) { "foo" }
|
|
||||||
let(:f) {
|
|
||||||
formula formula_name do
|
|
||||||
url "https://brew.sh/foo-1.2.3.tar.gz"
|
|
||||||
version "1.2.3"
|
|
||||||
end
|
|
||||||
}
|
|
||||||
let(:old_cache_file) { HOMEBREW_CACHE/"#{formula_name}--1.2.3.tar.gz" }
|
|
||||||
let(:new_cache_symlink) { HOMEBREW_CACHE/"#{formula_name}--1.2.3.tar.gz" }
|
|
||||||
let(:new_cache_file) {
|
|
||||||
HOMEBREW_CACHE/"downloads/4a81b0e17a7540b7afe1685671a0a126645117e6c0bc6c66f5ad13b7a5912f80--foo-1.2.3.tar.gz"
|
|
||||||
}
|
|
||||||
|
|
||||||
before do
|
|
||||||
old_cache_file.dirname.mkpath
|
|
||||||
FileUtils.touch old_cache_file
|
|
||||||
allow(Formula).to receive(:[]).and_return(f)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "moves old files to use symlinks when upgrading from <= 1.7.2" do
|
|
||||||
described_class.migrate_cache_entries_to_symlinks(Version.new("1.7.2"))
|
|
||||||
|
|
||||||
expect(old_cache_file).to eq(new_cache_symlink)
|
|
||||||
expect(new_cache_symlink).to be_a_symlink
|
|
||||||
expect(new_cache_symlink.readlink.to_s)
|
|
||||||
.to eq "downloads/4a81b0e17a7540b7afe1685671a0a126645117e6c0bc6c66f5ad13b7a5912f80--foo-1.2.3.tar.gz"
|
|
||||||
expect(new_cache_file).to exist
|
|
||||||
expect(new_cache_file).to be_a_file
|
|
||||||
end
|
|
||||||
|
|
||||||
it "does not move files if upgrading from > 1.7.2" do
|
|
||||||
described_class.migrate_cache_entries_to_symlinks(Version.new("1.7.3"))
|
|
||||||
|
|
||||||
expect(old_cache_file).to exist
|
|
||||||
expect(new_cache_file).not_to exist
|
|
||||||
expect(new_cache_symlink).not_to be_a_symlink
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -2,65 +2,12 @@ require "utils/bottles"
|
|||||||
|
|
||||||
describe Utils::Bottles do
|
describe Utils::Bottles do
|
||||||
describe "#tag", :needs_macos do
|
describe "#tag", :needs_macos do
|
||||||
it "returns :tiger_foo on Tiger PowerPC" do
|
|
||||||
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.4"))
|
|
||||||
allow(Hardware::CPU).to receive(:type).and_return(:ppc)
|
|
||||||
allow(Hardware::CPU).to receive(:family).and_return(:foo)
|
|
||||||
allow(MacOS).to receive(:prefer_64_bit?).and_return(false)
|
|
||||||
expect(described_class.tag).to eq(:tiger_foo)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns :tiger on Tiger Intel" do
|
|
||||||
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.4"))
|
|
||||||
allow(Hardware::CPU).to receive(:type).and_return(:intel)
|
|
||||||
allow(MacOS).to receive(:prefer_64_bit?).and_return(false)
|
|
||||||
expect(described_class.tag).to eq(:tiger)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns :tiger_g5_64 on Tiger PowerPC 64-bit" do
|
|
||||||
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.4"))
|
|
||||||
allow(Hardware::CPU).to receive(:type).and_return(:ppc)
|
|
||||||
allow(Hardware::CPU).to receive(:family).and_return(:g5)
|
|
||||||
allow(MacOS).to receive(:prefer_64_bit?).and_return(true)
|
|
||||||
expect(described_class.tag).to eq(:tiger_g5_64)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Note that this will probably never be used
|
|
||||||
it "returns :tiger_64 on Tiger Intel 64-bit" do
|
|
||||||
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.4"))
|
|
||||||
allow(Hardware::CPU).to receive(:type).and_return(:intel)
|
|
||||||
allow(MacOS).to receive(:prefer_64_bit?).and_return(true)
|
|
||||||
expect(described_class.tag).to eq(:tiger_64)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns :leopard on Leopard Intel" do
|
|
||||||
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.5"))
|
|
||||||
allow(Hardware::CPU).to receive(:type).and_return(:intel)
|
|
||||||
allow(MacOS).to receive(:prefer_64_bit?).and_return(false)
|
|
||||||
expect(described_class.tag).to eq(:leopard)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns :leopard_g5_64 on Leopard PowerPC 64-bit" do
|
|
||||||
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.5"))
|
|
||||||
allow(Hardware::CPU).to receive(:type).and_return(:ppc)
|
|
||||||
allow(Hardware::CPU).to receive(:family).and_return(:g5)
|
|
||||||
allow(MacOS).to receive(:prefer_64_bit?).and_return(true)
|
|
||||||
expect(described_class.tag).to eq(:leopard_g5_64)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns :leopard_64 on Leopard Intel 64-bit" do
|
it "returns :leopard_64 on Leopard Intel 64-bit" do
|
||||||
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.5"))
|
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.5"))
|
||||||
allow(Hardware::CPU).to receive(:type).and_return(:intel)
|
allow(Hardware::CPU).to receive(:type).and_return(:intel)
|
||||||
allow(MacOS).to receive(:prefer_64_bit?).and_return(true)
|
|
||||||
expect(described_class.tag).to eq(:leopard_64)
|
expect(described_class.tag).to eq(:leopard_64)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns :snow_leopard_32 on Snow Leopard 32-bit" do
|
|
||||||
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.6"))
|
|
||||||
allow(Hardware::CPU).to receive(:is_64_bit?).and_return(false)
|
|
||||||
expect(described_class.tag).to eq(:snow_leopard_32)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns :snow_leopard on Snow Leopard 64-bit" do
|
it "returns :snow_leopard on Snow Leopard 64-bit" do
|
||||||
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.6"))
|
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.6"))
|
||||||
allow(Hardware::CPU).to receive(:is_64_bit?).and_return(true)
|
allow(Hardware::CPU).to receive(:is_64_bit?).and_return(true)
|
||||||
|
@ -17,29 +17,10 @@ describe Utils::Bottles::Collector do
|
|||||||
expect(subject.fetch_checksum_for(:foo)).to be nil
|
expect(subject.fetch_checksum_for(:foo)).to be nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns nil when there is no match and later tag is present" do
|
it "uses older tags when needed", :needs_macos do
|
||||||
subject[:lion_or_later] = "foo"
|
subject[:lion] = "foo"
|
||||||
expect(subject.fetch_checksum_for(:foo)).to be nil
|
expect(subject.fetch_checksum_for(:mountain_lion)).to eq(["foo", :lion])
|
||||||
end
|
|
||||||
|
|
||||||
it "prefers exact matches" do
|
|
||||||
subject[:lion_or_later] = "foo"
|
|
||||||
subject[:mountain_lion] = "bar"
|
|
||||||
expect(subject.fetch_checksum_for(:mountain_lion)).to eq(["bar", :mountain_lion])
|
|
||||||
end
|
|
||||||
|
|
||||||
it "finds '_or_later' tags", :needs_macos do
|
|
||||||
subject[:lion_or_later] = "foo"
|
|
||||||
expect(subject.fetch_checksum_for(:mountain_lion)).to eq(["foo", :lion_or_later])
|
|
||||||
expect(subject.fetch_checksum_for(:snow_leopard)).to be nil
|
expect(subject.fetch_checksum_for(:snow_leopard)).to be nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it "finds '_altivec' tags", :needs_macos do
|
|
||||||
subject[:tiger_altivec] = "foo"
|
|
||||||
expect(subject.fetch_checksum_for(:tiger_g4)).to eq(["foo", :tiger_altivec])
|
|
||||||
expect(subject.fetch_checksum_for(:tiger_g4e)).to eq(["foo", :tiger_altivec])
|
|
||||||
expect(subject.fetch_checksum_for(:tiger_g5)).to eq(["foo", :tiger_altivec])
|
|
||||||
expect(subject.fetch_checksum_for(:tiger_g3)).to be nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,384 +0,0 @@
|
|||||||
require "cask/cask_loader"
|
|
||||||
require "cask/download"
|
|
||||||
|
|
||||||
module UpdateMigrator
|
|
||||||
class << self
|
|
||||||
def formula_resources(formula)
|
|
||||||
specs = [formula.stable, formula.devel, formula.head].compact
|
|
||||||
|
|
||||||
[*formula.bottle&.resource] + specs.flat_map do |spec|
|
|
||||||
[
|
|
||||||
spec,
|
|
||||||
*spec.resources.values,
|
|
||||||
*spec.patches.select(&:external?).map(&:resource),
|
|
||||||
]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
private :formula_resources
|
|
||||||
|
|
||||||
def parse_extname(url)
|
|
||||||
uri_path = if URI::DEFAULT_PARSER.make_regexp =~ url
|
|
||||||
uri = URI(url)
|
|
||||||
uri.query ? "#{uri.path}?#{uri.query}" : uri.path
|
|
||||||
else
|
|
||||||
url
|
|
||||||
end
|
|
||||||
|
|
||||||
# Given a URL like https://example.com/download.php?file=foo-1.0.tar.gz
|
|
||||||
# the extension we want is ".tar.gz", not ".php".
|
|
||||||
Pathname.new(uri_path).ascend do |path|
|
|
||||||
ext = path.extname[/[^?&]+/]
|
|
||||||
return ext if ext
|
|
||||||
end
|
|
||||||
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
private :parse_extname
|
|
||||||
|
|
||||||
def migrate_cache_entries_to_double_dashes(initial_version)
|
|
||||||
return if initial_version && initial_version > "1.7.1"
|
|
||||||
|
|
||||||
return if ENV.key?("HOMEBREW_DISABLE_LOAD_FORMULA")
|
|
||||||
|
|
||||||
return unless HOMEBREW_CACHE.directory?
|
|
||||||
return if HOMEBREW_CACHE.children.empty?
|
|
||||||
|
|
||||||
ohai "Migrating cache entries..."
|
|
||||||
|
|
||||||
Formula.each do |formula|
|
|
||||||
formula_resources(formula).each do |resource|
|
|
||||||
downloader = resource.downloader
|
|
||||||
|
|
||||||
url = downloader.url
|
|
||||||
name = resource.download_name
|
|
||||||
version = resource.version
|
|
||||||
|
|
||||||
extname = parse_extname(url)
|
|
||||||
old_location = downloader.cache/"#{name}-#{version}#{extname}"
|
|
||||||
new_location = downloader.cache/"#{name}--#{version}#{extname}"
|
|
||||||
|
|
||||||
next unless old_location.file?
|
|
||||||
|
|
||||||
if new_location.exist?
|
|
||||||
begin
|
|
||||||
FileUtils.rm_rf old_location
|
|
||||||
rescue Errno::EACCES
|
|
||||||
opoo "Could not remove #{old_location}, please do so manually."
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
FileUtils.mv old_location, new_location
|
|
||||||
rescue Errno::EACCES
|
|
||||||
opoo "Could not move #{old_location} to #{new_location}, please do so manually."
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def migrate_cache_entries_to_symlinks(initial_version)
|
|
||||||
return if initial_version && initial_version > "1.7.2"
|
|
||||||
|
|
||||||
return if ENV.key?("HOMEBREW_DISABLE_LOAD_FORMULA")
|
|
||||||
|
|
||||||
return unless HOMEBREW_CACHE.directory?
|
|
||||||
return if HOMEBREW_CACHE.children.empty?
|
|
||||||
|
|
||||||
ohai "Migrating cache entries..."
|
|
||||||
|
|
||||||
cache_entries = lambda do |path|
|
|
||||||
if path.directory?
|
|
||||||
path.children
|
|
||||||
.reject(&:symlink?)
|
|
||||||
.select(&:file?)
|
|
||||||
.map { |child| child.basename.to_s }
|
|
||||||
.select { |basename| basename.include?("--") }
|
|
||||||
.map { |basename| basename.sub(/\-\-.*/, "") }
|
|
||||||
.uniq
|
|
||||||
else
|
|
||||||
[]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
load_formula = lambda do |formula|
|
|
||||||
begin
|
|
||||||
Formula[formula]
|
|
||||||
rescue FormulaUnavailableError
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
load_cask = lambda do |cask|
|
|
||||||
begin
|
|
||||||
Cask::CaskLoader.load(cask)
|
|
||||||
rescue Cask::CaskUnavailableError
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
formula_downloaders =
|
|
||||||
cache_entries.call(HOMEBREW_CACHE)
|
|
||||||
.map(&load_formula)
|
|
||||||
.compact
|
|
||||||
.flat_map { |formula| formula_resources(formula) }
|
|
||||||
.map { |resource| [resource.downloader, resource.download_name, resource.version] }
|
|
||||||
|
|
||||||
cask_downloaders =
|
|
||||||
cache_entries.call(HOMEBREW_CACHE/"Cask")
|
|
||||||
.map(&load_cask)
|
|
||||||
.compact
|
|
||||||
.map { |cask| [Cask::Download.new(cask).downloader, cask.token, cask.version] }
|
|
||||||
|
|
||||||
downloaders = formula_downloaders + cask_downloaders
|
|
||||||
|
|
||||||
downloaders.each do |downloader, name, version|
|
|
||||||
next unless downloader.respond_to?(:symlink_location)
|
|
||||||
|
|
||||||
url = downloader.url
|
|
||||||
extname = parse_extname(url)
|
|
||||||
old_location = downloader.cache/"#{name}--#{version}#{extname}"
|
|
||||||
next unless old_location.file?
|
|
||||||
|
|
||||||
new_symlink_location = downloader.symlink_location
|
|
||||||
new_location = downloader.cached_location
|
|
||||||
|
|
||||||
if new_location.exist? && new_symlink_location.symlink?
|
|
||||||
begin
|
|
||||||
FileUtils.rm_rf old_location unless old_location == new_symlink_location
|
|
||||||
rescue Errno::EACCES
|
|
||||||
opoo "Could not remove #{old_location}, please do so manually."
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
new_location.dirname.mkpath
|
|
||||||
if new_location.exist?
|
|
||||||
FileUtils.rm_rf old_location
|
|
||||||
else
|
|
||||||
FileUtils.mv old_location, new_location
|
|
||||||
end
|
|
||||||
symlink_target = new_location.relative_path_from(new_symlink_location.dirname)
|
|
||||||
new_symlink_location.dirname.mkpath
|
|
||||||
FileUtils.ln_s symlink_target, new_symlink_location, force: true
|
|
||||||
rescue Errno::EACCES
|
|
||||||
opoo "Could not move #{old_location} to #{new_location}, please do so manually."
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def migrate_legacy_cache_if_necessary
|
|
||||||
legacy_cache = Pathname.new "/Library/Caches/Homebrew"
|
|
||||||
return if HOMEBREW_CACHE.to_s == legacy_cache.to_s
|
|
||||||
return unless legacy_cache.directory?
|
|
||||||
return unless legacy_cache.readable_real?
|
|
||||||
|
|
||||||
migration_attempted_file = legacy_cache/".migration_attempted"
|
|
||||||
return if migration_attempted_file.exist?
|
|
||||||
|
|
||||||
return unless legacy_cache.writable_real?
|
|
||||||
|
|
||||||
FileUtils.touch migration_attempted_file
|
|
||||||
|
|
||||||
# This directory could have been compromised if it's world-writable/
|
|
||||||
# a symlink/owned by another user so don't copy files in those cases.
|
|
||||||
world_writable = legacy_cache.stat.mode & 0777 == 0777
|
|
||||||
return if world_writable
|
|
||||||
return if legacy_cache.symlink?
|
|
||||||
return if !legacy_cache.owned? && legacy_cache.lstat.uid.nonzero?
|
|
||||||
|
|
||||||
ohai "Migrating #{legacy_cache} to #{HOMEBREW_CACHE}..."
|
|
||||||
HOMEBREW_CACHE.mkpath
|
|
||||||
legacy_cache.cd do
|
|
||||||
legacy_cache.entries.each do |f|
|
|
||||||
next if [".", "..", ".migration_attempted"].include? f.to_s
|
|
||||||
|
|
||||||
begin
|
|
||||||
FileUtils.cp_r f, HOMEBREW_CACHE
|
|
||||||
rescue
|
|
||||||
@migration_failed ||= true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if @migration_failed
|
|
||||||
opoo <<~EOS
|
|
||||||
Failed to migrate #{legacy_cache} to
|
|
||||||
#{HOMEBREW_CACHE}. Please do so manually.
|
|
||||||
EOS
|
|
||||||
else
|
|
||||||
ohai "Deleting #{legacy_cache}..."
|
|
||||||
FileUtils.rm_rf legacy_cache
|
|
||||||
if legacy_cache.exist?
|
|
||||||
FileUtils.touch migration_attempted_file
|
|
||||||
opoo <<~EOS
|
|
||||||
Failed to delete #{legacy_cache}.
|
|
||||||
Please do so manually.
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def migrate_legacy_keg_symlinks_if_necessary
|
|
||||||
legacy_linked_kegs = HOMEBREW_LIBRARY/"LinkedKegs"
|
|
||||||
return unless legacy_linked_kegs.directory?
|
|
||||||
|
|
||||||
HOMEBREW_LINKED_KEGS.mkpath unless legacy_linked_kegs.children.empty?
|
|
||||||
legacy_linked_kegs.children.each do |link|
|
|
||||||
name = link.basename.to_s
|
|
||||||
src = begin
|
|
||||||
link.realpath
|
|
||||||
rescue Errno::ENOENT
|
|
||||||
begin
|
|
||||||
(HOMEBREW_PREFIX/"opt/#{name}").realpath
|
|
||||||
rescue Errno::ENOENT
|
|
||||||
begin
|
|
||||||
Formulary.factory(name).installed_prefix
|
|
||||||
rescue
|
|
||||||
next
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
dst = HOMEBREW_LINKED_KEGS/name
|
|
||||||
dst.unlink if dst.exist?
|
|
||||||
FileUtils.ln_sf(src.relative_path_from(dst.parent), dst)
|
|
||||||
end
|
|
||||||
FileUtils.rm_rf legacy_linked_kegs
|
|
||||||
|
|
||||||
legacy_pinned_kegs = HOMEBREW_LIBRARY/"PinnedKegs"
|
|
||||||
return unless legacy_pinned_kegs.directory?
|
|
||||||
|
|
||||||
HOMEBREW_PINNED_KEGS.mkpath unless legacy_pinned_kegs.children.empty?
|
|
||||||
legacy_pinned_kegs.children.each do |link|
|
|
||||||
name = link.basename.to_s
|
|
||||||
src = link.realpath
|
|
||||||
dst = HOMEBREW_PINNED_KEGS/name
|
|
||||||
FileUtils.ln_sf(src.relative_path_from(dst.parent), dst)
|
|
||||||
end
|
|
||||||
FileUtils.rm_rf legacy_pinned_kegs
|
|
||||||
end
|
|
||||||
|
|
||||||
def migrate_legacy_repository_if_necessary
|
|
||||||
return unless Homebrew.default_prefix?
|
|
||||||
return unless Homebrew.default_prefix?(HOMEBREW_REPOSITORY)
|
|
||||||
|
|
||||||
ohai "Migrating HOMEBREW_REPOSITORY (please wait)..."
|
|
||||||
|
|
||||||
unless HOMEBREW_PREFIX.writable_real?
|
|
||||||
ofail <<~EOS
|
|
||||||
#{HOMEBREW_PREFIX} is not writable.
|
|
||||||
|
|
||||||
You should change the ownership and permissions of #{HOMEBREW_PREFIX}
|
|
||||||
temporarily back to your user account so we can complete the Homebrew
|
|
||||||
repository migration:
|
|
||||||
sudo chown -R $(whoami) #{HOMEBREW_PREFIX}
|
|
||||||
EOS
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
new_homebrew_repository = Pathname.new "#{HOMEBREW_PREFIX}/Homebrew"
|
|
||||||
new_homebrew_repository.rmdir_if_possible
|
|
||||||
if new_homebrew_repository.exist?
|
|
||||||
ofail <<~EOS
|
|
||||||
#{new_homebrew_repository} already exists.
|
|
||||||
Please remove it manually or uninstall and reinstall Homebrew into a new
|
|
||||||
location as the migration cannot be done automatically.
|
|
||||||
EOS
|
|
||||||
return
|
|
||||||
end
|
|
||||||
new_homebrew_repository.mkpath
|
|
||||||
|
|
||||||
repo_files = HOMEBREW_REPOSITORY.cd do
|
|
||||||
Utils.popen_read("git ls-files").lines.map(&:chomp)
|
|
||||||
end
|
|
||||||
|
|
||||||
unless Utils.popen_read("git status --untracked-files=all --porcelain").empty?
|
|
||||||
HOMEBREW_REPOSITORY.cd do
|
|
||||||
quiet_system "git", "merge", "--abort"
|
|
||||||
quiet_system "git", "rebase", "--abort"
|
|
||||||
quiet_system "git", "reset", "--mixed"
|
|
||||||
safe_system "git", "-c", "user.email=brew-update@localhost",
|
|
||||||
"-c", "user.name=brew update",
|
|
||||||
"stash", "save", "--include-untracked"
|
|
||||||
end
|
|
||||||
stashed = true
|
|
||||||
end
|
|
||||||
|
|
||||||
FileUtils.cp_r "#{HOMEBREW_REPOSITORY}/.git", "#{new_homebrew_repository}/.git"
|
|
||||||
new_homebrew_repository.cd do
|
|
||||||
safe_system "git", "checkout", "--force", "."
|
|
||||||
safe_system "git", "stash", "pop" if stashed
|
|
||||||
end
|
|
||||||
|
|
||||||
if (HOMEBREW_REPOSITORY/"Library/Locks").exist?
|
|
||||||
FileUtils.cp_r "#{HOMEBREW_REPOSITORY}/Library/Locks", "#{new_homebrew_repository}/Library/Locks"
|
|
||||||
end
|
|
||||||
|
|
||||||
if (HOMEBREW_REPOSITORY/"Library/Taps").exist?
|
|
||||||
FileUtils.cp_r "#{HOMEBREW_REPOSITORY}/Library/Taps", "#{new_homebrew_repository}/Library/Taps"
|
|
||||||
end
|
|
||||||
|
|
||||||
unremovable_paths = []
|
|
||||||
extra_remove_paths = [
|
|
||||||
".git",
|
|
||||||
"Library/Locks",
|
|
||||||
"Library/Taps",
|
|
||||||
"Library/Homebrew/cask",
|
|
||||||
"Library/Homebrew/test",
|
|
||||||
]
|
|
||||||
(repo_files + extra_remove_paths).each do |file|
|
|
||||||
path = Pathname.new "#{HOMEBREW_REPOSITORY}/#{file}"
|
|
||||||
begin
|
|
||||||
FileUtils.rm_rf path
|
|
||||||
rescue Errno::EACCES
|
|
||||||
unremovable_paths << path
|
|
||||||
end
|
|
||||||
quiet_system "rmdir", "-p", path.parent if path.parent.exist?
|
|
||||||
end
|
|
||||||
|
|
||||||
unless unremovable_paths.empty?
|
|
||||||
ofail <<~EOS
|
|
||||||
Could not remove old HOMEBREW_REPOSITORY paths!
|
|
||||||
Please do this manually with:
|
|
||||||
sudo rm -rf #{unremovable_paths.join " "}
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
|
|
||||||
Keg::MUST_EXIST_DIRECTORIES.each { |dir| FileUtils.mkdir_p dir }
|
|
||||||
|
|
||||||
src = Pathname.new("#{new_homebrew_repository}/bin/brew")
|
|
||||||
dst = Pathname.new("#{HOMEBREW_PREFIX}/bin/brew")
|
|
||||||
begin
|
|
||||||
FileUtils.ln_s(src.relative_path_from(dst.parent), dst)
|
|
||||||
rescue Errno::EACCES, Errno::ENOENT
|
|
||||||
ofail <<~EOS
|
|
||||||
Could not create symlink at #{dst}!
|
|
||||||
Please do this manually with:
|
|
||||||
sudo ln -sf #{src} #{dst}
|
|
||||||
sudo chown $(whoami) #{dst}
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
|
|
||||||
link_completions_manpages_and_docs(new_homebrew_repository)
|
|
||||||
|
|
||||||
ohai "Migrated HOMEBREW_REPOSITORY to #{new_homebrew_repository}!"
|
|
||||||
if HOMEBREW_PREFIX == "/usr/local"
|
|
||||||
puts <<~EOS
|
|
||||||
Homebrew no longer needs to have ownership of #{HOMEBREW_PREFIX}. If you wish you can
|
|
||||||
return #{HOMEBREW_PREFIX} to its default ownership with:
|
|
||||||
sudo chown root:wheel #{HOMEBREW_PREFIX}
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
rescue => e
|
|
||||||
ofail <<~EOS
|
|
||||||
#{Tty.bold}Failed to migrate HOMEBREW_REPOSITORY to #{new_homebrew_repository}!#{Tty.reset}
|
|
||||||
The error was:
|
|
||||||
#{e}
|
|
||||||
Please try to resolve this error yourself and then run `brew update` again to
|
|
||||||
complete the migration. If you need help please +1 an existing error or comment
|
|
||||||
with your new error in issue:
|
|
||||||
#{Formatter.url("https://github.com/Homebrew/brew/issues/987")}
|
|
||||||
EOS
|
|
||||||
$stderr.puts e.backtrace
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -20,9 +20,9 @@ dependencies that you built on 10.8 or earlier. If you're reading this page beca
|
|||||||
you were directed here by a build error, you can most likely fix the issue if
|
you were directed here by a build error, you can most likely fix the issue if
|
||||||
you reinstall all the dependencies of the package you're trying to build.
|
you reinstall all the dependencies of the package you're trying to build.
|
||||||
|
|
||||||
Example install using GCC 4.8:
|
Example install using GCC 7:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
brew install gcc48
|
brew install gcc@7
|
||||||
brew install --cc=gcc-4.8 <formula>
|
brew install --cc=gcc-7 <formula>
|
||||||
```
|
```
|
||||||
|
@ -16,7 +16,7 @@ GCC or cross-compiler suite, please link it in here.
|
|||||||
|
|
||||||
- Homebrew provides a `gcc` formula for use with Xcode 4.2+ or when needing
|
- Homebrew provides a `gcc` formula for use with Xcode 4.2+ or when needing
|
||||||
C++11 support on earlier versions.
|
C++11 support on earlier versions.
|
||||||
- Homebrew provides older GCC formulae, e.g. `gcc@4.9` and `gcc@6`.
|
- Homebrew provides older GCC formulae, e.g. `gcc@7`
|
||||||
- Homebrew provides the LLVM Clang, which is bundled with the `llvm` formula.
|
- Homebrew provides the LLVM Clang, which is bundled with the `llvm` formula.
|
||||||
- [RISC-V](https://github.com/riscv/homebrew-riscv) provides the RISC-V
|
- [RISC-V](https://github.com/riscv/homebrew-riscv) provides the RISC-V
|
||||||
toolchain including binutils and GCC.
|
toolchain including binutils and GCC.
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user