Pass args correctly in brew gist-logs.
This commit is contained in:
parent
0ac6939a91
commit
62a080d410
@ -33,7 +33,7 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
def gistify_logs(f)
|
||||
def gistify_logs(f, args:)
|
||||
files = load_logs(f.logs)
|
||||
build_time = f.logs.ctime
|
||||
timestamp = build_time.strftime("%Y-%m-%d_%H-%M-%S")
|
||||
@ -41,7 +41,7 @@ module Homebrew
|
||||
s = StringIO.new
|
||||
SystemConfig.dump_verbose_config s
|
||||
# Dummy summary file, asciibetically first, to control display title of gist
|
||||
files["# #{f.name} - #{timestamp}.txt"] = { content: brief_build_info(f) }
|
||||
files["# #{f.name} - #{timestamp}.txt"] = { content: brief_build_info(f, with_hostname: args.with_hostname?) }
|
||||
files["00.config.out"] = { content: s.string }
|
||||
files["00.doctor.out"] = { content: Utils.popen_read("#{HOMEBREW_PREFIX}/bin/brew", "doctor", err: :out) }
|
||||
unless f.core_formula?
|
||||
@ -69,19 +69,19 @@ module Homebrew
|
||||
else
|
||||
"#{f.name} (#{f.full_name}) on #{OS_VERSION} - Homebrew build logs"
|
||||
end
|
||||
url = create_gist(files, descr)
|
||||
url = create_gist(files, descr, private: args.private?)
|
||||
|
||||
url = create_issue(f.tap, "#{f.name} failed to build on #{MacOS.full_version}", url) if args.new_issue?
|
||||
|
||||
puts url if url
|
||||
end
|
||||
|
||||
def brief_build_info(f)
|
||||
def brief_build_info(f, with_hostname:)
|
||||
build_time_str = f.logs.ctime.strftime("%Y-%m-%d %H:%M:%S")
|
||||
s = +<<~EOS
|
||||
Homebrew build logs for #{f.full_name} on #{OS_VERSION}
|
||||
EOS
|
||||
if args.with_hostname?
|
||||
if with_hostname
|
||||
hostname = Socket.gethostname
|
||||
s << "Host: #{hostname}\n"
|
||||
end
|
||||
@ -122,13 +122,9 @@ module Homebrew
|
||||
logs
|
||||
end
|
||||
|
||||
def create_private?
|
||||
args.private?
|
||||
end
|
||||
|
||||
def create_gist(files, description)
|
||||
def create_gist(files, description, private:)
|
||||
url = "https://api.github.com/gists"
|
||||
data = { "public" => !create_private?, "files" => files, "description" => description }
|
||||
data = { "public" => !private, "files" => files, "description" => description }
|
||||
scopes = GitHub::CREATE_GIST_SCOPES
|
||||
GitHub.open_api(url, data: data, scopes: scopes)["html_url"]
|
||||
end
|
||||
@ -145,6 +141,6 @@ module Homebrew
|
||||
|
||||
Install.perform_preinstall_checks(all_fatal: true)
|
||||
Install.perform_build_from_source_checks(all_fatal: true)
|
||||
gistify_logs(args.resolved_formulae.first)
|
||||
gistify_logs(args.resolved_formulae.first, args: args)
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user