diff options
author | Neha Pansare <neha.pansare@progress.com> | 2022-09-05 15:01:49 +0530 |
---|---|---|
committer | Neha Pansare <neha.pansare@progress.com> | 2022-09-05 15:01:49 +0530 |
commit | 2a4f4cfc525d3c7f901b4fb6590943629701d9c6 (patch) | |
tree | 06f225eafce0f95b3e962dc9850cb4103eb6cdcf | |
parent | af2813a5fe1ce014967ad7833075ac5bf831b8d4 (diff) | |
download | chef-neha-p6/INFC-218_ffi_failures_rebased.tar.gz |
Changes to install chef-powershell gem from git repo instead of ruby gemsneha-p6/INFC-218_ffi_failures_rebased
Signed-off-by: Neha Pansare <neha.pansare@progress.com>
-rw-r--r-- | Gemfile | 13 | ||||
-rw-r--r-- | post-bundle-install.rb | 30 |
2 files changed, 34 insertions, 9 deletions
@@ -41,10 +41,10 @@ end gem "proxifier", git: "https://github.com/chef/ruby-proxifier", branch: "lcg/ruby-3" # Everything except AIX and Windows -group(:ruby_shadow) do - # if ruby-shadow does a release that supports ruby-3.0 this can be removed - gem "ruby-shadow", git: "https://github.com/chef/ruby-shadow", branch: "lcg/ruby-3.0", platforms: :ruby unless RUBY_PLATFORM == "x64-mingw-ucrt" -end +# group(:ruby_shadow) do +# # if ruby-shadow does a release that supports ruby-3.0 this can be removed +# gem "ruby-shadow", git: "https://github.com/chef/ruby-shadow", branch: "lcg/ruby-3.0", platforms: :ruby unless RUBY_PLATFORM == "x64-mingw-ucrt" +# end # deps that cannot be put in the knife gem because they require a compiler and fail on windows nodes group(:knife_windows_deps) do @@ -58,7 +58,7 @@ group(:development, :test) do gem "fauxhai-ng" # for chef-utils gem end -gem "chefstyle" +#gem "chefstyle" # group(:chefstyle) do # # for testing new chefstyle rules # gem "chefstyle", git: "https://github.com/chef/chefstyle.git", branch: "main" @@ -80,7 +80,8 @@ eval_gemfile("./Gemfile.local") if File.exist?("./Gemfile.local") # # We copy (and overwrite) these files every time "bundle <exec|install>" is # executed, just in case they have changed. -if RUBY_PLATFORM.match?(/mswin|mingw|windows/) +if RUBY_PLATFORM.match?(/mswin|mingw|windows|x64-mingw-ucrt/) + gem "chef-powershell", git: "https://github.com/chef/chef-powershell-shim.git", branch: "neha-p6/rescue_ffi_parsing", glob: "chef-powershell/*.gemspec" instance_eval do ruby_exe_dir = RbConfig::CONFIG["bindir"] assemblies = Dir.glob(File.expand_path("distro/ruby_bin_folder/#{ENV["PROCESSOR_ARCHITECTURE"]}", __dir__) + "**/*") diff --git a/post-bundle-install.rb b/post-bundle-install.rb index f3b953e7e3..165d9ee21d 100644 --- a/post-bundle-install.rb +++ b/post-bundle-install.rb @@ -1,5 +1,7 @@ #!/usr/bin/env ruby +require 'fileutils' + gem_home = Gem.paths.home puts "fixing bundle installed gems in #{gem_home}" @@ -9,10 +11,28 @@ puts "fixing bundle installed gems in #{gem_home}" # rake install since we need --conservative --minimal-deps in order to not install duplicate gems. # Dir["#{gem_home}/bundler/gems/*"].each do |gempath| + puts "===Gempath: #{gempath.inspect}" matches = File.basename(gempath).match(/.*-[A-Fa-f0-9]{12}/) next unless matches - gem_name = File.basename(Dir["#{gempath}/*.gemspec"].first, ".gemspec") + if gempath.match("chef-powershell") + path = "#{gempath}/chef-powershell" + + #For now copy the windowspowershell dlls at chef/chef to gem here + dll_files = Dir.glob(File.expand_path("distro/ruby_bin_folder/#{ENV["PROCESSOR_ARCHITECTURE"]}", __dir__) + "**/*") + puts "=== dll files #{dll_files.inspect}" + bin_path = "#{path}/bin/ruby_bin_folder/#{ENV["PROCESSOR_ARCHITECTURE"]}" + puts "==== bin_path:#{bin_path}" + + FileUtils.mkdir_p "#{bin_path}" + FileUtils.cp_r dll_files, bin_path + + puts "=== bin_path contents after copying: #{Dir[bin_path + '/*']}}" + else + path = "#{gempath}" + end + + gem_name = File.basename(Dir["#{path}/*.gemspec"].first, ".gemspec") # FIXME: should strip any valid ruby platform off of the gem_name if it matches next unless gem_name @@ -22,8 +42,12 @@ Dir["#{gem_home}/bundler/gems/*"].each do |gempath| puts "re-installing #{gem_name}..." - Dir.chdir(gempath) do + Dir.chdir(path) do + if gem_name == "chef-powershell" + File.delete("#{gem_name}.gemspec") if File.exist?("#{gem_name}.gemspec") + File.rename("template.txt", "chef-powershell.gemspec") + end system("gem build #{gem_name}.gemspec") or raise "gem build failed" system("gem install #{gem_name}*.gem --conservative --minimal-deps --no-document") or raise "gem install failed" end -end +end
\ No newline at end of file |