summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-05-06 10:07:22 -0700
committerGitHub <noreply@github.com>2020-05-06 10:07:22 -0700
commit8e850da9429bc0da24c8ac0961dc3401a29bae7f (patch)
tree59e239afd1f3e8b242ec7f4e65b366d841131f0e
parentec53e5ff30344216700ae42f72883477661feb91 (diff)
parentf439e5dbfeaadcf103fe8c88c01f939280c33535 (diff)
downloadchef-8e850da9429bc0da24c8ac0961dc3401a29bae7f.tar.gz
Merge pull request #9802 from chef/more_cleanup
More cleanup of our installed gems
-rw-r--r--omnibus/config/software/more-ruby-cleanup.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/omnibus/config/software/more-ruby-cleanup.rb b/omnibus/config/software/more-ruby-cleanup.rb
index 5ffbb43452..f5af0501cd 100644
--- a/omnibus/config/software/more-ruby-cleanup.rb
+++ b/omnibus/config/software/more-ruby-cleanup.rb
@@ -25,12 +25,23 @@ license :project_license
source path: "#{project.files_path}/#{name}"
build do
+ block "Removing console and setup binaries" do
+ Dir.glob("#{install_dir}/embedded/lib/ruby/gems/*/gems/*/bin/{console,setup}").each do |f|
+ puts "Deleting #{f}"
+ FileUtils.rm_rf(f)
+ end
+ end
+end
+
+build do
block "Removing additional non-code files from installed gems" do
# find the embedded ruby gems dir and clean it up for globbing
target_dir = "#{install_dir}/embedded/lib/ruby/gems/*/gems".tr('\\', "/")
files = %w{
+ *-public_cert.pem
*.blurb
*Upgrade.md
+ .dockerignore
autotest
autotest/*
bench
@@ -39,6 +50,7 @@ build do
design_rationale.rb
doc
doc-api
+ Dockerfile*
docs
ed25519.png
example
@@ -55,6 +67,7 @@ build do
rakelib
sample
samples
+ samus.json
site
test
tests
@@ -84,8 +97,11 @@ build do
}
Dir.glob(Dir.glob("#{target_dir}/*/{#{files.join(",")}}")).each do |f|
- # don't delete these files if there's a bin dir in the same dir or we're in a chef owned gem
- next if Dir.exist?(File.join(File.dirname(f), "bin")) || File.basename(File.expand_path("..", f)).start_with?("chef-")
+ # don't delete these files if there's a non-empty bin dir in the same dir
+ next if Dir.exist?(File.join(File.dirname(f), "bin")) && !Dir.empty?(File.join(File.dirname(f), "bin"))
+
+ # don't perform this cleanup in chef gems
+ next if File.basename(File.expand_path("..", f)).start_with?("chef-")
puts "Deleting #{f}"
FileUtils.rm_rf(f)