Merge pull request #20438 from Homebrew/formula-logfn
formula: improve variable naming
This commit is contained in:
commit
efae78dc96
@ -3067,12 +3067,12 @@ class Formula
|
||||
|
||||
@exec_count ||= T.let(0, T.nilable(Integer))
|
||||
@exec_count += 1
|
||||
logfn = format("#{logs}/#{active_log_prefix}%02<exec_count>d.%<cmd_base>s.log",
|
||||
exec_count: @exec_count,
|
||||
cmd_base: File.basename(cmd).split.first)
|
||||
log_filename = format("#{logs}/#{active_log_prefix}%02<exec_count>d.%<cmd_base>s.log",
|
||||
exec_count: @exec_count,
|
||||
cmd_base: File.basename(cmd).split.first)
|
||||
logs.mkpath
|
||||
|
||||
File.open(logfn, "w") do |log|
|
||||
File.open(log_filename, "w") do |log|
|
||||
log.puts Time.now, "", cmd, args, ""
|
||||
log.flush
|
||||
|
||||
@ -3082,7 +3082,7 @@ class Formula
|
||||
pid = fork do
|
||||
rd.close
|
||||
log.close
|
||||
exec_cmd(cmd, args, wr, logfn)
|
||||
exec_cmd(cmd, args, wr, log_filename)
|
||||
end
|
||||
wr.close
|
||||
|
||||
@ -3109,7 +3109,7 @@ class Formula
|
||||
end
|
||||
else
|
||||
pid = fork do
|
||||
exec_cmd(cmd, args, log, logfn)
|
||||
exec_cmd(cmd, args, log, log_filename)
|
||||
end
|
||||
end
|
||||
|
||||
@ -3122,8 +3122,8 @@ class Formula
|
||||
|
||||
log.flush
|
||||
if !verbose? || verbose_using_dots
|
||||
puts "Last #{log_lines} lines from #{logfn}:"
|
||||
Kernel.system "/usr/bin/tail", "-n", log_lines.to_s, logfn
|
||||
puts "Last #{log_lines} lines from #{log_filename}:"
|
||||
Kernel.system "/usr/bin/tail", "-n", log_lines.to_s, log_filename
|
||||
end
|
||||
log.puts
|
||||
|
||||
@ -3264,14 +3264,14 @@ class Formula
|
||||
|
||||
sig {
|
||||
params(
|
||||
cmd: T.any(String, Pathname),
|
||||
args: T::Array[T.any(String, Integer, Pathname, Symbol)],
|
||||
out: IO,
|
||||
logfn: T.nilable(String),
|
||||
cmd: T.any(String, Pathname),
|
||||
args: T::Array[T.any(String, Integer, Pathname, Symbol)],
|
||||
out: IO,
|
||||
log_filename: T.nilable(String),
|
||||
).void
|
||||
}
|
||||
def exec_cmd(cmd, args, out, logfn)
|
||||
ENV["HOMEBREW_CC_LOG_PATH"] = logfn
|
||||
def exec_cmd(cmd, args, out, log_filename)
|
||||
ENV["HOMEBREW_CC_LOG_PATH"] = log_filename
|
||||
|
||||
ENV.remove_cc_etc if cmd.to_s.start_with? "xcodebuild"
|
||||
|
||||
|
@ -524,7 +524,7 @@ end
|
||||
def log(basename, argv, tool, args)
|
||||
return unless ENV.key?("HOMEBREW_CC_LOG_PATH")
|
||||
|
||||
logfn = "#{ENV["HOMEBREW_CC_LOG_PATH"].delete_suffix(".log")}.cc.log"
|
||||
log_filename = "#{ENV["HOMEBREW_CC_LOG_PATH"].delete_suffix(".log")}.cc.log"
|
||||
adds = args - argv
|
||||
dels = argv - args
|
||||
|
||||
@ -533,7 +533,7 @@ def log(basename, argv, tool, args)
|
||||
s << "superenv removed: #{dels.join(" ")}\n" unless dels.empty?
|
||||
s << "superenv added: #{adds.join(" ")}\n" unless adds.empty?
|
||||
s << "superenv executed: #{tool} #{args.join(" ")}\n\n"
|
||||
File.open(logfn, "a+") { |f| f.write(s) }
|
||||
File.open(log_filename, "a+") { |f| f.write(s) }
|
||||
end
|
||||
|
||||
def remove_superbin_from_path(paths)
|
||||
|
Loading…
x
Reference in New Issue
Block a user