Keep info/#{f.name}/dir files in cleaner

Still cleans `info/dir` and `info/<arch>/dir` files.

Fixes https://github.com/Homebrew/homebrew-core/issues/100190
This commit is contained in:
Tim Visher 2022-04-27 23:34:14 -04:00
parent 80e5327013
commit fbb3ccbfd6
2 changed files with 21 additions and 1 deletions

View File

@ -31,7 +31,7 @@ class Cleaner
# Get rid of any info 'dir' files, so they don't conflict at the link stage
Dir.glob(@f.info/"**/dir").each do |f|
info_dir_file = Pathname(f)
observe_file_removal info_dir_file if info_dir_file.file? && !@f.skip_clean?(info_dir_file)
observe_file_removal info_dir_file if info_dir_file.file? && info_dir_file != Pathname("#{@f.info}/#{@f.name}/dir") && !@f.skip_clean?(info_dir_file)
end
rewrite_shebangs

View File

@ -136,6 +136,26 @@ describe Cleaner do
expect(file).not_to exist
end
it "removes 'info/**/dir' files except for 'info/<name>/dir'" do
file = f.info/"dir"
arch_file = f.info/"i686-elf/dir"
name_file = f.info/"#{f.name}/dir"
f.info.mkpath
(f.info/"i686-elf").mkpath
(f.info/"#{f.name}").mkpath
touch file
touch arch_file
touch name_file
cleaner.clean
expect(file).not_to exist
expect(arch_file).not_to exist
expect(name_file).to exist
end
end
describe "::skip_clean" do