Pass debug? and verbose? to Cleaner.

This commit is contained in:
Markus Reiter 2020-08-02 03:01:42 +02:00
parent 26688145f0
commit add10377b8
2 changed files with 10 additions and 4 deletions

View File

@ -10,9 +10,15 @@
# * sets permissions on executables
# * removes unresolved symlinks
class Cleaner
extend Predicable
attr_predicate :verbose?, :debug?
# Create a cleaner for the given formula
def initialize(f)
def initialize(f, verbose: false, debug: false)
@f = f
@verbose = verbose
@debug = debug
end
# Clean the keg of formula @f
@ -58,7 +64,7 @@ class Cleaner
# actual files gets removed correctly.
dirs.reverse_each do |d|
if d.children.empty?
puts "rmdir: #{d} (empty)" if Homebrew.args.verbose?
puts "rmdir: #{d} (empty)" if verbose?
d.rmdir
end
end
@ -109,7 +115,7 @@ class Cleaner
else
0444
end
if Homebrew.args.debug?
if debug?
old_perms = path.stat.mode & 0777
odebug "Fixing #{path} permissions from #{old_perms.to_s(8)} to #{perms.to_s(8)}" if perms != old_perms
end

View File

@ -956,7 +956,7 @@ class FormulaInstaller
def clean
ohai "Cleaning" if verbose?
Cleaner.new(formula).clean
Cleaner.new(formula, verbose: verbose?, debug: debug?).clean
rescue Exception => e # rubocop:disable Lint/RescueException
opoo "The cleaning step did not complete successfully"
puts "Still, the installation was successful, so we will link it into your prefix"