From 8b27b84b4bef0b364156b26739110b7efe51b4d0 Mon Sep 17 00:00:00 2001 From: Buck Evan Date: Sat, 17 Mar 2018 18:03:19 -0700 Subject: [PATCH] fix clang build version on Ubuntu Artful Ported from https://github.com/Linuxbrew/brew/pull/621 --- Library/Homebrew/development_tools.rb | 2 +- Library/Homebrew/system_config.rb | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/development_tools.rb b/Library/Homebrew/development_tools.rb index ba342c435c..1f0d77d148 100644 --- a/Library/Homebrew/development_tools.rb +++ b/Library/Homebrew/development_tools.rb @@ -74,7 +74,7 @@ class DevelopmentTools def clang_build_version @clang_build_version ||= begin if (path = locate("clang")) && - build_version = `#{path} --version`[/clang-(\d{2,})/, 1] + build_version = `#{path} --version`[%r{clang(-| version [^ ]+ \(tags/RELEASE_)(\d{2,})}, 2] Version.new build_version else Version::NULL diff --git a/Library/Homebrew/system_config.rb b/Library/Homebrew/system_config.rb index 63e162075e..8e3598b294 100644 --- a/Library/Homebrew/system_config.rb +++ b/Library/Homebrew/system_config.rb @@ -210,7 +210,18 @@ class SystemConfig f.puts "Homebrew Ruby: #{describe_homebrew_ruby}" f.puts "GCC-4.0: build #{gcc_4_0}" unless gcc_4_0.null? f.puts "GCC-4.2: build #{gcc_4_2}" unless gcc_4_2.null? - f.puts "Clang: #{clang.null? ? "N/A" : "#{clang} build #{clang_build}"}" + f.print "Clang: " + if clang.null? + f.print "N/A" + else + f.print "#{clang} build " + if clang_build.null? + f.print "(parse error)" + else + f.print clang_build + end + end + f.print "\n" f.puts "Git: #{describe_git}" f.puts "Curl: #{describe_curl}" f.puts "Perl: #{describe_perl}"