Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 6 additions & 46 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
push:
branches:
- main
- master
merge_group:
release:
types:
Expand All @@ -19,8 +18,7 @@ defaults:
shell: bash -xeuo pipefail {0}

env:
# odeprecated: remove 20.04 image in Homebrew >=4.7
VERSIONS: '["20.04", "22.04", "24.04"]'
VERSIONS: '["22.04", "24.04"]'

jobs:
generate-tags:
Expand Down Expand Up @@ -72,29 +70,19 @@ jobs:
tags+=(
"ghcr.io/homebrew/ubuntu${version}:${brew_version}"
"ghcr.io/homebrew/ubuntu${version}:latest"
"homebrew/ubuntu${version}:${brew_version}"
"homebrew/ubuntu${version}:latest"
)
if [[ "${version}" == "22.04" ]]; then
tags+=(
"ghcr.io/homebrew/brew:${brew_version}"
"ghcr.io/homebrew/brew:latest"
"homebrew/brew:${brew_version}"
"homebrew/brew:latest"
)
fi
elif [[ "${GITHUB_EVENT_NAME}" == "push" &&
("${GITHUB_REF}" == "refs/heads/master" || "${GITHUB_REF}" == "refs/heads/main") &&
("${GITHUB_REF}" == "refs/heads/main") &&
"${version}" == "22.04" ]]; then
tags+=(
"ghcr.io/homebrew/brew:main"
"ghcr.io/homebrew/brew:master"
"ghcr.io/homebrew/ubuntu${version}:main"
"ghcr.io/homebrew/ubuntu${version}:master"
"homebrew/brew:main"
"homebrew/brew:master"
"homebrew/ubuntu${version}:main"
"homebrew/ubuntu${version}:master"
)
fi

Expand Down Expand Up @@ -151,13 +139,9 @@ jobs:
strategy:
fail-fast: false
matrix:
# odeprecated: remove 20.04 image in Homebrew >=4.7
version: ["20.04", "22.04", "24.04"]
version: ["22.04", "24.04"]
arch: ["x86_64", "arm64"]
exclude:
# odeprecated: remove 20.04 image in Homebrew >=4.7
- version: "20.04"
arch: "arm64"

steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
Expand All @@ -179,11 +163,6 @@ jobs:
VERSION: ${{ matrix.version }}
PUSH: ${{ needs.generate-tags.outputs.push }}
run: |
# odeprecated: remove 20.04 image in Homebrew >=4.7
if [[ "${VERSION}" == "20.04" ]]; then
echo "The homebrew/ubuntu20.04 image is deprecated and will soon be retired. Use homebrew/ubuntu24.04 or homebrew/brew." > .docker-deprecate
fi

filter="$(printf '.["%s"]' "${VERSION}")"
echo "push=$(jq --raw-output "${filter}" <<<"${PUSH}")" >>"${GITHUB_OUTPUT}"

Expand All @@ -204,18 +183,8 @@ jobs:
build-args: version=${{ matrix.version }}
labels: ${{ needs.generate-tags.outputs.labels }}

- name: Set environment variables
run: |
# odeprecated: remove 20.04 in Homebrew >=4.7
if [[ "${VERSION}" == "20.04" ]]; then
echo "HOMEBREW_GLIBC_TESTING=1" >> "$GITHUB_ENV"
fi
env:
VERSION: ${{ matrix.version }}
ARCH: ${{ matrix.arch }}

- name: Run brew test-bot --only-setup
run: docker run --env HOMEBREW_GLIBC_TESTING --rm brew brew test-bot --only-setup
run: docker run --rm brew brew test-bot --only-setup

- name: Log in to GitHub Packages (BrewTestBot)
if: fromJSON(steps.attributes.outputs.push)
Expand Down Expand Up @@ -275,12 +244,6 @@ jobs:
pattern: digest-${{ matrix.version }}-*
merge-multiple: true

- name: Log in to Docker Hub
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
username: brewtestbot
password: ${{ secrets.HOMEBREW_BREW_DOCKER_TOKEN }}

- name: Log in to GitHub Packages (BrewTestBot)
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
Expand All @@ -301,10 +264,7 @@ jobs:
done <<<"$(jq --raw-output "${filter}" <<<"${TAGS}")"

image_args=("ghcr.io/homebrew/ubuntu${VERSION}@sha256:$(<"${RUNNER_TEMP}/digests/${VERSION}-x86_64")")
# odeprecated: remove 20.04 image in Homebrew >=4.7
if [[ "${VERSION}" != 20.04 ]]; then
image_args+=("ghcr.io/homebrew/ubuntu${VERSION}@sha256:$(<"${RUNNER_TEMP}/digests/${VERSION}-arm64")")
fi
image_args+=("ghcr.io/homebrew/ubuntu${VERSION}@sha256:$(<"${RUNNER_TEMP}/digests/${VERSION}-arm64")")

attempts=0
until docker buildx imagetools create "${tag_args[@]}" "${image_args[@]}"; do
Expand Down
4 changes: 4 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Please follow these guidelines when contributing:
Individual test files can be passed with `--only` e.g. to test `Library/Homebrew/cmd/reinstall.rb` with `Library/Homebrew/test/cmd/reinstall_spec.rb` run `brew tests --only=cmd/reinstall`.
- All of the above can be run with the `brew-mcp-server`

### Sandbox Setup

- When working in a sandboxed environment e.g. OpenAI Codex, copy the contents of `$(brew --cache)/api/` to a writable location inside the repository (for example, `tmp/cache/api/`) and `export HOMEBREW_CACHE` to that writable directory before running `brew tests`. This avoids permission errors when the suite tries to write API cache or runtime logs.

### Development Flow

- Write new code (using Sorbet `sig` type signatures and `typed: strict` for new files, but never for RSpec/test/`*_spec.rb` files)
Expand Down
33 changes: 5 additions & 28 deletions Library/Homebrew/brew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -618,50 +618,27 @@ then
HOMEBREW_OS_VERSION="macOS ${HOMEBREW_MACOS_VERSION}"
fi

# Refuse to run on pre-El Capitan
# Refuse to run on pre-Catalina
# odisabled: remove support for Catalina September (or later) 2026
if [[ "${HOMEBREW_MACOS_VERSION_NUMERIC}" -lt "${HOMEBREW_MACOS_OLDEST_ALLOWED_NUMERIC}" ]]
then
printf "ERROR: Your version of macOS (%s) is too old to run Homebrew!\\n" "${HOMEBREW_MACOS_VERSION}" >&2
if [[ "${HOMEBREW_MACOS_VERSION_NUMERIC}" -lt "100700" ]]
if [[ "${HOMEBREW_MACOS_VERSION_NUMERIC}" -lt "101500" ]]
then
printf " For 10.4 - 10.6 support see: https://github.com/mistydemeo/tigerbrew\\n" >&2
fi
printf "\\n" >&2
fi

# Versions before Sierra don't handle custom cert files correctly, so need a full brewed curl.
if [[ "${HOMEBREW_MACOS_VERSION_NUMERIC}" -lt "101200" ]]
then
HOMEBREW_SYSTEM_CURL_TOO_OLD="1"
HOMEBREW_FORCE_BREWED_CURL="1"
fi

# The system libressl has a bug before macOS 10.15.6 where it incorrectly handles expired roots.
if [[ -z "${HOMEBREW_SYSTEM_CURL_TOO_OLD}" && "${HOMEBREW_MACOS_VERSION_NUMERIC}" -lt "101506" ]]
then
HOMEBREW_SYSTEM_CA_CERTIFICATES_TOO_OLD="1"
HOMEBREW_FORCE_BREWED_CA_CERTIFICATES="1"
fi

# TEMP: backwards compatiblity with existing 10.11-cross image
# Can (probably) be removed in March 2024.
if [[ -n "${HOMEBREW_FAKE_EL_CAPITAN}" ]]
then
export HOMEBREW_FAKE_MACOS="10.11.6"
fi

if [[ "${HOMEBREW_FAKE_MACOS}" =~ ^10\.11(\.|$) ]]
then
# We only need this to work enough to update brew and build the set portable formulae, so relax the requirement.
HOMEBREW_MINIMUM_GIT_VERSION="2.7.4"
else
# The system Git on macOS versions before Sierra is too old for some Homebrew functionality we rely on.
HOMEBREW_MINIMUM_GIT_VERSION="2.14.3"
if [[ "${HOMEBREW_MACOS_VERSION_NUMERIC}" -lt "101200" ]]
then
HOMEBREW_FORCE_BREWED_GIT="1"
fi
fi
# Some Git versions are too old for some Homebrew functionality we rely on.
HOMEBREW_MINIMUM_GIT_VERSION="2.14.3"
else
HOMEBREW_PRODUCT="${HOMEBREW_SYSTEM}brew"
# Don't try to follow /etc/os-release
Expand Down
6 changes: 0 additions & 6 deletions Library/Homebrew/bundle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ def which_vscode
@which_vscode ||= which("code-insiders", ORIGINAL_PATHS)
end

sig { returns(T::Boolean) }
def whalebrew_installed?
@whalebrew_installed ||= which_formula?("whalebrew")
end

sig { returns(T.nilable(Pathname)) }
def which_go
@which_go ||= which("go", ORIGINAL_PATHS)
Expand Down Expand Up @@ -149,7 +144,6 @@ def reset!
@vscode_installed = T.let(nil, T.nilable(T::Boolean))
@which_vscode = T.let(nil, T.nilable(Pathname))
@which_go = T.let(nil, T.nilable(Pathname))
@whalebrew_installed = T.let(nil, T.nilable(T::Boolean))
@go_installed = T.let(nil, T.nilable(T::Boolean))
@cask_installed = T.let(nil, T.nilable(T::Boolean))
@formula_versions_from_env = T.let(nil, T.nilable(T::Hash[String, String]))
Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/bundle/commands/dump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ module Dump
sig {
params(global: T::Boolean, file: T.nilable(String), describe: T::Boolean, force: T::Boolean,
no_restart: T::Boolean, taps: T::Boolean, formulae: T::Boolean, casks: T::Boolean,
mas: T::Boolean, whalebrew: T::Boolean, vscode: T::Boolean, go: T::Boolean).void
mas: T::Boolean, vscode: T::Boolean, go: T::Boolean).void
}
def self.run(global:, file:, describe:, force:, no_restart:, taps:, formulae:, casks:, mas:, whalebrew:,
def self.run(global:, file:, describe:, force:, no_restart:, taps:, formulae:, casks:, mas:,
vscode:, go:)
Homebrew::Bundle::Dumper.dump_brewfile(
global:, file:, describe:, force:, no_restart:, taps:, formulae:, casks:, mas:, whalebrew:, vscode:,
global:, file:, describe:, force:, no_restart:, taps:, formulae:, casks:, mas:, vscode:,
go:
)
end
Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/bundle/commands/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ module Commands
module List
sig {
params(global: T::Boolean, file: T.nilable(String), formulae: T::Boolean, casks: T::Boolean,
taps: T::Boolean, mas: T::Boolean, whalebrew: T::Boolean, vscode: T::Boolean,
taps: T::Boolean, mas: T::Boolean, vscode: T::Boolean,
go: T::Boolean).void
}
def self.run(global:, file:, formulae:, casks:, taps:, mas:, whalebrew:, vscode:, go:)
def self.run(global:, file:, formulae:, casks:, taps:, mas:, vscode:, go:)
parsed_entries = Brewfile.read(global:, file:).entries
Homebrew::Bundle::Lister.list(
parsed_entries,
formulae:, casks:, taps:, mas:, whalebrew:, vscode:, go:,
formulae:, casks:, taps:, mas:, vscode:, go:,
)
end
end
Expand Down
6 changes: 0 additions & 6 deletions Library/Homebrew/bundle/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ def mas(name, options = {})
@entries << Entry.new(:mas, name, id:)
end

def whalebrew(name)
raise "name(#{name.inspect}) should be a String object" unless name.is_a? String

@entries << Entry.new(:whalebrew, name)
end

def vscode(name)
raise "name(#{name.inspect}) should be a String object" unless name.is_a? String

Expand Down
10 changes: 3 additions & 7 deletions Library/Homebrew/bundle/dumper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@ module Dumper
taps: T::Boolean,
casks: T::Boolean,
mas: T::Boolean,
whalebrew: T::Boolean,
vscode: T::Boolean,
go: T::Boolean,
).returns(String)
}
def self.build_brewfile(describe:, no_restart:, formulae:, taps:, casks:, mas:, whalebrew:, vscode:, go:)
def self.build_brewfile(describe:, no_restart:, formulae:, taps:, casks:, mas:, vscode:, go:)
require "bundle/tap_dumper"
require "bundle/formula_dumper"
require "bundle/cask_dumper"
require "bundle/mac_app_store_dumper"
require "bundle/whalebrew_dumper"
require "bundle/vscode_extension_dumper"
require "bundle/go_dumper"

Expand All @@ -41,7 +39,6 @@ def self.build_brewfile(describe:, no_restart:, formulae:, taps:, casks:, mas:,
content << FormulaDumper.dump(describe:, no_restart:) if formulae
content << CaskDumper.dump(describe:) if casks
content << MacAppStoreDumper.dump if mas
content << WhalebrewDumper.dump if whalebrew
content << VscodeExtensionDumper.dump if vscode
content << GoDumper.dump if go
"#{content.reject(&:empty?).join("\n")}\n"
Expand All @@ -58,16 +55,15 @@ def self.build_brewfile(describe:, no_restart:, formulae:, taps:, casks:, mas:,
taps: T::Boolean,
casks: T::Boolean,
mas: T::Boolean,
whalebrew: T::Boolean,
vscode: T::Boolean,
go: T::Boolean,
).void
}
def self.dump_brewfile(global:, file:, describe:, force:, no_restart:, formulae:, taps:, casks:, mas:,
whalebrew:, vscode:, go:)
vscode:, go:)
path = brewfile_path(global:, file:)
can_write_to_brewfile?(path, force:)
content = build_brewfile(describe:, no_restart:, taps:, formulae:, casks:, mas:, whalebrew:, vscode:, go:)
content = build_brewfile(describe:, no_restart:, taps:, formulae:, casks:, mas:, vscode:, go:)
write_file path, content
end

Expand Down
3 changes: 0 additions & 3 deletions Library/Homebrew/bundle/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
require "bundle/formula_installer"
require "bundle/cask_installer"
require "bundle/mac_app_store_installer"
require "bundle/whalebrew_installer"
require "bundle/vscode_extension_installer"
require "bundle/go_installer"
require "bundle/tap_installer"
Expand Down Expand Up @@ -37,8 +36,6 @@ def self.install!(entries, global: false, file: nil, no_lock: false, no_upgrade:
when :mas
args << entry.options[:id]
Homebrew::Bundle::MacAppStoreInstaller
when :whalebrew
Homebrew::Bundle::WhalebrewInstaller
when :vscode
Homebrew::Bundle::VscodeExtensionInstaller
when :go
Expand Down
11 changes: 5 additions & 6 deletions Library/Homebrew/bundle/lister.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,23 @@ module Bundle
module Lister
sig {
params(entries: T::Array[Homebrew::Bundle::Dsl::Entry], formulae: T::Boolean, casks: T::Boolean,
taps: T::Boolean, mas: T::Boolean, whalebrew: T::Boolean, vscode: T::Boolean, go: T::Boolean).void
taps: T::Boolean, mas: T::Boolean, vscode: T::Boolean, go: T::Boolean).void
}
def self.list(entries, formulae:, casks:, taps:, mas:, whalebrew:, vscode:, go:)
def self.list(entries, formulae:, casks:, taps:, mas:, vscode:, go:)
entries.each do |entry|
puts entry.name if show?(entry.type, formulae:, casks:, taps:, mas:, whalebrew:, vscode:, go:)
puts entry.name if show?(entry.type, formulae:, casks:, taps:, mas:, vscode:, go:)
end
end

sig {
params(type: Symbol, formulae: T::Boolean, casks: T::Boolean, taps: T::Boolean, mas: T::Boolean,
whalebrew: T::Boolean, vscode: T::Boolean, go: T::Boolean).returns(T::Boolean)
vscode: T::Boolean, go: T::Boolean).returns(T::Boolean)
}
private_class_method def self.show?(type, formulae:, casks:, taps:, mas:, whalebrew:, vscode:, go:)
private_class_method def self.show?(type, formulae:, casks:, taps:, mas:, vscode:, go:)
return true if formulae && type == :brew
return true if casks && type == :cask
return true if taps && type == :tap
return true if mas && type == :mas
return true if whalebrew && type == :whalebrew
return true if vscode && type == :vscode
return true if go && type == :go

Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/bundle/skipper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def skipped_entries
return @skipped_entries if @skipped_entries

@skipped_entries ||= T.let({}, T.nilable(T::Hash[Symbol, T.nilable(T::Array[String])]))
[:brew, :cask, :mas, :tap, :whalebrew].each do |type|
[:brew, :cask, :mas, :tap].each do |type|
@skipped_entries[type] =
ENV["HOMEBREW_BUNDLE_#{type.to_s.upcase}_SKIP"]&.split
end
Expand Down
36 changes: 0 additions & 36 deletions Library/Homebrew/bundle/whalebrew_dumper.rb

This file was deleted.

Loading
Loading