aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2017-03-19 20:45:21 +0200
committerMike McQuaid2017-03-19 20:45:21 +0200
commiteadbd95d2c785c78ac4d6deee37e0841fc155d6b (patch)
treef164d0d1937c322b9df0401a54a8a2c3c10aba12
parent09a926f449fd1470911b6ea3efb43fab3b839491 (diff)
downloadbrew-eadbd95d2c785c78ac4d6deee37e0841fc155d6b.tar.bz2
audit: check system dupe deps on new formulae.
Provide a gentle nudge to users to check if these dependencies are definitely required.
-rw-r--r--Library/Homebrew/dev-cmd/audit.rb6
-rw-r--r--Library/Homebrew/formula_support.rb2
2 files changed, 8 insertions, 0 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb
index 677a52447..e246c7fb0 100644
--- a/Library/Homebrew/dev-cmd/audit.rb
+++ b/Library/Homebrew/dev-cmd/audit.rb
@@ -472,6 +472,12 @@ class FormulaAuditor
problem "Dependency '#{dep.name}' is an alias; use the canonical name '#{dep.to_formula.full_name}'."
end
+ if @new_formula && dep_f.keg_only_reason &&
+ !["openssl", "apr", "apr-util"].include?(dep.name) &&
+ [:provided_by_macos, :provided_by_osx].include?(dep_f.keg_only_reason.reason)
+ problem "Dependency '#{dep.name}' may be unnecessary as it is provided by macOS; try to build this formula without it."
+ end
+
dep.options.reject do |opt|
next true if dep_f.option_defined?(opt)
dep_f.requirements.detect do |r|
diff --git a/Library/Homebrew/formula_support.rb b/Library/Homebrew/formula_support.rb
index dcb995a6b..b8476f5cc 100644
--- a/Library/Homebrew/formula_support.rb
+++ b/Library/Homebrew/formula_support.rb
@@ -4,6 +4,8 @@ FormulaConflict = Struct.new(:name, :reason)
# Used to annotate formulae that duplicate macOS provided software
# or cause conflicts when linked in.
class KegOnlyReason
+ attr_reader :reason
+
def initialize(reason, explanation)
@reason = reason
@explanation = explanation