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