summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-07-31 14:15:14 -0700
committerTim Smith <tsmith84@gmail.com>2020-07-31 14:35:49 -0700
commit1a3a4f835b8b7758bdd516f881110ad82c0030b3 (patch)
treeb9d1cb277eaa92fd9d935b02f01db1245e68c3dd
parentd9519dbbfb3927e5fb6228ed435778dbd103a24f (diff)
downloadchef-1a3a4f835b8b7758bdd516f881110ad82c0030b3.tar.gz
Cleanup more files from our package's gem installs
Nuke more useless files in gems Remove all the empty gem dirs for the ruby built in gems so we can skip shipping 41 empty folders Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--cspell.json1
-rw-r--r--omnibus/config/software/more-ruby-cleanup.rb23
2 files changed, 21 insertions, 3 deletions
diff --git a/cspell.json b/cspell.json
index 28135ac3bf..3ecb709c52 100644
--- a/cspell.json
+++ b/cspell.json
@@ -1530,6 +1530,7 @@
"singleline",
"Singleuser",
"SINGLEUSERTS",
+ "sitearchdir",
"SITENAME",
"skipkeys",
"skippyj",
diff --git a/omnibus/config/software/more-ruby-cleanup.rb b/omnibus/config/software/more-ruby-cleanup.rb
index 2bafd83be9..95412abd5a 100644
--- a/omnibus/config/software/more-ruby-cleanup.rb
+++ b/omnibus/config/software/more-ruby-cleanup.rb
@@ -45,11 +45,18 @@ build 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{
+ .rspec-tm
+ .sitearchdir.time
*-public_cert.pem
+ bootstrap.sh
+ diagrams
example
examples
ext
Gemfile.lock
+ java
+ patches
+ perf
rakelib
sample
samples
@@ -58,7 +65,7 @@ build do
VERSION
}
- Dir.glob(Dir.glob("#{target_dir}/*/{#{files.join(",")}}")).each do |f|
+ Dir.glob("#{target_dir}/*/{#{files.join(",")}}").each do |f|
# chef stores the powershell dlls in the ext dir
next if File.basename(File.expand_path("..", f)).start_with?("chef-")
@@ -77,7 +84,7 @@ build do
tasks
}
- Dir.glob(Dir.glob("#{target_dir}/*/{#{files.join(",")}}")).each do |f|
+ Dir.glob("#{target_dir}/*/{#{files.join(",")}}").each do |f|
# 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"))
@@ -90,7 +97,7 @@ build do
end
block "Removing spec dirs from non-Chef gems" do
- Dir.glob(Dir.glob("#{install_dir}/embedded/lib/ruby/gems/*/gems/*/spec".tr('\\', "/"))).each do |f|
+ Dir.glob("#{install_dir}/embedded/lib/ruby/gems/*/gems/*/spec".tr('\\', "/")).each do |f|
# if we're in a chef- gem then don't remove the specs
next if File.basename(File.expand_path("..", f)).start_with?("chef-")
@@ -98,4 +105,14 @@ build do
FileUtils.rm_rf(f)
end
end
+
+ block "Remove empty gem dirs from Ruby's built-in gems" do
+ Dir.glob("#{install_dir}/embedded/lib/ruby/gems/*/gems/*".tr('\\', "/")).each do |d|
+ # skip unless the dir is empty
+ next unless Dir.children(d).empty?
+
+ puts "Deleting empty gem dir: #{d}"
+ FileUtils.rm_rf(d)
+ end
+ end
end