Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into auto-bump
Browse files Browse the repository at this point in the history
  • Loading branch information
carlocab committed Sep 6, 2024
2 parents 800df2a + 9feb56b commit 9127bf2
Show file tree
Hide file tree
Showing 141 changed files with 1,207 additions and 904 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ permissions:
jobs:
ubuntu:
if: github.repository_owner == 'Homebrew'
name: docker (Ubuntu ${{ matrix.version }})
runs-on: ubuntu-22.04
strategy:
fail-fast: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
run: vale docs/

- name: Install Ruby
uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
uses: ruby/setup-ruby@52753b7da854d5c07df37391a986c76ab4615999 # v1.191.0
with:
bundler-cache: true
working-directory: docs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rubydoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
path: rubydoc

- name: Install Ruby
uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
uses: ruby/setup-ruby@52753b7da854d5c07df37391a986c76ab4615999 # v1.191.0
with:
bundler-cache: true
working-directory: rubydoc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vendor-gems.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
fi
- name: Generate push token
uses: actions/create-github-app-token@31c86eb3b33c9b601a1f60f98dcbfd1d70f379b4 # v1
uses: actions/create-github-app-token@3378cda945da322a8db4b193e19d46352ebe2de5 # v1
id: app-token
if: github.event_name == 'workflow_dispatch'
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
**/vendor/bundle/ruby/*/gems/json_schemer-*/
**/vendor/bundle/ruby/*/gems/kramdown-*/
**/vendor/bundle/ruby/*/gems/language_server-protocol-*/
**/vendor/bundle/ruby/*/gems/logger-*/
**/vendor/bundle/ruby/*/gems/method_source-*/
**/vendor/bundle/ruby/*/gems/mini_portile2-*/
**/vendor/bundle/ruby/*/gems/minitest-*/
Expand Down
1 change: 1 addition & 0 deletions Library/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ Sorbet/StrictSigil:
- "Taps/**/*"
- "/**/{Formula,Casks}/**/*.rb"
- "**/{Formula,Casks}/**/*.rb"
- "Homebrew/{standalone,startup}/*.rb" # These are loaded before sorbet-runtime
- "Homebrew/test/**/*.rb"

Sorbet/TrueSigil:
Expand Down
32 changes: 15 additions & 17 deletions Library/Homebrew/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ GEM
kramdown (2.4.0)
rexml
language_server-protocol (3.17.0.3)
logger (1.6.0)
logger (1.6.1)
method_source (1.1.0)
minitest (5.25.1)
netrc (0.11.0)
Expand All @@ -37,7 +37,7 @@ GEM
parser
rainbow (~> 3.0)
sorbet-runtime (>= 0.5)
parser (3.3.4.2)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
patchelf (1.5.1)
Expand All @@ -57,13 +57,12 @@ GEM
logger
redcarpet (3.6.0)
regexp_parser (2.9.2)
rexml (3.3.6)
strscan
rexml (3.3.7)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-core (3.13.1)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
Expand Down Expand Up @@ -91,7 +90,7 @@ GEM
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.1)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
rubocop-md (1.2.2)
rubocop (>= 1.0)
Expand Down Expand Up @@ -120,22 +119,21 @@ GEM
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
simpleidn (0.2.3)
sorbet (0.5.11553)
sorbet-static (= 0.5.11553)
sorbet-runtime (0.5.11553)
sorbet-static (0.5.11553-aarch64-linux)
sorbet-static (0.5.11553-universal-darwin)
sorbet-static (0.5.11553-x86_64-linux)
sorbet-static-and-runtime (0.5.11553)
sorbet (= 0.5.11553)
sorbet-runtime (= 0.5.11553)
sorbet (0.5.11554)
sorbet-static (= 0.5.11554)
sorbet-runtime (0.5.11554)
sorbet-static (0.5.11554-aarch64-linux)
sorbet-static (0.5.11554-universal-darwin)
sorbet-static (0.5.11554-x86_64-linux)
sorbet-static-and-runtime (0.5.11554)
sorbet (= 0.5.11554)
sorbet-runtime (= 0.5.11554)
spoom (1.4.2)
erubi (>= 1.10.0)
prism (>= 0.28.0)
sorbet-static-and-runtime (>= 0.5.10187)
thor (>= 0.19.2)
stackprof (0.2.26)
strscan (3.1.0)
tapioca (0.16.2)
bundler (>= 2.2.25)
netrc (>= 0.11.0)
Expand All @@ -149,7 +147,7 @@ GEM
unicode-display_width (2.5.0)
vernier (1.1.2)
warning (1.4.0)
yard (0.9.36)
yard (0.9.37)
yard-sorbet (0.9.0)
sorbet-runtime
yard
Expand Down
5 changes: 1 addition & 4 deletions Library/Homebrew/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
require "api/analytics"
require "api/cask"
require "api/formula"
require "warnings"
Warnings.ignore :default_gems do
require "base64" # TODO: Add this to the Gemfile or remove it before moving to Ruby 3.4.
end
require "base64" # TODO: vendor this for Ruby 3.4.

module Homebrew
# Helper functions for using Homebrew's formulae.brew.sh API.
Expand Down
13 changes: 8 additions & 5 deletions Library/Homebrew/brew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ then
HOMEBREW_DEFAULT_CACHE="${HOME}/Library/Caches/Homebrew"
HOMEBREW_DEFAULT_LOGS="${HOME}/Library/Logs/Homebrew"
HOMEBREW_DEFAULT_TEMP="/private/tmp"

HOMEBREW_MACOS_VERSION="$(/usr/bin/sw_vers -productVersion)"

IFS=. read -r -a MACOS_VERSION_ARRAY <<<"${HOMEBREW_MACOS_VERSION}"
printf -v HOMEBREW_MACOS_VERSION_NUMERIC "%02d%02d%02d" "${MACOS_VERSION_ARRAY[@]}"

unset MACOS_VERSION_ARRAY
else
CACHE_HOME="${HOMEBREW_XDG_CACHE_HOME:-${HOME}/.cache}"
HOMEBREW_DEFAULT_CACHE="${CACHE_HOME}/Homebrew"
Expand Down Expand Up @@ -161,7 +168,7 @@ case "$@" in
homebrew-command-path "$@" && exit 0
;;
# falls back to cmd/list.rb on a non-zero return
list*)
list* | ls*)
source "${HOMEBREW_LIBRARY}/Homebrew/list.sh"
homebrew-list "$@" && exit 0
;;
Expand Down Expand Up @@ -523,7 +530,6 @@ then
HOMEBREW_PRODUCT="Homebrew"
HOMEBREW_SYSTEM="Macintosh"
[[ "${HOMEBREW_PROCESSOR}" == "x86_64" ]] && HOMEBREW_PROCESSOR="Intel"
HOMEBREW_MACOS_VERSION="$(/usr/bin/sw_vers -productVersion)"
# Don't change this from Mac OS X to match what macOS itself does in Safari on 10.12
HOMEBREW_OS_USER_AGENT_VERSION="Mac OS X ${HOMEBREW_MACOS_VERSION}"

Expand All @@ -534,9 +540,6 @@ then
HOMEBREW_PHYSICAL_PROCESSOR="arm64"
fi

IFS=. read -r -a MACOS_VERSION_ARRAY <<<"${HOMEBREW_MACOS_VERSION}"
printf -v HOMEBREW_MACOS_VERSION_NUMERIC "%02d%02d%02d" "${MACOS_VERSION_ARRAY[@]}"

IFS=. read -r -a MACOS_VERSION_ARRAY <<<"${HOMEBREW_MACOS_OLDEST_ALLOWED}"
printf -v HOMEBREW_MACOS_OLDEST_ALLOWED_NUMERIC "%02d%02d%02d" "${MACOS_VERSION_ARRAY[@]}"

Expand Down
8 changes: 5 additions & 3 deletions Library/Homebrew/cleanup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ def clean!(quiet: false, periodic: false)

cleanup_cache
cleanup_empty_api_source_directories
cleanup_bootsnap
cleanup_logs
cleanup_lockfiles
cleanup_python_site_packages
Expand All @@ -314,7 +315,6 @@ def clean!(quiet: false, periodic: false)
return if periodic

cleanup_portable_ruby
cleanup_bootsnap
else
args.each do |arg|
formula = begin
Expand Down Expand Up @@ -528,9 +528,11 @@ def use_system_ruby?

def cleanup_bootsnap
bootsnap = cache/"bootsnap"
return unless bootsnap.exist?
return unless bootsnap.directory?

cleanup_path(bootsnap) { bootsnap.rmtree }
bootsnap.each_child do |subdir|
cleanup_path(subdir) { subdir.rmtree } if subdir.basename.to_s != Homebrew.bootsnap_key
end
end

def cleanup_cache_db(rack = nil)
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cmd/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class InstallCmd < AbstractCommand
}],
[:flag, "--cc=", {
description: "Attempt to compile using the specified <compiler>, which should be the name of the " \
"compiler's executable, e.g. `gcc-7` for GCC 7. In order to use LLVM's clang, specify " \
"compiler's executable, e.g. `gcc-9` for GCC 9. In order to use LLVM's clang, specify " \
"`llvm_clang`. To use the Apple-provided clang, specify `clang`. This option will only " \
"accept compilers that are provided by Homebrew or bundled with macOS. Please do not " \
"file issues if you encounter errors while using this option.",
Expand Down
31 changes: 29 additions & 2 deletions Library/Homebrew/cmd/shellenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@ homebrew-shellenv() {
HOMEBREW_SHELL_NAME="$(/bin/ps -p "${PPID}" -c -o comm=)"
fi

if [[ -n "${HOMEBREW_MACOS}" ]] &&
[[ "${HOMEBREW_MACOS_VERSION_NUMERIC}" -ge "140000" ]] &&
[[ -x /usr/libexec/path_helper ]]
then
HOMEBREW_PATHS_FILE="${HOMEBREW_PREFIX}/etc/paths"

if [[ ! -f "${HOMEBREW_PATHS_FILE}" ]]
then
printf '%s/bin\n%s/sbin\n' "${HOMEBREW_PREFIX}" "${HOMEBREW_PREFIX}" >"${HOMEBREW_PATHS_FILE}" 2>/dev/null
fi

if [[ -r "${HOMEBREW_PATHS_FILE}" ]]
then
PATH_HELPER_ROOT="${HOMEBREW_PREFIX}"
fi
fi

case "${HOMEBREW_SHELL_NAME}" in
fish | -fish)
echo "set -gx HOMEBREW_PREFIX \"${HOMEBREW_PREFIX}\";"
Expand All @@ -31,7 +48,12 @@ homebrew-shellenv() {
echo "setenv HOMEBREW_PREFIX ${HOMEBREW_PREFIX};"
echo "setenv HOMEBREW_CELLAR ${HOMEBREW_CELLAR};"
echo "setenv HOMEBREW_REPOSITORY ${HOMEBREW_REPOSITORY};"
echo "setenv PATH ${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin:\$PATH;"
if [[ -n "${PATH_HELPER_ROOT}" ]]
then
PATH_HELPER_ROOT="${PATH_HELPER_ROOT}" PATH="${HOMEBREW_PATH}" /usr/libexec/path_helper -c
else
echo "setenv PATH ${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin:\$PATH;"
fi
echo "test \${?MANPATH} -eq 1 && setenv MANPATH :\${MANPATH};"
echo "setenv INFOPATH ${HOMEBREW_PREFIX}/share/info\`test \${?INFOPATH} -eq 1 && echo :\${INFOPATH}\`;"
;;
Expand All @@ -47,7 +69,12 @@ homebrew-shellenv() {
echo "export HOMEBREW_PREFIX=\"${HOMEBREW_PREFIX}\";"
echo "export HOMEBREW_CELLAR=\"${HOMEBREW_CELLAR}\";"
echo "export HOMEBREW_REPOSITORY=\"${HOMEBREW_REPOSITORY}\";"
echo "export PATH=\"${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin\${PATH+:\$PATH}\";"
if [[ -n "${PATH_HELPER_ROOT}" ]]
then
PATH_HELPER_ROOT="${PATH_HELPER_ROOT}" PATH="${HOMEBREW_PATH}" /usr/libexec/path_helper -s
else
echo "export PATH=\"${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin\${PATH+:\$PATH}\";"
fi
echo "[ -z \"\${MANPATH-}\" ] || export MANPATH=\":\${MANPATH#:}\";"
echo "export INFOPATH=\"${HOMEBREW_PREFIX}/share/info:\${INFOPATH:-}\";"
;;
Expand Down
7 changes: 0 additions & 7 deletions Library/Homebrew/cmd/vendor-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,4 @@ homebrew-vendor-install() {
lock "vendor-install ${VENDOR_NAME}"
fetch
install

# Bootsnap needs cleaned up on a new Ruby version.
# It's cleaned up by every `brew cleanup` run anyway so not a big deal to do it here, too.
if [[ "${VENDOR_NAME}" == "ruby" ]]
then
rm -rf "${HOMEBREW_CACHE}/bootsnap"
fi
}
4 changes: 3 additions & 1 deletion Library/Homebrew/dev-cmd/bottle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,9 @@ def bottle_formula(formula)
"root_url" => bottle.root_url,
"cellar" => bottle_cellar.to_s,
"rebuild" => bottle.rebuild,
"date" => Pathname(filename.to_s).mtime.strftime("%F"),
# date is used for org.opencontainers.image.created which is an RFC 3339 date-time.
# Time#iso8601 produces an XML Schema date-time that meets RFC 3339 ABNF.
"date" => Pathname(filename.to_s).mtime.utc.iso8601,
"tags" => {
bottle_tag.to_s => {
"filename" => filename.url_encode,
Expand Down
5 changes: 1 addition & 4 deletions Library/Homebrew/dev-cmd/contributions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,7 @@ def time_period(from:, to:)

sig { params(totals: T::Hash[String, T::Hash[Symbol, Integer]]).returns(String) }
def generate_csv(totals)
require "warnings"
Warnings.ignore :default_gems do
require "csv"
end
require "csv" # TODO: this will be removed from Ruby 3.4

CSV.generate do |csv|
csv << %w[user repo author committer coauthor review total]
Expand Down
2 changes: 2 additions & 0 deletions Library/Homebrew/dev-cmd/edit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class Edit < AbstractCommand
sig { override.void }
def run
ENV["COLORTERM"] = ENV.fetch("HOMEBREW_COLORTERM", nil)
# Recover $TMPDIR for emacsclient
ENV["TMPDIR"] = ENV.fetch("HOMEBREW_TMPDIR", nil)

unless (HOMEBREW_REPOSITORY/".git").directory?
odie <<~EOS
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3356,7 +3356,7 @@ def freeze
#
# @!attribute [w] license
# @see https://docs.brew.sh/License-Guidelines Homebrew License Guidelines
# @see https://spdx.github.io/spdx-spec/appendix-IV-SPDX-license-expressions/ SPDX license expression guide
# @see https://spdx.github.io/spdx-spec/latest/annexes/spdx-license-expressions/ SPDX license expression guide
# @api public
def license(args = nil)
if args.nil?
Expand Down
30 changes: 25 additions & 5 deletions Library/Homebrew/formula_auditor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,34 @@ def audit_name
"LGPL-3.0" => ["LGPL-3.0-only", "LGPL-3.0-or-later"],
}.freeze

# The following licenses are non-free/open based on multiple sources (e.g. Debian, Fedora, FSF, OSI, ...)
INCOMPATIBLE_LICENSES = [
"Aladdin", # https://www.gnu.org/licenses/license-list.html#Aladdin
"CPOL-1.02", # https://www.gnu.org/licenses/license-list.html#cpol
"gSOAP-1.3b", # https://salsa.debian.org/ellert/gsoap/-/blob/master/debian/copyright
"JSON", # https://wiki.debian.org/DFSGLicenses#JSON_evil_license
"MS-LPL", # https://github.com/spdx/license-list-XML/issues/1432#issuecomment-1077680709
"OPL-1.0", # https://wiki.debian.org/DFSGLicenses#Open_Publication_License_.28OPL.29_v1.0
].freeze
INCOMPATIBLE_LICENSE_PREFIXES = [
"BUSL", # https://spdx.org/licenses/BUSL-1.1.html#notes
"CC-BY-NC", # https://people.debian.org/~bap/dfsg-faq.html#no_commercial
"Elastic", # https://www.elastic.co/licensing/elastic-license#Limitations
"SSPL", # https://fedoraproject.org/wiki/Licensing/SSPL#License_Notes
].freeze

def audit_license
if formula.license.present?
licenses, exceptions = SPDX.parse_license_expression formula.license

sspl_licensed = licenses.any? { |license| license.to_s.start_with?("SSPL") }
if sspl_licensed && @core_tap
incompatible_licenses = licenses.select do |license|
license.to_s.start_with?(*INCOMPATIBLE_LICENSE_PREFIXES) || INCOMPATIBLE_LICENSES.include?(license.to_s)
end
if incompatible_licenses.present? && @core_tap
problem <<~EOS
Formula #{formula.name} is SSPL-licensed. Software under the SSPL must not be packaged in homebrew/core.
Formula #{formula.name} contains incompatible licenses: #{incompatible_licenses}.
Formulae in homebrew/core must either use a Debian Free Software Guidelines license
or be released into the public domain. See #{Formatter.url("https://docs.brew.sh/License-Guidelines")}
EOS
end

Expand All @@ -218,7 +238,7 @@ def audit_license
EOS
end

if @strict
if @strict || @core_tap
deprecated_licenses = licenses.select do |license|
SPDX.deprecated_license? license
end
Expand Down Expand Up @@ -255,7 +275,7 @@ def audit_license

problem "Formula license #{licenses} does not match GitHub license #{Array(github_license)}."

elsif @new_formula && @core_tap
elsif @core_tap && !formula.disabled?
problem "Formulae in homebrew/core must specify a license."
end
end
Expand Down
Loading

0 comments on commit 9127bf2

Please sign in to comment.