Merge branch 'master' into master

This commit is contained in:
Thibaut Hérault 2025-05-07 12:52:16 -04:00 committed by GitHub
commit 3799c4b77d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
110 changed files with 506 additions and 388 deletions

View File

@ -77,7 +77,7 @@ jobs:
path: results.sarif
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
uses: github/codeql-action/upload-sarif@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17
with:
sarif_file: results.sarif
category: zizmor

View File

@ -28,7 +28,7 @@ jobs:
persist-credentials: false
- name: Initialize CodeQL
uses: github/codeql-action/init@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
uses: github/codeql-action/init@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17
with:
languages: ruby
config: |
@ -36,4 +36,4 @@ jobs:
- Library/Homebrew/vendor
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
uses: github/codeql-action/analyze@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17

View File

@ -91,7 +91,7 @@ jobs:
fi
- name: Generate push token
uses: actions/create-github-app-token@30bf6253fa41bdc8d1501d202ad15287582246b4 # v2.0.3
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
id: app-token
if: github.event_name == 'workflow_dispatch'
with:

View File

@ -68,7 +68,7 @@ GEM
rspec-support (~> 3.13.0)
rspec-github (3.0.0)
rspec-core (~> 3.0)
rspec-mocks (3.13.3)
rspec-mocks (3.13.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-retry (0.6.2)
@ -78,7 +78,7 @@ GEM
rspec-support (3.13.3)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.75.2)
rubocop (1.75.5)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
@ -104,7 +104,7 @@ GEM
rubocop (~> 1.72, >= 1.72.1)
rubocop-sorbet (0.10.0)
rubocop (>= 1)
ruby-lsp (0.23.16)
ruby-lsp (0.23.17)
language_server-protocol (~> 3.17.0)
prism (>= 1.2, < 2.0)
rbs (>= 3, < 4)
@ -122,15 +122,15 @@ GEM
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
simpleidn (0.2.3)
sorbet (0.5.12053)
sorbet-static (= 0.5.12053)
sorbet-runtime (0.5.12053)
sorbet-static (0.5.12053-aarch64-linux)
sorbet-static (0.5.12053-universal-darwin)
sorbet-static (0.5.12053-x86_64-linux)
sorbet-static-and-runtime (0.5.12053)
sorbet (= 0.5.12053)
sorbet-runtime (= 0.5.12053)
sorbet (0.5.12067)
sorbet-static (= 0.5.12067)
sorbet-runtime (0.5.12067)
sorbet-static (0.5.12067-aarch64-linux)
sorbet-static (0.5.12067-universal-darwin)
sorbet-static (0.5.12067-x86_64-linux)
sorbet-static-and-runtime (0.5.12067)
sorbet (= 0.5.12067)
sorbet-runtime (= 0.5.12067)
spoom (1.6.1)
erubi (>= 1.10.0)
prism (>= 0.28.0)

View File

@ -256,7 +256,14 @@ check-run-command-as-root() {
[[ -f /proc/1/cgroup ]] && grep -E "azpl_job|actions_job|docker|garden|kubepods" -q /proc/1/cgroup && return
# `brew services` may need `sudo` for system-wide daemons.
[[ "${HOMEBREW_COMMAND}" == "services" ]] && return
if [[ "${HOMEBREW_COMMAND}" == "services" ]]
then
# Need to disable Bootsnap when running as root to avoid permission errors:
# https://github.com/Homebrew/brew/issues/19904
export HOMEBREW_NO_BOOTSNAP="1"
return
fi
# It's fine to run this as root as it's not changing anything.
[[ "${HOMEBREW_COMMAND}" == "--prefix" ]] && return

View File

@ -514,7 +514,7 @@ module Cask
end
# Directory counts as empty if it only contains a `.DS_Store`.
if children.include?((ds_store = resolved_path/".DS_Store"))
if children.include?(ds_store = resolved_path/".DS_Store")
Utils.gain_permissions_remove(ds_store, command:)
children.delete(ds_store)
end

View File

@ -147,7 +147,7 @@ module Homebrew
{},
T.nilable(T::Hash[
T.nilable(Symbol),
T::Array[T.any(Formula, Keg, Cask::Cask, T::Array[Keg], FormulaOrCaskUnavailableError)]
T::Array[T.any(Formula, Keg, Cask::Cask, T::Array[Keg], FormulaOrCaskUnavailableError)],
]),
)
@to_formulae_casks_unknowns[method] = downcased_unique_named.map do |name|

View File

@ -177,7 +177,7 @@ module Homebrew
sig { returns(T::Array[Formula]) }
def outdated_formulae
T.cast(
select_outdated((args.named.to_resolved_formulae.presence || Formula.installed)).sort,
select_outdated(args.named.to_resolved_formulae.presence || Formula.installed).sort,
T::Array[Formula],
)
end

View File

@ -17,7 +17,7 @@ class DevelopmentTools
# Give the name of the binary you look for as a string to this method
# in order to get the full path back as a Pathname.
(@locate ||= T.let({}, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]))).fetch(tool) do |key|
@locate[key] = if File.executable?((path = "/usr/bin/#{tool}"))
@locate[key] = if File.executable?(path = "/usr/bin/#{tool}")
Pathname.new path
# Homebrew GCCs most frequently; much faster to check this before xcrun
elsif (path = HOMEBREW_PREFIX/"bin/#{tool}").executable?

View File

@ -20,7 +20,7 @@ module OS
glibc_path
elsif (homebrew_path = HOMEBREW_PREFIX/"bin/#{tool}").executable?
homebrew_path
elsif File.executable?((system_path = "/usr/bin/#{tool}"))
elsif File.executable?(system_path = "/usr/bin/#{tool}")
Pathname.new system_path
end
end

View File

@ -91,7 +91,7 @@ urllib3==2.4.0 \
# via influxdb3-python
# The following packages are considered to be unsafe in a requirements file:
setuptools==80.1.0 \
--hash=sha256:2e308396e1d83de287ada2c2fd6e64286008fe6aca5008e0b6a8cb0e2c86eedd \
--hash=sha256:ea0e7655c05b74819f82e76e11a85b31779fee7c4969e82f72bab0664e8317e4
setuptools==80.3.1 \
--hash=sha256:31e2c58dbb67c99c289f51c16d899afedae292b978f8051efaf6262d8212f927 \
--hash=sha256:ea8e00d7992054c4c592aeb892f6ad51fe1b4d90cc6947cc45c45717c40ec537
# via influxdb3-python

View File

@ -515,8 +515,6 @@ module Homebrew
RELICENSED_FORMULAE_VERSIONS = {
"boundary" => "0.14",
"consul" => "1.17",
"elasticsearch" => "7.11",
"kibana" => "7.11",
"nomad" => "1.7",
"packer" => "1.10",
"terraform" => "1.6",
@ -612,11 +610,10 @@ module Homebrew
metadata = SharedAudits.eol_data(name, formula.version.major.to_s)
metadata ||= SharedAudits.eol_data(name, formula.version.major_minor.to_s)
return if metadata.blank? || (eol = metadata["eol"]).blank?
return if metadata.blank? || (metadata.dig("result", "isEol") != true)
is_eol = eol == true
is_eol ||= eol.is_a?(String) && (eol_date = Date.parse(eol)) <= Date.today
return unless is_eol
eol_from = metadata.dig("result", "eolFrom")
eol_date = Date.parse(eol_from) if eol_from.present?
message = "Product is EOL"
message += " since #{eol_date}" if eol_date.present?

View File

@ -192,7 +192,7 @@ class SBOM
T::Array[
T::Hash[
Symbol,
T.any(String, T::Array[T::Hash[Symbol, String]])
T.any(String, T::Array[T::Hash[Symbol, String]]),
],
],
)

View File

@ -118,7 +118,7 @@ RSpec.describe Cask::Pkg, :cask do
pkg.uninstall
expect(fake_dir).to be_a_directory
expect((fake_dir.stat.mode % 01000)).to eq(0)
expect(fake_dir.stat.mode % 01000).to eq(0)
fake_dir.chmod(0777)
expect(fake_file).to be_a_file

View File

@ -1,8 +1,58 @@
# frozen_string_literal: true
require "utils/shared_audits"
require "utils/curl"
RSpec.describe SharedAudits do
let(:eol_json_text) do
<<~JSON
{
"schema_version" : "1.0.0",
"generated_at": "2025-01-02T01:23:45+00:00",
"result": {
"name": "1.2",
"codename": null,
"label": "1.2",
"releaseDate": "2024-01-01",
"isLts": false,
"ltsFrom": null,
"isEol": true,
"eolFrom": "2025-01-01",
"isMaintained": false,
"latest": {
"name": "1.0.0",
"date": "2024-01-01",
"link": "https://example.com/1.0.0"
}
}
}
JSON
end
def mock_curl_output(stdout: "", success: true)
status = instance_double(Process::Status, success?: success)
curl_output = instance_double(SystemCommand::Result, stdout:, status:)
allow(Utils::Curl).to receive(:curl_output).and_return curl_output
end
describe "::eol_data" do
it "returns a parsed JSON object if the product is found" do
mock_curl_output stdout: eol_json_text
expect(described_class.eol_data("product", "cycle")&.dig("result", "isEol")).to be(true)
expect(described_class.eol_data("product", "cycle")&.dig("result", "eolFrom")).to eq("2025-01-01")
end
it "returns nil if the product is not found" do
mock_curl_output stdout: "<html></html>"
expect(described_class.eol_data("none", "cycle")).to be_nil
end
it "returns nil if api call fails" do
mock_curl_output success: false
expect(described_class.eol_data("", "")).to be_nil
end
end
describe "::github_tag_from_url" do
it "finds tags in archive urls" do
url = "https://github.com/a/b/archive/refs/tags/v1.2.3.tar.gz"

View File

@ -509,14 +509,6 @@ RSpec.describe Version do
.to be_detected_from("https://codeload.github.com/gsamokovarov/jump/tar.gz/v0.7.1")
end
specify "elasticsearch alpha style" do
expect(described_class.new("5.0.0-alpha5"))
.to be_detected_from(
"https://download.elastic.co/elasticsearch/release/org/elasticsearch" \
"/distribution/tar/elasticsearch/5.0.0-alpha5/elasticsearch-5.0.0-alpha5.tar.gz",
)
end
specify "gloox beta style" do
expect(described_class.new("1.0-beta7"))
.to be_detected_from("https://camaya.net/download/gloox-1.0-beta7.tar.bz2")

View File

@ -807,7 +807,7 @@ module GitHub
commits.each do |commit|
commit[:sourcefile_path].atomic_write(commit[:old_contents])
end
odie "Unable to open pull request: #{e.message}!"
odie "Unable to open pull request for #{tap_remote_repo}: #{e.message}!"
end
end
end

View File

@ -11,11 +11,19 @@ module SharedAudits
sig { params(product: String, cycle: String).returns(T.nilable(T::Hash[String, T.untyped])) }
def self.eol_data(product, cycle)
@eol_data ||= T.let({}, T.nilable(T::Hash[String, T.untyped]))
@eol_data["#{product}/#{cycle}"] ||= begin
result = Utils::Curl.curl_output("--location", "https://endoflife.date/api/#{product}/#{cycle}.json")
json = JSON.parse(result.stdout) if result.status.success?
json = nil if json&.dig("message")&.include?("Product not found")
json
key = "#{product}/#{cycle}"
return @eol_data[key] if @eol_data.key?(key)
result = Utils::Curl.curl_output(
"--location",
"https://endoflife.date/api/v1/products/#{product}/releases/#{cycle}",
)
return unless result.status.success?
@eol_data[key] = begin
JSON.parse(result.stdout)
rescue JSON::ParserError
nil
end
end

View File

@ -22,7 +22,7 @@ module Utils
gnu_tar_gtar_path = HOMEBREW_PREFIX/"opt/gnu-tar/bin/gtar"
gnu_tar_gtar = gnu_tar_gtar_path if gnu_tar_gtar_path.executable?
@executable = T.let((which("gtar") || gnu_tar_gtar || which("tar")), T.nilable(Pathname))
@executable = T.let(which("gtar") || gnu_tar_gtar || which("tar"), T.nilable(Pathname))
end
sig { params(path: T.any(Pathname, String)).void }

View File

@ -78,14 +78,14 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rainbow-3.1.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/rbs-3.9.2")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbs-3.9.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.12053/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.12067/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbi-0.3.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/redcarpet-3.6.1")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/redcarpet-3.6.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-support-3.13.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-core-3.13.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-expectations-3.13.4/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-mocks-3.13.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-mocks-3.13.4/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-3.13.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-github-3.0.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-retry-0.6.2/lib")
@ -95,12 +95,12 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-progressbar-1.13.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-emoji-4.0.4/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-display_width-3.1.4/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.75.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.75.5/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-md-2.0.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.25.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-3.6.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.10.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-lsp-0.23.16/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-lsp-0.23.17/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-macho-4.1.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/ruby-prof-1.7.1")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-prof-1.7.1/lib")
@ -108,9 +108,9 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov_json_formatter-0.1.4/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-0.22.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-cobertura-2.1.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-0.5.12053-universal-darwin/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-0.5.12053/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.5.12053/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-0.5.12067-universal-darwin/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-0.5.12067/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.5.12067/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/thor-1.3.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/spoom-1.6.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/stackprof-0.2.27")

Some files were not shown because too many files have changed in this diff Show More