update: migrate everyone from linuxbrew-core to homebrew-core

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Michka Popoff 2021-10-20 11:01:38 +01:00 committed by Mike McQuaid
parent 9b5f191db1
commit 1cc7ca33c0
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829
33 changed files with 143 additions and 334 deletions

View File

@ -6,13 +6,10 @@ contact_links:
about: Have a question? Not sure if your issue affects everyone reproducibly? The quickest way to get help is on Homebrew's GitHub Discussions! about: Have a question? Not sure if your issue affects everyone reproducibly? The quickest way to get help is on Homebrew's GitHub Discussions!
- name: New issue on Homebrew/homebrew-core - name: New issue on Homebrew/homebrew-core
url: https://github.com/Homebrew/homebrew-core/issues/new/choose url: https://github.com/Homebrew/homebrew-core/issues/new/choose
about: On macOS/Mac OS X? Having a `brew` problem with a `brew install` or `brew upgrade` of a single formula/package? Report it to Homebrew/homebrew-core (the macOS core tap/repository). about: Having a `brew` problem with a `brew install` or `brew upgrade` of a single formula/package? Report it to Homebrew/homebrew-core (the core tap/repository).
- name: New issue on Homebrew/homebrew-cask - name: New issue on Homebrew/homebrew-cask
url: https://github.com/Homebrew/homebrew-cask/issues/new/choose url: https://github.com/Homebrew/homebrew-cask/issues/new/choose
about: Having a `brew --cask` problem? Report it to Homebrew/homebrew-cask (the cask tap/repository). about: Having a `brew --cask` problem? Report it to Homebrew/homebrew-cask (the cask tap/repository).
- name: New issue on Homebrew/linuxbrew-core
url: https://github.com/Homebrew/linuxbrew-core/issues/new/choose
about: On Linux? Having a `brew` problem with a `brew install` or `brew upgrade` of a single formula/package? Report it to Homebrew/linuxbrew-core (the Linux core tap/repository).
- name: Get help from Homebrew mirror maintainers - name: Get help from Homebrew mirror maintainers
url: https://github.com/Homebrew/discussions/discussions/1917 url: https://github.com/Homebrew/discussions/discussions/1917
about: Slow download speed? Homebrew mirror not working as expected? Please take a look at the mirror list and contact respective mirror maintainers. about: Slow download speed? Homebrew mirror not working as expected? Please take a look at the mirror list and contact respective mirror maintainers.

View File

@ -84,7 +84,7 @@ jobs:
- name: Run brew readall on all taps - name: Run brew readall on all taps
run: brew readall --aliases run: brew readall --aliases
- name: Run brew style on linuxbrew-core - name: Run brew style on homebrew-core for Linux
run: brew style --display-cop-names homebrew/core run: brew style --display-cop-names homebrew/core
- name: Run brew audit --skip-style on all taps - name: Run brew audit --skip-style on all taps
@ -116,12 +116,12 @@ jobs:
# brew style doesn't like world writable directories # brew style doesn't like world writable directories
sudo chmod -R g-w,o-w "${HOMEBREW_REPOSITORY}/Library/Taps" sudo chmod -R g-w,o-w "${HOMEBREW_REPOSITORY}/Library/Taps"
- name: Run brew style on homebrew-core - name: Run brew style on homebrew-core for macOS
run: brew style --display-cop-names homebrew/core run: brew style --display-cop-names homebrew/core
env: env:
HOMEBREW_SIMULATE_MACOS_ON_LINUX: 1 HOMEBREW_SIMULATE_MACOS_ON_LINUX: 1
- name: Run brew audit --skip-style on homebrew-core - name: Run brew audit --skip-style on homebrew-core for macOS
run: brew audit --skip-style --except=version --tap=homebrew/core run: brew audit --skip-style --except=version --tap=homebrew/core
env: env:
HOMEBREW_SIMULATE_MACOS_ON_LINUX: 1 HOMEBREW_SIMULATE_MACOS_ON_LINUX: 1

View File

@ -24,5 +24,3 @@ module Homebrew
end end
end end
end end
require "extend/os/api/analytics"

View File

@ -91,5 +91,3 @@ module Homebrew
end end
end end
end end
require "extend/os/api/bottle"

View File

@ -24,5 +24,3 @@ module Homebrew
end end
end end
end end
require "extend/os/api/formula"

View File

@ -15,11 +15,6 @@ module Homebrew
Homebrew::API.fetch "versions-formulae.json" Homebrew::API.fetch "versions-formulae.json"
end end
def linux
# The result is cached by Homebrew::API.fetch
Homebrew::API.fetch "versions-linux.json"
end
def casks def casks
# The result is cached by Homebrew::API.fetch # The result is cached by Homebrew::API.fetch
Homebrew::API.fetch "versions-casks.json" Homebrew::API.fetch "versions-casks.json"
@ -27,14 +22,7 @@ module Homebrew
sig { params(name: String).returns(T.nilable(PkgVersion)) } sig { params(name: String).returns(T.nilable(PkgVersion)) }
def latest_formula_version(name) def latest_formula_version(name)
versions = if OS.mac? || versions = formulae
Homebrew::EnvConfig.force_homebrew_on_linux? ||
Homebrew::EnvConfig.force_homebrew_core_repo_on_linux?
formulae
else
linux
end
return unless versions.key? name return unless versions.key? name
version = Version.new(versions[name]["version"]) version = Version.new(versions[name]["version"])

View File

@ -402,12 +402,6 @@ case "$*" in
;; ;;
esac esac
# shellcheck disable=SC2154
if [[ -n "${HOMEBREW_SIMULATE_MACOS_ON_LINUX}" ]]
then
export HOMEBREW_FORCE_HOMEBREW_ON_LINUX="1"
fi
if [[ -n "${HOMEBREW_MACOS}" ]] if [[ -n "${HOMEBREW_MACOS}" ]]
then then
HOMEBREW_PRODUCT="Homebrew" HOMEBREW_PRODUCT="Homebrew"
@ -544,27 +538,11 @@ Your Git executable: $(unset git && type -p ${HOMEBREW_GIT})"
unset HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH unset HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH
HOMEBREW_CORE_REPOSITORY_ORIGIN="$("${HOMEBREW_GIT}" -C "${HOMEBREW_CORE_REPOSITORY}" remote get-url origin 2>/dev/null)" HOMEBREW_CORE_REPOSITORY_ORIGIN="$("${HOMEBREW_GIT}" -C "${HOMEBREW_CORE_REPOSITORY}" remote get-url origin 2>/dev/null)"
if [[ "${HOMEBREW_CORE_REPOSITORY_ORIGIN}" == "https://github.com/Homebrew/homebrew-core" ]] if [[ "${HOMEBREW_CORE_REPOSITORY_ORIGIN}" =~ /linuxbrew-core(\.git)?$ ]]
then then
# TODO: this variable can go away when we're migrating everyone to homebrew-core.
HOMEBREW_CORE_ON_LINUX=1
# Migrate from linuxbrew-core to homebrew-core:
# - if either HOMEBREW_FORCE_HOMEBREW_ON_LINUX or HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX are set
# - unless HOMEBREW_LINUXCORE_MERGE is set (by maintainers who still merge homebrew-core into linuxbrew-core)
# - only HOMEBREW_DEVELOPER users (for now)
# - not on GitHub Actions (for now)
elif [[ -n "${HOMEBREW_FORCE_HOMEBREW_ON_LINUX}" ||
-n "${HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX}" ]] ||
[[ -n "${HOMEBREW_DEVELOPER}" ]] &&
[[ -z "${HOMEBREW_LINUXCORE_MERGE}" ]] &&
[[ -z "${GITHUB_ACTIONS}" ]]
then
# TODO: this variable can go away when we're migrating everyone to homebrew-core.
HOMEBREW_CORE_ON_LINUX=1
# triggers migration code in update.sh # triggers migration code in update.sh
# shellcheck disable=SC2034 # shellcheck disable=SC2034
HOMEBREW_LINUXBREW_MIGRATION=1 HOMEBREW_LINUXBREW_CORE_MIGRATION=1
fi fi
fi fi
@ -595,13 +573,7 @@ then
unset HOMEBREW_BOTTLE_DOMAIN unset HOMEBREW_BOTTLE_DOMAIN
fi fi
if [[ -n "${HOMEBREW_MACOS}" ]] || HOMEBREW_BOTTLE_DEFAULT_DOMAIN="https://ghcr.io/v2/homebrew/core"
[[ -n "${HOMEBREW_CORE_ON_LINUX}" ]]
then
HOMEBREW_BOTTLE_DEFAULT_DOMAIN="https://ghcr.io/v2/homebrew/core"
else
HOMEBREW_BOTTLE_DEFAULT_DOMAIN="https://ghcr.io/v2/linuxbrew/core"
fi
HOMEBREW_USER_AGENT="${HOMEBREW_PRODUCT}/${HOMEBREW_USER_AGENT_VERSION} (${HOMEBREW_SYSTEM}; ${HOMEBREW_PROCESSOR} ${HOMEBREW_OS_USER_AGENT_VERSION})" HOMEBREW_USER_AGENT="${HOMEBREW_PRODUCT}/${HOMEBREW_USER_AGENT_VERSION} (${HOMEBREW_SYSTEM}; ${HOMEBREW_PROCESSOR} ${HOMEBREW_OS_USER_AGENT_VERSION})"
curl_version_output="$(curl --version 2>/dev/null)" curl_version_output="$(curl --version 2>/dev/null)"
@ -736,15 +708,7 @@ then
fi fi
export HOMEBREW_BREW_GIT_REMOTE export HOMEBREW_BREW_GIT_REMOTE
if [[ -n "${HOMEBREW_MACOS}" ]] || HOMEBREW_CORE_DEFAULT_GIT_REMOTE="https://github.com/Homebrew/homebrew-core"
[[ -n "${HOMEBREW_CORE_ON_LINUX}" ]]
then
HOMEBREW_CORE_DEFAULT_GIT_REMOTE="https://github.com/Homebrew/homebrew-core"
else
HOMEBREW_CORE_DEFAULT_GIT_REMOTE="https://github.com/Homebrew/linuxbrew-core"
fi
export HOMEBREW_CORE_DEFAULT_GIT_REMOTE
if [[ -z "${HOMEBREW_CORE_GIT_REMOTE}" ]] if [[ -z "${HOMEBREW_CORE_GIT_REMOTE}" ]]
then then
HOMEBREW_CORE_GIT_REMOTE="${HOMEBREW_CORE_DEFAULT_GIT_REMOTE}" HOMEBREW_CORE_GIT_REMOTE="${HOMEBREW_CORE_DEFAULT_GIT_REMOTE}"

View File

@ -42,6 +42,17 @@ module Homebrew
def update_report def update_report
args = update_report_args.parse args = update_report_args.parse
# Run `brew update` (again) if we've got a linuxbrew-core CoreTap
if CoreTap.instance.linuxbrew_core? && ENV["HOMEBREW_LINUXBREW_CORE_MIGRATION"].blank?
ENV["HOMEBREW_LINUXBREW_CORE_MIGRATION"] = "1"
update_args = []
update_args << "--preinstall" if args.preinstall?
update_args << "--force" if args.force?
ohai_stdout_or_stderr "Re-running `brew update` for linuxbrew-core migration"
FileUtils.rm_f HOMEBREW_LOCKS/"update"
exec HOMEBREW_BREW_FILE, "update", *update_args
end
if !Utils::Analytics.messages_displayed? && if !Utils::Analytics.messages_displayed? &&
!Utils::Analytics.disabled? && !Utils::Analytics.disabled? &&
!Utils::Analytics.no_message_output? !Utils::Analytics.no_message_output?
@ -107,7 +118,7 @@ module Homebrew
if ENV["HOMEBREW_MIGRATE_LINUXBREW_FORMULAE"].present? && tap.core_tap? && if ENV["HOMEBREW_MIGRATE_LINUXBREW_FORMULAE"].present? && tap.core_tap? &&
Settings.read("linuxbrewmigrated") != "true" Settings.read("linuxbrewmigrated") != "true"
puts_stdout_or_stderr "Migrating formulae from linuxbrew-core to homebrew-core" unless args.quiet? ohai_stdout_or_stderr "Migrating formulae from linuxbrew-core to homebrew-core"
LINUXBREW_CORE_MIGRATION_LIST.each do |name| LINUXBREW_CORE_MIGRATION_LIST.each do |name|
begin begin
@ -185,7 +196,7 @@ module Homebrew
end end
end end
puts_stdout_or_stderr if args.preinstall? puts_stdout_or_stderr if args.preinstall?
elsif !args.preinstall? && !ENV["HOMEBREW_UPDATE_FAILED"] elsif !args.preinstall? && !ENV["HOMEBREW_UPDATE_FAILED"] && !ENV["HOMEBREW_MIGRATE_LINUXBREW_FORMULAE"]
puts_stdout_or_stderr "Already up-to-date." unless args.quiet? puts_stdout_or_stderr "Already up-to-date." unless args.quiet?
end end

View File

@ -270,12 +270,12 @@ EOS
# ensure we don't munge line endings on checkout # ensure we don't munge line endings on checkout
git config core.autocrlf false git config core.autocrlf false
if [[ "${DIR}" == "${HOMEBREW_CORE_REPOSITORY}" && -n "${HOMEBREW_LINUXBREW_MIGRATION}" ]] if [[ "${DIR}" == "${HOMEBREW_CORE_REPOSITORY}" && -n "${HOMEBREW_LINUXBREW_CORE_MIGRATION}" ]]
then then
# Don't even try to rebase/merge on linuxbrew-core migration but rely on # Don't even try to rebase/merge on linuxbrew-core migration but rely on
# stashing etc. above. # stashing etc. above.
git reset --hard "${QUIET_ARGS[@]}" "${REMOTE_REF}" git reset --hard "${QUIET_ARGS[@]}" "${REMOTE_REF}"
unset HOMEBREW_LINUXBREW_MIGRATION unset HOMEBREW_LINUXBREW_CORE_MIGRATION
elif [[ -z "${HOMEBREW_MERGE}" ]] elif [[ -z "${HOMEBREW_MERGE}" ]]
then then
# Work around bug where git rebase --quiet is not quiet # Work around bug where git rebase --quiet is not quiet
@ -502,9 +502,9 @@ EOS
if [[ -d "${HOMEBREW_CORE_REPOSITORY}" ]] && if [[ -d "${HOMEBREW_CORE_REPOSITORY}" ]] &&
[[ "${HOMEBREW_CORE_DEFAULT_GIT_REMOTE}" != "${HOMEBREW_CORE_GIT_REMOTE}" || [[ "${HOMEBREW_CORE_DEFAULT_GIT_REMOTE}" != "${HOMEBREW_CORE_GIT_REMOTE}" ||
-n "${HOMEBREW_LINUXBREW_MIGRATION}" ]] -n "${HOMEBREW_LINUXBREW_CORE_MIGRATION}" ]]
then then
if [[ -n "${HOMEBREW_LINUXBREW_MIGRATION}" ]] if [[ -n "${HOMEBREW_LINUXBREW_CORE_MIGRATION}" ]]
then then
# This means a migration is needed (in case it isn't run this time) # This means a migration is needed (in case it isn't run this time)
safe_cd "${HOMEBREW_REPOSITORY}" safe_cd "${HOMEBREW_REPOSITORY}"

View File

@ -86,43 +86,6 @@ module Homebrew
end end
end end
def use_correct_linux_tap(formula, args:)
default_origin_branch = formula.tap.path.git_origin_branch
if !OS.linux? || !formula.tap.core_tap? || Homebrew::EnvConfig.force_homebrew_on_linux?
return formula.tap.remote_repo, "origin", default_origin_branch, "-"
end
tap_remote_repo = formula.tap.full_name.gsub("linuxbrew", "homebrew")
homebrew_core_url = "https://github.com/#{tap_remote_repo}"
homebrew_core_remote = "homebrew"
previous_branch = formula.tap.path.git_branch || "master"
formula_path = formula.path.relative_path_from(formula.tap.path)
full_origin_branch = "#{homebrew_core_remote}/#{default_origin_branch}"
if args.dry_run? || args.write? || args.write_only?
ohai "git remote add #{homebrew_core_remote} #{homebrew_core_url}"
ohai "git fetch #{homebrew_core_remote} HEAD #{default_origin_branch}"
ohai "git cat-file -e #{full_origin_branch}:#{formula_path}"
ohai "git checkout #{full_origin_branch}"
return tap_remote_repo, homebrew_core_remote, default_origin_branch, previous_branch
end
formula.tap.path.cd do
unless Utils.popen_read("git", "remote", "-v").match?(%r{^homebrew.*Homebrew/homebrew-core.*$})
ohai "Adding #{homebrew_core_remote} remote"
safe_system "git", "remote", "add", homebrew_core_remote, homebrew_core_url
end
ohai "Fetching remote #{homebrew_core_remote}"
safe_system "git", "fetch", homebrew_core_remote, "HEAD", default_origin_branch
if quiet_system "git", "cat-file", "-e", "#{full_origin_branch}:#{formula_path}"
ohai "#{formula.full_name} exists in #{full_origin_branch}."
safe_system "git", "checkout", full_origin_branch
return tap_remote_repo, homebrew_core_remote, default_origin_branch, previous_branch
end
end
end
def bump_formula_pr def bump_formula_pr
args = bump_formula_pr_args.parse args = bump_formula_pr_args.parse
@ -157,7 +120,11 @@ module Homebrew
# spamming during normal output. # spamming during normal output.
Homebrew.install_bundler_gems! Homebrew.install_bundler_gems!
tap_remote_repo, remote, remote_branch, previous_branch = use_correct_linux_tap(formula, args: args) tap_remote_repo = formula.tap.remote_repo
remote = "origin"
remote_branch = formula.tap.path.git_origin_branch
previous_branch = "-"
check_open_pull_requests(formula, tap_remote_repo, args: args) check_open_pull_requests(formula, tap_remote_repo, args: args)
new_version = args.version new_version = args.version
@ -302,16 +269,6 @@ module Homebrew
] ]
end end
# When bumping a linux-only formula, one needs to also delete the
# sha256 linux bottle line if it exists. That's because of running
# test-bot with --keep-old option in linuxbrew-core.
if old_contents.include?("depends_on :linux") && old_contents.include?("=> :x86_64_linux")
replacement_pairs << [
/^ sha256 ".+" => :x86_64_linux\n/m,
"\\2",
]
end
if forced_version && new_version != "0" if forced_version && new_version != "0"
replacement_pairs << if old_contents.include?("version \"#{old_formula_version}\"") replacement_pairs << if old_contents.include?("version \"#{old_formula_version}\"")
[ [

View File

@ -50,8 +50,7 @@ module Homebrew
"download from the prefix `http://localhost:8080/`. " \ "download from the prefix `http://localhost:8080/`. " \
"If bottles are not available at `HOMEBREW_BOTTLE_DOMAIN` " \ "If bottles are not available at `HOMEBREW_BOTTLE_DOMAIN` " \
"they will be downloaded from the default bottle domain.", "they will be downloaded from the default bottle domain.",
default_text: "macOS: `https://ghcr.io/v2/homebrew/core`, " \ default_text: "`https://ghcr.io/v2/homebrew/core`.",
"Linux: `https://ghcr.io/v2/linuxbrew/core`.",
default: HOMEBREW_BOTTLE_DEFAULT_DOMAIN, default: HOMEBREW_BOTTLE_DEFAULT_DOMAIN,
}, },
HOMEBREW_BREW_GIT_REMOTE: { HOMEBREW_BREW_GIT_REMOTE: {
@ -90,8 +89,7 @@ module Homebrew
}, },
HOMEBREW_CORE_GIT_REMOTE: { HOMEBREW_CORE_GIT_REMOTE: {
description: "Use this URL as the Homebrew/homebrew-core `git`(1) remote.", description: "Use this URL as the Homebrew/homebrew-core `git`(1) remote.",
default_text: "macOS: `https://github.com/Homebrew/homebrew-core`, " \ default_text: "`https://github.com/Homebrew/homebrew-core`.",
"Linux: `https://github.com/Homebrew/linuxbrew-core`.",
default: HOMEBREW_CORE_DEFAULT_GIT_REMOTE, default: HOMEBREW_CORE_DEFAULT_GIT_REMOTE,
}, },
HOMEBREW_CURLRC: { HOMEBREW_CURLRC: {
@ -157,11 +155,6 @@ module Homebrew
"Automatically set if the system version of `git` is too old.", "Automatically set if the system version of `git` is too old.",
boolean: true, boolean: true,
}, },
HOMEBREW_FORCE_HOMEBREW_ON_LINUX: {
description: "If set, running Homebrew on Linux will use URLs for macOS and will use homebrew-core instead " \
"of linuxbrew-core. This is useful when merging pull requests for macOS while on Linux.",
boolean: true,
},
HOMEBREW_FORCE_VENDOR_RUBY: { HOMEBREW_FORCE_VENDOR_RUBY: {
description: "If set, always use Homebrew's vendored, relocatable Ruby version even if the system version " \ description: "If set, always use Homebrew's vendored, relocatable Ruby version even if the system version " \
"of Ruby is new enough.", "of Ruby is new enough.",
@ -279,11 +272,7 @@ module Homebrew
}, },
HOMEBREW_SIMULATE_MACOS_ON_LINUX: { HOMEBREW_SIMULATE_MACOS_ON_LINUX: {
description: "If set, running Homebrew on Linux will simulate certain macOS code paths. This is useful " \ description: "If set, running Homebrew on Linux will simulate certain macOS code paths. This is useful " \
"when auditing macOS formulae while on Linux. Implies `HOMEBREW_FORCE_HOMEBREW_ON_LINUX`.", "when auditing macOS formulae while on Linux.",
boolean: true,
},
HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX: {
description: "If set, running Homebrew on Linux will use homebrew-core instead of linuxbrew-core.",
boolean: true, boolean: true,
}, },
HOMEBREW_SSH_CONFIG_PATH: { HOMEBREW_SSH_CONFIG_PATH: {

View File

@ -1,4 +0,0 @@
# typed: strict
# frozen_string_literal: true
require "extend/os/linux/api/analytics" if OS.linux?

View File

@ -1,4 +0,0 @@
# typed: strict
# frozen_string_literal: true
require "extend/os/linux/api/bottle" if OS.linux?

View File

@ -1,4 +0,0 @@
# typed: strict
# frozen_string_literal: true
require "extend/os/linux/api/formula" if OS.linux?

View File

@ -1,18 +0,0 @@
# typed: strict
# frozen_string_literal: true
module Homebrew
module API
module Analytics
class << self
def analytics_api_path
return generic_analytics_api_path if
Homebrew::EnvConfig.force_homebrew_on_linux? ||
Homebrew::EnvConfig.force_homebrew_core_repo_on_linux?
"analytics-linux"
end
end
end
end
end

View File

@ -1,18 +0,0 @@
# typed: strict
# frozen_string_literal: true
module Homebrew
module API
module Bottle
class << self
def bottle_api_path
return generic_bottle_api_path if
Homebrew::EnvConfig.force_homebrew_on_linux? ||
Homebrew::EnvConfig.force_homebrew_core_repo_on_linux?
"bottle-linux"
end
end
end
end
end

View File

@ -1,18 +0,0 @@
# typed: strict
# frozen_string_literal: true
module Homebrew
module API
module Formula
class << self
def formula_api_path
return generic_formula_api_path if
Homebrew::EnvConfig.force_homebrew_on_linux? ||
Homebrew::EnvConfig.force_homebrew_core_repo_on_linux?
"formula-linux"
end
end
end
end
end

View File

@ -10,6 +10,15 @@ require "os/linux/kernel"
module Homebrew module Homebrew
module Diagnostic module Diagnostic
class Checks class Checks
undef fatal_preinstall_checks, supported_configuration_checks
def fatal_preinstall_checks
%w[
check_access_directories
check_linuxbrew_core
].freeze
end
def supported_configuration_checks def supported_configuration_checks
%w[ %w[
check_glibc_minimum_version check_glibc_minimum_version
@ -109,6 +118,15 @@ module Homebrew
or changing distributions. or changing distributions.
EOS EOS
end end
def check_linuxbrew_core
return unless CoreTap.instance.linuxbrew_core?
<<~EOS
Your Linux Homebrew/core repository is still linuxbrew-core.
You must `brew update` to update to homebrew-core.
EOS
end
end end
end end
end end

View File

@ -1,10 +0,0 @@
# typed: true
# frozen_string_literal: true
class CoreTap < Tap
# @private
def initialize
super "Homebrew", "core"
@full_name = "Homebrew/linuxbrew-core" if HOMEBREW_CORE_DEFAULT_GIT_REMOTE.include?("Homebrew/linuxbrew-core")
end
end

View File

@ -1,5 +1,4 @@
# typed: strict # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
require "extend/os/linux/tap" if OS.linux?
require "extend/os/mac/tap" if OS.mac? require "extend/os/mac/tap" if OS.mac?

View File

@ -68,8 +68,6 @@ class GitHubPackages
HOMEBREW_PREFIX/"bin/skopeo", HOMEBREW_PREFIX/"bin/skopeo",
].compact.first ].compact.first
unless skopeo.exist? unless skopeo.exist?
odie "no `skopeo` and HOMEBREW_FORCE_HOMEBREW_ON_LINUX is set!" if Homebrew::EnvConfig.force_homebrew_on_linux?
ohai "Installing `skopeo` for upload..." ohai "Installing `skopeo` for upload..."
safe_system HOMEBREW_BREW_FILE, "install", "--formula", "skopeo" safe_system HOMEBREW_BREW_FILE, "install", "--formula", "skopeo"
skopeo = Formula["skopeo"].opt_bin/"skopeo" skopeo = Formula["skopeo"].opt_bin/"skopeo"
@ -273,13 +271,7 @@ class GitHubPackages
git_path = bottle_hash["formula"]["tap_git_path"] git_path = bottle_hash["formula"]["tap_git_path"]
git_revision = bottle_hash["formula"]["tap_git_revision"] git_revision = bottle_hash["formula"]["tap_git_revision"]
# we're uploading Homebrew/linuxbrew-core bottles to Linuxbrew with a core/ source_org_repo = "#{org}/#{repo}"
# prefix.
source_org_repo = if org.casecmp("linuxbrew").zero? && repo == "homebrew-core"
"Homebrew/linuxbrew-core"
else
"#{org}/#{repo}"
end
source = "https://github.com/#{source_org_repo}/blob/#{git_revision.presence || "HEAD"}/#{git_path}" source = "https://github.com/#{source_org_repo}/blob/#{git_revision.presence || "HEAD"}/#{git_path}"
formula_core_tap = formula_full_name.exclude?("/") formula_core_tap = formula_full_name.exclude?("/")

View File

@ -418,10 +418,6 @@ module RuboCop
end end
next if valid next if valid
# TODO: temporarily allow this for linuxbrew-core merge.
next if method&.parent&.parent&.source&.start_with?("revision OS.mac?")
next if method&.parent&.source&.match?(/revision \d unless OS\.mac\?/)
offending_node(method) offending_node(method)
problem "Don't use '#{if_method_and_class}', use '#{on_method_name} do' instead." do |corrector| problem "Don't use '#{if_method_and_class}', use '#{on_method_name} do' instead." do |corrector|
if_node = method.parent if_node = method.parent

View File

@ -4570,10 +4570,6 @@ module Homebrew::EnvConfig
def self.force_brewed_git?(); end def self.force_brewed_git?(); end
def self.force_homebrew_core_repo_on_linux?(); end
def self.force_homebrew_on_linux?(); end
def self.force_vendor_ruby?(); end def self.force_vendor_ruby?(); end
def self.ftp_proxy(); end def self.ftp_proxy(); end

View File

@ -807,6 +807,12 @@ class CoreTap < Tap
true true
end end
# @private
sig { returns(T::Boolean) }
def linuxbrew_core?
remote_repo.to_s.end_with?("/linuxbrew-core")
end
# @private # @private
def formula_dir def formula_dir
@formula_dir ||= begin @formula_dir ||= begin

View File

@ -2,7 +2,7 @@
Are you missing your favorite software in Homebrew? Then you're the perfect person to resolve this problem. Are you missing your favorite software in Homebrew? Then you're the perfect person to resolve this problem.
Before you start, please check the open pull requests for [homebrew-core](https://github.com/Homebrew/homebrew-core/pulls) or [linuxbrew-core](https://github.com/Homebrew/linuxbrew-core/pulls), to make sure no one else beat you to the punch. Before you start, please check the open pull requests for [homebrew-core](https://github.com/Homebrew/homebrew-core/pulls), to make sure no one else beat you to the punch.
Next, you will want to go through the [Acceptable Formulae](Acceptable-Formulae.md) documentation to determine if the software is an appropriate addition to Homebrew. If you are creating a formula for an alternative version of software already in Homebrew (for example, a major/minor version that significantly differs from the existing version), be sure to read the [Versions](Versions.md) documentation to understand versioned formulae requirements. Next, you will want to go through the [Acceptable Formulae](Acceptable-Formulae.md) documentation to determine if the software is an appropriate addition to Homebrew. If you are creating a formula for an alternative version of software already in Homebrew (for example, a major/minor version that significantly differs from the existing version), be sure to read the [Versions](Versions.md) documentation to understand versioned formulae requirements.
@ -29,6 +29,6 @@ If you're stuck, ask for help on GitHub or [Homebrew/discussions](https://github
## Submitting the formula ## Submitting the formula
You're finally ready to submit your formula to the [homebrew-core](https://github.com/Homebrew/homebrew-core/) or [linuxbrew-core](https://github.com/Homebrew/linuxbrew-core/) repository. If you haven't done this before, you can refer to the [How to Open a Pull Request](How-To-Open-a-Homebrew-Pull-Request.md) documentation for help. Maintainers will review the pull request and provide feedback about any areas that need to be addressed before the formula can be added to Homebrew. You're finally ready to submit your formula to the [homebrew-core](https://github.com/Homebrew/homebrew-core/) repository. If you haven't done this before, you can refer to the [How to Open a Pull Request](How-To-Open-a-Homebrew-Pull-Request.md) documentation for help. Maintainers will review the pull request and provide feedback about any areas that need to be addressed before the formula can be added to Homebrew.
If you've made it this far, congratulations on submitting a Homebrew formula! We appreciate the hard work you put into this and you can take satisfaction in knowing that your work may benefit other Homebrew users as well. If you've made it this far, congratulations on submitting a Homebrew formula! We appreciate the hard work you put into this and you can take satisfaction in knowing that your work may benefit other Homebrew users as well.

View File

@ -69,8 +69,7 @@ There are many checks that run on every PR. The following is a quick list of the
- `CI / syntax`: This is run first to check whether the PR passes `brew style` and `brew typecheck`. If this job fails the - `CI / syntax`: This is run first to check whether the PR passes `brew style` and `brew typecheck`. If this job fails the
following jobs will not run. following jobs will not run.
- `CI / tap syntax (Linux)`: This runs `brew style` and `brew audit` on all official taps - `CI / tap syntax (Linux)`: This runs `brew style` and `brew audit` on all official taps
(note that although this has Linux in its name, it does check `Homebrew/homebrew-core`, (note that although this has Linux in its name, it does check `Homebrew/homebrew-core` and all cask repos).
`Homebrew/linuxbrew-core` and all cask repos).
- `CI / docker`: This builds and deploys a new Homebrew Docker image. - `CI / docker`: This builds and deploys a new Homebrew Docker image.
- `CI / test everything (macOS)`: This runs several checks on macOS including `brew tests`, `brew update-tests`, - `CI / test everything (macOS)`: This runs several checks on macOS including `brew tests`, `brew update-tests`,
`brew test-bot --only-formulae --test-default-formula`, `brew readall` and `brew doctor`. `brew test-bot --only-formulae --test-default-formula`, `brew readall` and `brew doctor`.

View File

@ -81,5 +81,4 @@ Homebrew does not currently support 32-bit x86 platforms. It would be possible f
## Homebrew on Linux Community ## Homebrew on Linux Community
- [@HomebrewOnLinux on Twitter](https://twitter.com/HomebrewOnLinux) - [@HomebrewOnLinux on Twitter](https://twitter.com/HomebrewOnLinux)
- [Homebrew/linuxbrew-core on GitHub](https://github.com/Homebrew/linuxbrew-core)
- [Homebrew/discussions (forum)](https://github.com/homebrew/discussions/discussions) - [Homebrew/discussions (forum)](https://github.com/homebrew/discussions/discussions)

View File

@ -17,9 +17,8 @@ but there are four main teams that maintainers tend to be a part of:
- Core maintainers: this team maintains the [`Homebrew/homebrew-core`](https://github.com/Homebrew/homebrew-core) - Core maintainers: this team maintains the [`Homebrew/homebrew-core`](https://github.com/Homebrew/homebrew-core)
repository. See the [Homebrew/homebrew-core Maintainer Guide](Homebrew-homebrew-core-Maintainer-Guide.md) repository. See the [Homebrew/homebrew-core Maintainer Guide](Homebrew-homebrew-core-Maintainer-Guide.md)
for more details about being a core maintainer. for more details about being a core maintainer.
- Linux maintainers: this team maintains the [`Homebrew/linuxbrew-core`](https://github.com/Homebrew/linuxbrew-core) - Linux maintainers: this team maintains the [`Homebrew/homebrew-core`](https://github.com/Homebrew/homebrew-core)
repository. See the [Homebrew/linuxbrew-core Maintainer Guide](Homebrew-linuxbrew-core-Maintainer-Guide.md) repository on Linux.
for more details about being a Linux maintainer.
- Cask maintainers: this team maintains the [`Homebrew/homebrew-cask`](https://github.com/Homebrew/homebrew-cask), - Cask maintainers: this team maintains the [`Homebrew/homebrew-cask`](https://github.com/Homebrew/homebrew-cask),
[`Homebrew/homebrew-cask-drivers`](https://github.com/Homebrew/homebrew-cask-drivers), [`Homebrew/homebrew-cask-drivers`](https://github.com/Homebrew/homebrew-cask-drivers),
[`Homebrew/homebrew-cask-fonts`](https://github.com/Homebrew/homebrew-cask-fonts) and [`Homebrew/homebrew-cask-fonts`](https://github.com/Homebrew/homebrew-cask-fonts) and

View File

@ -1905,7 +1905,7 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
- `HOMEBREW_BOTTLE_DOMAIN` - `HOMEBREW_BOTTLE_DOMAIN`
<br>Use this URL as the download mirror for bottles. If bottles at that URL are temporarily unavailable, the default bottle domain will be used as a fallback mirror. For example, `HOMEBREW_BOTTLE_DOMAIN=http://localhost:8080` will cause all bottles to download from the prefix `http://localhost:8080/`. If bottles are not available at `HOMEBREW_BOTTLE_DOMAIN` they will be downloaded from the default bottle domain. <br>Use this URL as the download mirror for bottles. If bottles at that URL are temporarily unavailable, the default bottle domain will be used as a fallback mirror. For example, `HOMEBREW_BOTTLE_DOMAIN=http://localhost:8080` will cause all bottles to download from the prefix `http://localhost:8080/`. If bottles are not available at `HOMEBREW_BOTTLE_DOMAIN` they will be downloaded from the default bottle domain.
*Default:* macOS: `https://ghcr.io/v2/homebrew/core`, Linux: `https://ghcr.io/v2/linuxbrew/core`. *Default:* `https://ghcr.io/v2/homebrew/core`.
- `HOMEBREW_BREW_GIT_REMOTE` - `HOMEBREW_BREW_GIT_REMOTE`
<br>Use this URL as the Homebrew/brew `git`(1) remote. <br>Use this URL as the Homebrew/brew `git`(1) remote.
@ -1943,7 +1943,7 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
- `HOMEBREW_CORE_GIT_REMOTE` - `HOMEBREW_CORE_GIT_REMOTE`
<br>Use this URL as the Homebrew/homebrew-core `git`(1) remote. <br>Use this URL as the Homebrew/homebrew-core `git`(1) remote.
*Default:* macOS: `https://github.com/Homebrew/homebrew-core`, Linux: `https://github.com/Homebrew/linuxbrew-core`. *Default:* `https://github.com/Homebrew/homebrew-core`.
- `HOMEBREW_CURLRC` - `HOMEBREW_CURLRC`
<br>If set, do not pass `--disable` when invoking `curl`(1), which disables the use of `curlrc`. <br>If set, do not pass `--disable` when invoking `curl`(1), which disables the use of `curlrc`.
@ -1994,9 +1994,6 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
- `HOMEBREW_FORCE_BREWED_GIT` - `HOMEBREW_FORCE_BREWED_GIT`
<br>If set, always use a Homebrew-installed `git`(1) rather than the system version. Automatically set if the system version of `git` is too old. <br>If set, always use a Homebrew-installed `git`(1) rather than the system version. Automatically set if the system version of `git` is too old.
- `HOMEBREW_FORCE_HOMEBREW_ON_LINUX`
<br>If set, running Homebrew on Linux will use URLs for macOS and will use homebrew-core instead of linuxbrew-core. This is useful when merging pull requests for macOS while on Linux.
- `HOMEBREW_FORCE_VENDOR_RUBY` - `HOMEBREW_FORCE_VENDOR_RUBY`
<br>If set, always use Homebrew's vendored, relocatable Ruby version even if the system version of Ruby is new enough. <br>If set, always use Homebrew's vendored, relocatable Ruby version even if the system version of Ruby is new enough.
@ -2086,10 +2083,7 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
<br>If set, use Pry for the `brew irb` command. <br>If set, use Pry for the `brew irb` command.
- `HOMEBREW_SIMULATE_MACOS_ON_LINUX` - `HOMEBREW_SIMULATE_MACOS_ON_LINUX`
<br>If set, running Homebrew on Linux will simulate certain macOS code paths. This is useful when auditing macOS formulae while on Linux. Implies `HOMEBREW_FORCE_HOMEBREW_ON_LINUX`. <br>If set, running Homebrew on Linux will simulate certain macOS code paths. This is useful when auditing macOS formulae while on Linux.
- `HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX`
<br>If set, running Homebrew on Linux will use homebrew-core instead of linuxbrew-core.
- `HOMEBREW_SSH_CONFIG_PATH` - `HOMEBREW_SSH_CONFIG_PATH`
<br>If set, Homebrew will use the given config file instead of `~/.ssh/config` when fetching `git` repos over `ssh`. <br>If set, Homebrew will use the given config file instead of `~/.ssh/config` when fetching `git` repos over `ssh`.

View File

@ -34,7 +34,6 @@ A few requests:
Here are links to these guides: Here are links to these guides:
- Homebrew/brew: https://docs.brew.sh/Homebrew-brew-Maintainer-Guide - Homebrew/brew: https://docs.brew.sh/Homebrew-brew-Maintainer-Guide
- Homebrew/homebrew-core: https://docs.brew.sh/Homebrew-homebrew-core-Maintainer-Guide - Homebrew/homebrew-core: https://docs.brew.sh/Homebrew-homebrew-core-Maintainer-Guide
- Homebrew/linuxbrew-core: https://docs.brew.sh/Homebrew-linuxbrew-core-Maintainer-Guide
- Homebrew/homebrew-cask: https://docs.brew.sh/Homebrew-homebrew-cask-Maintainer-Guide - Homebrew/homebrew-cask: https://docs.brew.sh/Homebrew-homebrew-cask-Maintainer-Guide
- Still create your branches on your fork rather than in the main repository. - Still create your branches on your fork rather than in the main repository.
Note GitHub's UI will create edits and reverts on the main repository if you Note GitHub's UI will create edits and reverts on the main repository if you

View File

@ -10,7 +10,7 @@ This document will help you check for common issues and make sure your issue has
## Check to see if the issue has been reported ## Check to see if the issue has been reported
* Search the [Homebrew/homebrew-core issue tracker](https://github.com/Homebrew/homebrew-core/issues) or [Homebrew/linuxbrew-core issue tracker](https://github.com/Homebrew/linuxbrew-core/issues) to see if someone else has already reported the same issue. * Search the [Homebrew/homebrew-core issue tracker](https://github.com/Homebrew/homebrew-core/issues) to see if someone else has already reported the same issue.
* If a formula that has failed to build is part of a non-core tap or a cask is part of [homebrew/cask](https://github.com/Homebrew/homebrew-cask/issues) check those issue trackers instead. * If a formula that has failed to build is part of a non-core tap or a cask is part of [homebrew/cask](https://github.com/Homebrew/homebrew-cask/issues) check those issue trackers instead.
* Search the [Homebrew discussion forum](https://github.com/homebrew/discussions/discussions) or [Discourse](https://discourse.brew.sh/) to see if any discussions have started about the issue. * Search the [Homebrew discussion forum](https://github.com/homebrew/discussions/discussions) or [Discourse](https://discourse.brew.sh/) to see if any discussions have started about the issue.
@ -23,7 +23,7 @@ If your problem hasn't been solved or reported, then create an issue:
* If you had a formula-related problem: run `brew gist-logs <formula>` (where `<formula>` is the name of the formula). * If you had a formula-related problem: run `brew gist-logs <formula>` (where `<formula>` is the name of the formula).
* If you encountered a non-formula problem: upload the output of `brew config` and `brew doctor` to a new [Gist](https://gist.github.com). * If you encountered a non-formula problem: upload the output of `brew config` and `brew doctor` to a new [Gist](https://gist.github.com).
2. Create a new issue on the [Homebrew/homebrew-core issue tracker](https://github.com/Homebrew/homebrew-core/issues/new/choose) or [Homebrew/linuxbrew-core issue tracker](https://github.com/Homebrew/linuxbrew-core/issues/new/choose) 2. Create a new issue on the [Homebrew/homebrew-core issue tracker](https://github.com/Homebrew/homebrew-core/issues/new/choose)
* Give your issue a descriptive title which includes the formula name (if applicable) and the version of macOS or Linux you are using. For example, if a formula fails to build, title your issue "\<formula> failed to build on \<10.x>", where "\<formula>" is the name of the formula that failed to build, and "\<10.x>" is the version of macOS or Linux you are using. * Give your issue a descriptive title which includes the formula name (if applicable) and the version of macOS or Linux you are using. For example, if a formula fails to build, title your issue "\<formula> failed to build on \<10.x>", where "\<formula>" is the name of the formula that failed to build, and "\<10.x>" is the version of macOS or Linux you are using.
* Include the URL output by `brew gist-logs <formula>` (if applicable). * Include the URL output by `brew gist-logs <formula>` (if applicable).

View File

@ -2,7 +2,7 @@
Did you find something in Homebrew that wasn't the latest version? You can help yourself and others by submitting a pull request to update the formula. Did you find something in Homebrew that wasn't the latest version? You can help yourself and others by submitting a pull request to update the formula.
First, check the pull requests in the [homebrew-core](https://github.com/Homebrew/homebrew-core/pulls) or [linuxbrew-core](https://github.com/Homebrew/linuxbrew-core/pulls) repositories (whichever apply) to make sure there isn't already an open PR. You may also want to look through closed pull requests for the formula, as sometimes formulae run into problems preventing them from being updated and it's better to be aware of any issues before putting significant effort into an update. First, check the pull requests in the [homebrew-core](https://github.com/Homebrew/homebrew-core/pulls) repository to make sure there isn't already an open PR. You may also want to look through closed pull requests for the formula, as sometimes formulae run into problems preventing them from being updated and it's better to be aware of any issues before putting significant effort into an update.
The [How To Open a Homebrew Pull Request](How-To-Open-a-Homebrew-Pull-Request.md) documentation should explain most everything you need to know about the process of creating a PR for a version update. For simple formulae updates, this typically involves changing the URL and sha256. The [How To Open a Homebrew Pull Request](How-To-Open-a-Homebrew-Pull-Request.md) documentation should explain most everything you need to know about the process of creating a PR for a version update. For simple formulae updates, this typically involves changing the URL and sha256.

View File

@ -2695,7 +2695,7 @@ If set, use Bootsnap to speed up repeated \fBbrew\fR calls\. A no\-op when using
Use this URL as the download mirror for bottles\. If bottles at that URL are temporarily unavailable, the default bottle domain will be used as a fallback mirror\. For example, \fBHOMEBREW_BOTTLE_DOMAIN=http://localhost:8080\fR will cause all bottles to download from the prefix \fBhttp://localhost:8080/\fR\. If bottles are not available at \fBHOMEBREW_BOTTLE_DOMAIN\fR they will be downloaded from the default bottle domain\. Use this URL as the download mirror for bottles\. If bottles at that URL are temporarily unavailable, the default bottle domain will be used as a fallback mirror\. For example, \fBHOMEBREW_BOTTLE_DOMAIN=http://localhost:8080\fR will cause all bottles to download from the prefix \fBhttp://localhost:8080/\fR\. If bottles are not available at \fBHOMEBREW_BOTTLE_DOMAIN\fR they will be downloaded from the default bottle domain\.
. .
.IP .IP
\fIDefault:\fR macOS: \fBhttps://ghcr\.io/v2/homebrew/core\fR, Linux: \fBhttps://ghcr\.io/v2/linuxbrew/core\fR\. \fIDefault:\fR \fBhttps://ghcr\.io/v2/homebrew/core\fR\.
. .
.TP .TP
\fBHOMEBREW_BREW_GIT_REMOTE\fR \fBHOMEBREW_BREW_GIT_REMOTE\fR
@ -2764,7 +2764,7 @@ If set, force colour output on non\-TTY outputs\.
Use this URL as the Homebrew/homebrew\-core \fBgit\fR(1) remote\. Use this URL as the Homebrew/homebrew\-core \fBgit\fR(1) remote\.
. .
.IP .IP
\fIDefault:\fR macOS: \fBhttps://github\.com/Homebrew/homebrew\-core\fR, Linux: \fBhttps://github\.com/Homebrew/linuxbrew\-core\fR\. \fIDefault:\fR \fBhttps://github\.com/Homebrew/homebrew\-core\fR\.
. .
.TP .TP
\fBHOMEBREW_CURLRC\fR \fBHOMEBREW_CURLRC\fR
@ -2860,12 +2860,6 @@ If set, always use a Homebrew\-installed \fBcurl\fR(1) rather than the system ve
If set, always use a Homebrew\-installed \fBgit\fR(1) rather than the system version\. Automatically set if the system version of \fBgit\fR is too old\. If set, always use a Homebrew\-installed \fBgit\fR(1) rather than the system version\. Automatically set if the system version of \fBgit\fR is too old\.
. .
.TP .TP
\fBHOMEBREW_FORCE_HOMEBREW_ON_LINUX\fR
.
.br
If set, running Homebrew on Linux will use URLs for macOS and will use homebrew\-core instead of linuxbrew\-core\. This is useful when merging pull requests for macOS while on Linux\.
.
.TP
\fBHOMEBREW_FORCE_VENDOR_RUBY\fR \fBHOMEBREW_FORCE_VENDOR_RUBY\fR
. .
.br .br
@ -3037,13 +3031,7 @@ If set, use Pry for the \fBbrew irb\fR command\.
\fBHOMEBREW_SIMULATE_MACOS_ON_LINUX\fR \fBHOMEBREW_SIMULATE_MACOS_ON_LINUX\fR
. .
.br .br
If set, running Homebrew on Linux will simulate certain macOS code paths\. This is useful when auditing macOS formulae while on Linux\. Implies \fBHOMEBREW_FORCE_HOMEBREW_ON_LINUX\fR\. If set, running Homebrew on Linux will simulate certain macOS code paths\. This is useful when auditing macOS formulae while on Linux\.
.
.TP
\fBHOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX\fR
.
.br
If set, running Homebrew on Linux will use homebrew\-core instead of linuxbrew\-core\.
. .
.TP .TP
\fBHOMEBREW_SSH_CONFIG_PATH\fR \fBHOMEBREW_SSH_CONFIG_PATH\fR