Skip to content

Commit

Permalink
Merge pull request #179162 from Homebrew/g-rubocop-no-rmrf
Browse files Browse the repository at this point in the history
g*: Fix `Homebrew/NoFileutilsRmrf` RuboCop offenses
  • Loading branch information
chenrui333 committed Jul 31, 2024
2 parents 2aa3cf3 + 0490d4f commit b6b8a1b
Show file tree
Hide file tree
Showing 39 changed files with 73 additions and 73 deletions.
2 changes: 1 addition & 1 deletion Formula/g/gatsby-cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def install
end

clipboardy_fallbacks_dir = node_modules/"clipboardy/fallbacks"
clipboardy_fallbacks_dir.rmtree # remove pre-built binaries
rm_r(clipboardy_fallbacks_dir) # remove pre-built binaries
if OS.linux?
linux_dir = clipboardy_fallbacks_dir/"linux"
linux_dir.mkpath
Expand Down
6 changes: 3 additions & 3 deletions Formula/g/gcc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ def install
# Rename man7.
man7.glob("*.7") { |file| add_suffix file, version_suffix }
# Even when we disable building info pages some are still installed.
info.rmtree
rm_r(info)

# Work around GCC install bug
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105664
rm_rf bin.glob("*-gcc-tmp")
rm_r(bin.glob("*-gcc-tmp"))
end

def add_suffix(file, suffix)
Expand Down Expand Up @@ -201,7 +201,7 @@ def post_install
specs = libgcc/"specs"
ohai "Creating the GCC specs file: #{specs}"
specs_orig = Pathname.new("#{specs}.orig")
rm_f [specs_orig, specs]
rm([specs_orig, specs])

system_header_dirs = ["#{HOMEBREW_PREFIX}/include"]

Expand Down
6 changes: 3 additions & 3 deletions Formula/g/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ def install
# Rename man7.
Dir.glob(man7/"*.7") { |file| add_suffix file, version_suffix }
# Even when we disable building info pages some are still installed.
info.rmtree
rm_r(info)

# Work around GCC install bug
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105664
rm_rf Dir[bin/"*-gcc-tmp"]
rm_r(Dir[bin/"*-gcc-tmp"])
end

def add_suffix(file, suffix)
Expand Down Expand Up @@ -163,7 +163,7 @@ def post_install
specs = libgcc/"specs"
ohai "Creating the GCC specs file: #{specs}"
specs_orig = Pathname.new("#{specs}.orig")
rm_f [specs_orig, specs]
rm([specs_orig, specs])

system_header_dirs = ["#{HOMEBREW_PREFIX}/include"]

Expand Down
6 changes: 3 additions & 3 deletions Formula/g/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ def install
# Rename man7.
man7.glob("*.7") { |file| add_suffix file, version.major }
# Even when we disable building info pages some are still installed.
info.rmtree
rm_r(info)

# Work around GCC install bug
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105664
rm_rf bin.glob("*-gcc-tmp")
rm_r(bin.glob("*-gcc-tmp"))
end

def add_suffix(file, suffix)
Expand Down Expand Up @@ -164,7 +164,7 @@ def post_install
specs = libgcc/"specs"
ohai "Creating the GCC specs file: #{specs}"
specs_orig = Pathname.new("#{specs}.orig")
rm_f [specs_orig, specs]
rm([specs_orig, specs])

system_header_dirs = ["#{HOMEBREW_PREFIX}/include"]

Expand Down
6 changes: 3 additions & 3 deletions Formula/g/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ def install
# Rename man7.
man7.glob("*.7") { |file| add_suffix file, version.major }
# Even when we disable building info pages some are still installed.
info.rmtree
rm_r(info)

# Work around GCC install bug
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105664
rm_rf bin.glob("*-gcc-tmp")
rm_r(bin.glob("*-gcc-tmp"))
end

def add_suffix(file, suffix)
Expand Down Expand Up @@ -170,7 +170,7 @@ def post_install
specs = libgcc/"specs"
ohai "Creating the GCC specs file: #{specs}"
specs_orig = Pathname.new("#{specs}.orig")
rm_f [specs_orig, specs]
rm([specs_orig, specs])

system_header_dirs = ["#{HOMEBREW_PREFIX}/include"]

Expand Down
6 changes: 3 additions & 3 deletions Formula/g/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ def install
# Rename man7.
man7.glob("*.7") { |file| add_suffix file, version.major }
# Even when we disable building info pages some are still installed.
info.rmtree
rm_r(info)

# Work around GCC install bug
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105664
rm_rf bin.glob("*-gcc-tmp")
rm_r(bin.glob("*-gcc-tmp"))
end

def add_suffix(file, suffix)
Expand Down Expand Up @@ -167,7 +167,7 @@ def post_install
specs = libgcc/"specs"
ohai "Creating the GCC specs file: #{specs}"
specs_orig = Pathname.new("#{specs}.orig")
rm_f [specs_orig, specs]
rm([specs_orig, specs])

system_header_dirs = ["#{HOMEBREW_PREFIX}/include"]

Expand Down
4 changes: 2 additions & 2 deletions Formula/g/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def install
# Rename man7.
Dir.glob(man7/"*.7") { |file| add_suffix file, version_suffix }
# Even when we disable building info pages some are still installed.
info.rmtree
rm_r(info)
end

def add_suffix(file, suffix)
Expand Down Expand Up @@ -179,7 +179,7 @@ def post_install
specs = libgcc/"specs"
ohai "Creating the GCC specs file: #{specs}"
specs_orig = Pathname.new("#{specs}.orig")
rm_f [specs_orig, specs]
rm([specs_orig, specs])

system_header_dirs = ["#{HOMEBREW_PREFIX}/include"]

Expand Down
4 changes: 2 additions & 2 deletions Formula/g/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def install
# Rename man7.
Dir.glob(man7/"*.7") { |file| add_suffix file, version_suffix }
# Even when we disable building info pages some are still installed.
info.rmtree
rm_r(info)
end

def add_suffix(file, suffix)
Expand Down Expand Up @@ -185,7 +185,7 @@ def post_install
specs = libgcc/"specs"
ohai "Creating the GCC specs file: #{specs}"
specs_orig = Pathname.new("#{specs}.orig")
rm_f [specs_orig, specs]
rm([specs_orig, specs])

system_header_dirs = ["#{HOMEBREW_PREFIX}/include"]

Expand Down
4 changes: 2 additions & 2 deletions Formula/g/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def install
# Rename man7.
Dir.glob(man7/"*.7") { |file| add_suffix file, version_suffix }
# Even when we disable building info pages some are still installed.
info.rmtree
rm_r(info)
end

def add_suffix(file, suffix)
Expand Down Expand Up @@ -169,7 +169,7 @@ def post_install
specs = libgcc/"specs"
ohai "Creating the GCC specs file: #{specs}"
specs_orig = Pathname.new("#{specs}.orig")
rm_f [specs_orig, specs]
rm([specs_orig, specs])

system_header_dirs = ["#{HOMEBREW_PREFIX}/include"]

Expand Down
4 changes: 2 additions & 2 deletions Formula/g/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def install
# Rename man7.
Dir.glob(man7/"*.7") { |file| add_suffix file, version_suffix }
# Even when we disable building info pages some are still installed.
info.rmtree
rm_r(info)
end

def add_suffix(file, suffix)
Expand Down Expand Up @@ -177,7 +177,7 @@ def post_install
specs = libgcc/"specs"
ohai "Creating the GCC specs file: #{specs}"
specs_orig = Pathname.new("#{specs}.orig")
rm_f [specs_orig, specs]
rm([specs_orig, specs])

system_header_dirs = ["#{HOMEBREW_PREFIX}/include"]

Expand Down
6 changes: 3 additions & 3 deletions Formula/g/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ def install
# Rename man7.
Dir.glob(man7/"*.7") { |file| add_suffix file, version_suffix }
# Even when we disable building info pages some are still installed.
info.rmtree
rm_r(info)

# Work around GCC install bug
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105664
rm_rf Dir[bin/"*-gcc-tmp"]
rm_r(Dir[bin/"*-gcc-tmp"])
end

def post_install
Expand All @@ -155,7 +155,7 @@ def post_install
specs = libgcc/"specs"
ohai "Creating the GCC specs file: #{specs}"
specs_orig = Pathname.new("#{specs}.orig")
rm_f [specs_orig, specs]
rm([specs_orig, specs])

system_header_dirs = ["#{HOMEBREW_PREFIX}/include"]

Expand Down
4 changes: 2 additions & 2 deletions Formula/g/geckodriver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def install
%w[webdriver mozbase].each do |r|
(buildpath/"staging").install resource(r)
mv buildpath/"staging"/"testing"/r, buildpath/"testing"
rm_rf buildpath/"staging"/"testing"
rm_r(buildpath/"staging"/"testing")
end
rm_rf buildpath/"staging"
rm_r(buildpath/"staging")
(buildpath/"testing"/"geckodriver").install resource("Cargo.lock")
end

Expand Down
2 changes: 1 addition & 1 deletion Formula/g/geph4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def install
ENV["OPENSSL_DIR"] = Formula["openssl@3"].opt_prefix
ENV["OPENSSL_NO_VENDOR"] = "1"

(buildpath/".cargo").rmtree
rm_r(buildpath/".cargo")
system "cargo", "install", *std_cargo_args
end

Expand Down
2 changes: 1 addition & 1 deletion Formula/g/ghostscript.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Ghostscript < Formula
def install
# Delete local vendored sources so build uses system dependencies
libs = %w[expat freetype jbig2dec jpeg lcms2mt libpng openjpeg tiff zlib]
libs.each { |l| (buildpath/l).rmtree }
libs.each { |l| rm_r(buildpath/l) }

configure = build.head? ? "./autogen.sh" : "./configure"
system configure, *std_configure_args,
Expand Down
2 changes: 1 addition & 1 deletion Formula/g/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def install
# purged by Homebrew's post-install cleaner because that doesn't check
# "Library" directories. It is however pointless to keep around as it
# only contains the perllocal.pod installation file.
rm_rf prefix/"Library/Perl"
rm_r(prefix/"Library/Perl")

# Set the macOS keychain credential helper by default
# (as Apple's CLT's git also does this).
Expand Down
2 changes: 1 addition & 1 deletion Formula/g/glassfish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Glassfish < Formula

def install
# Remove all windows files
rm_rf Dir["bin/*.bat", "glassfish/bin/*.bat"]
rm_r(Dir["bin/*.bat", "glassfish/bin/*.bat"])

libexec.install Dir["*"]
bin.install Dir["#{libexec}/bin/*"]
Expand Down
6 changes: 3 additions & 3 deletions Formula/g/glibc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,15 @@ def install
include /etc/ld.so.conf
EOS

rm_f etc/"ld.so.cache"
rm(etc/"ld.so.cache")
ensure
# Delete bootstrap binaries after build is finished.
rm_rf bootstrap_dir
rm_r(bootstrap_dir)
end

def post_install
# Rebuild ldconfig cache
rm_f etc/"ld.so.cache"
rm(etc/"ld.so.cache")
system sbin/"ldconfig"

# Compile locale definition files
Expand Down
2 changes: 1 addition & 1 deletion Formula/g/gnutls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def install
end

def post_install
rm_f pkgetc/"cert.pem"
rm(pkgetc/"cert.pem")
pkgetc.install_symlink Formula["ca-certificates"].pkgetc/"cert.pem"
end

Expand Down
4 changes: 2 additions & 2 deletions Formula/g/go-boring.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ def install
system "./make.bash", "--no-clean"
end

(buildpath/"pkg/obj").rmtree
rm_r(buildpath/"pkg/obj")
libexec.install Dir["*"]
bin.install_symlink Dir[libexec/"bin/go*"]

system bin/"go", "install", "-race", "std"

# Remove useless files.
# Breaks patchelf because folder contains weird debug/test files
Dir.glob(libexec/"**/testdata").each { |testdata| rm_rf testdata }
Dir.glob(libexec/"**/testdata").each { |testdata| rm_r(testdata) }
end

test do
Expand Down
6 changes: 3 additions & 3 deletions Formula/g/go.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,17 @@ def install
with_env(CC: "cc", CXX: "c++") { system "./make.bash" }
end

rm_rf "gobootstrap" # Bootstrap not required beyond compile.
rm_r("gobootstrap") # Bootstrap not required beyond compile.
libexec.install Dir["*"]
bin.install_symlink Dir[libexec/"bin/go*"]

system bin/"go", "install", "std", "cmd"

# Remove useless files.
# Breaks patchelf because folder contains weird debug/test files
(libexec/"src/debug/elf/testdata").rmtree
rm_r(libexec/"src/debug/elf/testdata")
# Binaries built for an incompatible architecture
(libexec/"src/runtime/pprof/testdata").rmtree
rm_r(libexec/"src/runtime/pprof/testdata")
end

test do
Expand Down
6 changes: 3 additions & 3 deletions Formula/g/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ def install
system "./make.bash", "--no-clean"
end

(buildpath/"pkg/obj").rmtree
rm_r(buildpath/"pkg/obj")
libexec.install Dir["*"]
bin.install_symlink Dir[libexec/"bin/go*"]

system bin/"go", "install", "-race", "std"

# Remove useless files.
# Breaks patchelf because folder contains weird debug/test files
(libexec/"src/debug/elf/testdata").rmtree
rm_r(libexec/"src/debug/elf/testdata")
# Binaries built for an incompatible architecture
(libexec/"src/runtime/pprof/testdata").rmtree
rm_r(libexec/"src/runtime/pprof/testdata")
end

test do
Expand Down
6 changes: 3 additions & 3 deletions Formula/g/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ def install
system "./make.bash", "--no-clean"
end

(buildpath/"pkg/obj").rmtree
rm_r(buildpath/"pkg/obj")
libexec.install Dir["*"]
bin.install_symlink Dir[libexec/"bin/go*"]

system bin/"go", "install", "-race", "std"

# Remove useless files.
# Breaks patchelf because folder contains weird debug/test files
(libexec/"src/debug/elf/testdata").rmtree
rm_r(libexec/"src/debug/elf/testdata")
# Binaries built for an incompatible architecture
(libexec/"src/runtime/pprof/testdata").rmtree
rm_r(libexec/"src/runtime/pprof/testdata")
end

test do
Expand Down
6 changes: 3 additions & 3 deletions Formula/g/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ def install
system "./make.bash", "--no-clean"
end

(buildpath/"pkg/obj").rmtree
rm_r(buildpath/"pkg/obj")
libexec.install Dir["*"]
bin.install_symlink Dir[libexec/"bin/go*"]

system bin/"go", "install", "-race", "std"

# Remove useless files.
# Breaks patchelf because folder contains weird debug/test files
(libexec/"src/debug/elf/testdata").rmtree
rm_r(libexec/"src/debug/elf/testdata")
# Binaries built for an incompatible architecture
(libexec/"src/runtime/pprof/testdata").rmtree
rm_r(libexec/"src/runtime/pprof/testdata")
end

test do
Expand Down
Loading

0 comments on commit b6b8a1b

Please sign in to comment.