audit: check for hard-coded compilers

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Jack Nagel 2011-12-08 22:16:19 -06:00
parent f501e7f00b
commit 18bdd72827

View File

@ -135,6 +135,15 @@ def audit_formula_text name, text
problems << " * MacPorts patches should specify a revision instead of trunk"
end
# Avoid hard-coding compilers
if text =~ %r[(system|ENV\[.+\]\s?=)\s?['"](/usr/bin/)?(gcc|llvm-gcc|clang)['" ]]
problems << " * Use \"\#{ENV.cc}\" instead of hard-coding \"#{$3}\""
end
if text =~ %r[(system|ENV\[.+\]\s?=)\s?['"](/usr/bin/)?((g|llvm-g|clang)\+\+)['" ]]
problems << " * Use \"\#{ENV.cxx}\" instead of hard-coding \"#{$3}\""
end
return problems
end