add Keg#empty_installation?
Avoid using `FormulaAuditor` in `FormulaInstaller`. Closes Homebrew/homebrew#47887. Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
parent
f0b22c4ce3
commit
885022a5e3
@ -883,19 +883,13 @@ class FormulaAuditor
|
|||||||
def audit_prefix_has_contents
|
def audit_prefix_has_contents
|
||||||
return unless formula.prefix.directory?
|
return unless formula.prefix.directory?
|
||||||
|
|
||||||
Pathname.glob("#{formula.prefix}/**/*") do |file|
|
if Keg.new(formula.prefix).empty_installation?
|
||||||
next if file.directory?
|
problem <<-EOS.undent
|
||||||
basename = file.basename.to_s
|
The installation seems to be empty. Please ensure the prefix
|
||||||
next if Metafiles.copy?(basename)
|
is set correctly and expected files are installed.
|
||||||
next if %w[.DS_Store INSTALL_RECEIPT.json].include?(basename)
|
The prefix configure/make argument may be case-sensitive.
|
||||||
return
|
EOS
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
def audit_conditional_dep(dep, condition, line)
|
def audit_conditional_dep(dep, condition, line)
|
||||||
|
|||||||
@ -8,7 +8,6 @@ require "caveats"
|
|||||||
require "cleaner"
|
require "cleaner"
|
||||||
require "formula_cellar_checks"
|
require "formula_cellar_checks"
|
||||||
require "install_renamed"
|
require "install_renamed"
|
||||||
require "cmd/audit"
|
|
||||||
require "cmd/postinstall"
|
require "cmd/postinstall"
|
||||||
require "hooks/bottles"
|
require "hooks/bottles"
|
||||||
require "debrew"
|
require "debrew"
|
||||||
@ -573,9 +572,7 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
auditor = FormulaAuditor.new(formula)
|
if !formula.prefix.directory? || Keg.new(formula.prefix).empty_installation?
|
||||||
auditor.audit_prefix_has_contents
|
|
||||||
unless formula.prefix.exist? && auditor.problems.empty?
|
|
||||||
raise "Empty installation"
|
raise "Empty installation"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -150,6 +150,18 @@ class Keg
|
|||||||
path.exist?
|
path.exist?
|
||||||
end
|
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)
|
def /(other)
|
||||||
path / other
|
path / other
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user