audit: only set up the build environment once

This commit is contained in:
Jack Nagel 2013-05-07 18:39:45 -05:00
parent 57534cf7b2
commit fedf9ddae3

View File

@ -7,6 +7,8 @@ module Homebrew extend self
formula_count = 0 formula_count = 0
problem_count = 0 problem_count = 0
ENV.setup_build_environment
ff = if ARGV.named.empty? ff = if ARGV.named.empty?
Formula Formula
else else
@ -295,17 +297,14 @@ class FormulaAuditor
end end
def audit_patches def audit_patches
# Some formulae use ENV in patches, so set up an environment Patches.new(f.patches).select(&:external?).each do |p|
ENV.with_build_environment do case p.url
Patches.new(f.patches).select { |p| p.external? }.each do |p| when %r[raw\.github\.com], %r[gist\.github\.com/raw]
case p.url unless p.url =~ /[a-fA-F0-9]{40}/
when %r[raw\.github\.com], %r[gist\.github\.com/raw] problem "GitHub/Gist patches should specify a revision:\n#{p.url}"
unless p.url =~ /[a-fA-F0-9]{40}/
problem "GitHub/Gist patches should specify a revision:\n#{p.url}"
end
when %r[macports/trunk]
problem "MacPorts patches should specify a revision instead of trunk:\n#{p.url}"
end end
when %r[macports/trunk]
problem "MacPorts patches should specify a revision instead of trunk:\n#{p.url}"
end end
end end
end end