Use HOMEBREW_TEMP more universally

This commit is contained in:
Bo Anderson 2024-02-26 16:58:39 +00:00
parent 7848bd3226
commit 1d7101d8a3
No known key found for this signature in database
8 changed files with 11 additions and 11 deletions

View File

@ -514,7 +514,7 @@ module Cask
return if artifacts.empty? return if artifacts.empty?
@tmpdir ||= Pathname(Dir.mktmpdir) @tmpdir ||= Pathname(Dir.mktmpdir("cask-audit", HOMEBREW_TEMP))
ohai "Downloading and extracting artifacts" ohai "Downloading and extracting artifacts"

View File

@ -207,7 +207,7 @@ on_request: true)
basename = downloader.basename basename = downloader.basename
if (nested_container = @cask.container&.nested) if (nested_container = @cask.container&.nested)
Dir.mktmpdir do |tmpdir| Dir.mktmpdir("cask-installer", HOMEBREW_TEMP) do |tmpdir|
tmpdir = Pathname(tmpdir) tmpdir = Pathname(tmpdir)
primary_container.extract(to: tmpdir, basename: basename, verbose: verbose?) primary_container.extract(to: tmpdir, basename: basename, verbose: verbose?)

View File

@ -446,7 +446,7 @@ module Homebrew
pr_check_conflicts("#{user}/#{repo}", pr) pr_check_conflicts("#{user}/#{repo}", pr)
ohai "Fetching #{tap} pull request ##{pr}" ohai "Fetching #{tap} pull request ##{pr}"
dir = Dir.mktmpdir pr dir = Dir.mktmpdir("pr-pull-#{pr}-", HOMEBREW_TEMP)
begin begin
cd dir do cd dir do
current_branch_head = ENV["GITHUB_SHA"] || tap.git_head current_branch_head = ENV["GITHUB_SHA"] || tap.git_head

View File

@ -40,7 +40,7 @@ module UnpackStrategy
return if volumes.empty? return if volumes.empty?
Dir.mktmpdir do |tmp_unpack_dir| Dir.mktmpdir("homebrew-zip", HOMEBREW_TEMP) do |tmp_unpack_dir|
tmp_unpack_dir = Pathname(tmp_unpack_dir) tmp_unpack_dir = Pathname(tmp_unpack_dir)
# `ditto` keeps Finder attributes intact and does not skip volume labels # `ditto` keeps Finder attributes intact and does not skip volume labels

View File

@ -125,7 +125,7 @@ module UnpackStrategy
).returns(T.untyped) ).returns(T.untyped)
} }
def extract_nestedly(to: nil, basename: nil, verbose: false, prioritize_extension: false) def extract_nestedly(to: nil, basename: nil, verbose: false, prioritize_extension: false)
Dir.mktmpdir do |tmp_unpack_dir| Dir.mktmpdir("homebrew-unpack", HOMEBREW_TEMP) do |tmp_unpack_dir|
tmp_unpack_dir = Pathname(tmp_unpack_dir) tmp_unpack_dir = Pathname(tmp_unpack_dir)
extract(to: tmp_unpack_dir, basename: basename, verbose: verbose) extract(to: tmp_unpack_dir, basename: basename, verbose: verbose)

View File

@ -181,7 +181,7 @@ module UnpackStrategy
end end
def mount(verbose: false) def mount(verbose: false)
Dir.mktmpdir do |mount_dir| Dir.mktmpdir("homebrew-dmg", HOMEBREW_TEMP) do |mount_dir|
mount_dir = Pathname(mount_dir) mount_dir = Pathname(mount_dir)
without_eula = system_command( without_eula = system_command(

View File

@ -35,7 +35,7 @@ module UnpackStrategy
sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) }
def extract_to_dir(unpack_dir, basename:, verbose:) def extract_to_dir(unpack_dir, basename:, verbose:)
Dir.mktmpdir do |tmpdir| Dir.mktmpdir("homebrew-tar", HOMEBREW_TEMP) do |tmpdir|
tar_path = if DependencyCollector.tar_needs_xz_dependency? && Xz.can_extract?(path) tar_path = if DependencyCollector.tar_needs_xz_dependency? && Xz.can_extract?(path)
subextract(Xz, Pathname(tmpdir), verbose) subextract(Xz, Pathname(tmpdir), verbose)
elsif Zstd.can_extract?(path) elsif Zstd.can_extract?(path)

View File

@ -114,7 +114,7 @@ module Homebrew
versions[id] = version if id && version versions[id] = version if id && version
end end
Dir.mktmpdir do |dir| Dir.mktmpdir("cask-checker", HOMEBREW_TEMP) do |dir|
dir = Pathname(dir) dir = Pathname(dir)
installer.extract_primary_container(to: dir) installer.extract_primary_container(to: dir)
@ -150,7 +150,7 @@ module Homebrew
pkg_paths = Pathname.glob(dir/"**"/"*.pkg").sort if pkg_paths.empty? pkg_paths = Pathname.glob(dir/"**"/"*.pkg").sort if pkg_paths.empty?
pkg_paths.each do |pkg_path| pkg_paths.each do |pkg_path|
Dir.mktmpdir do |extract_dir| Dir.mktmpdir("cask-checker", HOMEBREW_TEMP) do |extract_dir|
extract_dir = Pathname(extract_dir) extract_dir = Pathname(extract_dir)
FileUtils.rmdir extract_dir FileUtils.rmdir extract_dir
@ -178,7 +178,7 @@ module Homebrew
return return
end end
Dir.mktmpdir do |dir| Dir.mktmpdir("cask-checker", HOMEBREW_TEMP) do |dir|
dir = Pathname(dir) dir = Pathname(dir)
installer.then do |i| installer.then do |i|
@ -208,7 +208,7 @@ module Homebrew
.plist .plist
.map { |package| package.fetch("Package") } .map { |package| package.fetch("Package") }
Dir.mktmpdir do |extract_dir| Dir.mktmpdir("cask-checker", HOMEBREW_TEMP) do |extract_dir|
extract_dir = Pathname(extract_dir) extract_dir = Pathname(extract_dir)
FileUtils.rmdir extract_dir FileUtils.rmdir extract_dir