diff options
| author | Xu Cheng | 2016-01-09 18:59:34 +0800 |
|---|---|---|
| committer | Xu Cheng | 2016-01-09 20:28:15 +0800 |
| commit | 885022a5e3003e6beff467033983551089726141 (patch) | |
| tree | b53e3200a5cfb2136eb6be003b2cac339ee8da98 /Library | |
| parent | f0b22c4ce3beeb0abd242df4ab837cb533788247 (diff) | |
| download | brew-885022a5e3003e6beff467033983551089726141.tar.bz2 | |
add Keg#empty_installation?
Avoid using `FormulaAuditor` in `FormulaInstaller`.
Closes Homebrew/homebrew#47887.
Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/audit.rb | 18 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/keg.rb | 12 |
3 files changed, 19 insertions, 16 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index f881105a1..3750eaf25 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -883,19 +883,13 @@ class FormulaAuditor def audit_prefix_has_contents return unless formula.prefix.directory? - Pathname.glob("#{formula.prefix}/**/*") do |file| - next if file.directory? - basename = file.basename.to_s - next if Metafiles.copy?(basename) - next if %w[.DS_Store INSTALL_RECEIPT.json].include?(basename) - return + if Keg.new(formula.prefix).empty_installation? + problem <<-EOS.undent + The installation seems to be empty. Please ensure the prefix + is set correctly and expected files are installed. + The prefix configure/make argument may be case-sensitive. + EOS end - - problem <<-EOS.undent - The installation seems to be empty. Please ensure the prefix - is set correctly and expected files are installed. - The prefix configure/make argument may be case-sensitive. - EOS end def audit_conditional_dep(dep, condition, line) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index e5fd590b7..a9c99ae44 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -8,7 +8,6 @@ require "caveats" require "cleaner" require "formula_cellar_checks" require "install_renamed" -require "cmd/audit" require "cmd/postinstall" require "hooks/bottles" require "debrew" @@ -573,9 +572,7 @@ class FormulaInstaller end end - auditor = FormulaAuditor.new(formula) - auditor.audit_prefix_has_contents - unless formula.prefix.exist? && auditor.problems.empty? + if !formula.prefix.directory? || Keg.new(formula.prefix).empty_installation? raise "Empty installation" end diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index b977ea055..5d7415b7b 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -150,6 +150,18 @@ class Keg path.exist? end + def empty_installation? + Pathname.glob("#{path}/**/*") do |file| + next if file.directory? + basename = file.basename.to_s + next if Metafiles.copy?(basename) + next if %w[.DS_Store INSTALL_RECEIPT.json].include?(basename) + return false + end + + true + end + def /(other) path / other end |
