chef/mixlib-shellout

Windows installation issue - incompatible Ruby dependencies

Closed this issue · 5 comments

Version:

~> 3.0

Environment:

Windows Server 2019

Scenario:

I'm getting complaints from Ruby bundler upon installing mixlib-shellout.

Steps to Reproduce:

Install Ruby 2.7.1, Bundler
bundle config --local set specific_platform true

In gemspec:

 if specification.platform == 'x64_mingw'
    default_platform = specification.platform
    specification.platform = 'universal_mingw'
    specification.add_runtime_dependency "mixlib-shellout", "~> 3.0"
    specification.platform = default_platform
  else
    specification.add_runtime_dependency "mixlib-shellout", "~> 3.0"
  end

bundle install

Expected Result:

Happy Install

Actual Result:

Error message:
Unable to use the platform-specific (universal-mingw32) version of mixlib-shellout (3.1.4) because it has different dependencies from the ruby version. To use the platform-specific version of the gem, run `bundle config set specific_platform true` and install again.

I have been trying to work around this one for a few days now. As you can see, I tried the recommended action. I also tried to work the gemspec so the platform would be happy. I'm beginning to wonder if this gem just does not work with Ruby 2.7.1

ss-201012-090335

Screenshot. I'm running on GitHub actions.

hmm. a bundle install in master on ruby 2.7.1 works for me on windows. I wonder if this at all related to the gem that is adding it as a dep.

Well, it is a primary gem, used by the application. (Probably wrong terminology, no Ruby expert here). The Gemspec is referenced by the bundle install. For context, here is the full Gemspec:

# frozen_string_literal: true

::File.expand_path("../lib", __FILE__).tap do |directory|
  $LOAD_PATH.include? directory or $LOAD_PATH.unshift directory
end

require "kitchen/terraform/version.rb"
require "rubygems"

::Gem::Specification.new do |specification|
  specification.authors = ["Aaron Lane", "Nick Willever", "Kevin Dickerson", "Nell Shamrell-Harrington",
                           "Michael Glenney", "Walter Dolce", "Clay Thomas", "Erik R. Rygg", "Kyle Sexton",
                           "Ewa Czechowska", "Matt Long", "John Engelman", "Steven A. Burns", "David Begin",
                           "curleighbraces", "Austin Heiman", "Gary Foster", "Ed Bartholomew"]
  specification.description = "kitchen-terraform is a set of Test Kitchen plugins for testing Terraform configuration"
  specification.files = ::Dir.glob "{lib/**/*.rb,LICENSE,README.md}"
  specification.name = "kitchen-terraform"
  specification.summary = "Test Kitchen plugins for testing Terraform configuration"
  ::Kitchen::Terraform::Version.assign_specification_version specification: specification
  specification.email = "kitchen-terraform@newcontext.com"
  specification.homepage = "https://newcontext-oss.github.io/kitchen-terraform/"
  specification.license = "Apache-2.0"
  specification.add_development_dependency "bundler", "~> 2.0"
  specification.add_development_dependency "guard-bundler", "~> 2.1"
  specification.add_development_dependency "guard-rspec", "~> 4.7"
  specification.add_development_dependency "guard-yard", "~> 2.2"
  specification.add_development_dependency "guard", "~> 2.14"
  specification.add_development_dependency "middleman-autoprefixer", "~> 2.7"
  specification.add_development_dependency "middleman-favicon-maker", "~> 4.1"
  specification.add_development_dependency "middleman-livereload", "~> 3.4"
  specification.add_development_dependency "middleman-syntax", "~> 3.0"
  specification.add_development_dependency "middleman", "~> 4.2"
  specification.add_development_dependency "mini_racer", "~> 0.3.0"
  specification.add_development_dependency "pry-coolline", "~> 0.2"
  specification.add_development_dependency "pry", "~> 0.10"
  specification.add_development_dependency "reek", "~> 5.5"
  specification.add_development_dependency "rspec", "~> 3.4"
  specification.add_development_dependency "rufo", "~> 0.7"
  specification.add_development_dependency "simplecov", "~> 0.16.1"
  specification.add_development_dependency "travis", "~> 1.8"
  specification.add_development_dependency "yard", "~> 0.9"
  specification.add_runtime_dependency "dry-validation", "~> 0.13"
  specification.add_runtime_dependency "inspec", ">= 3", "< 5"
  specification.add_runtime_dependency "json", "~> 2.2"
  if specification.platform == 'x64_mingw32'
    default_platform = specification.platform
    specification.platform = 'universal-mingw32'
    specification.add_runtime_dependency "mixlib-shellout", "~> 3.0"
    specification.platform = default_platform
  else
    specification.add_runtime_dependency "mixlib-shellout", "~> 3.0"
  end
  specification.add_runtime_dependency "test-kitchen", "~> 2.1"
  specification.add_runtime_dependency "tty-which", "~> 0.4.0"

  specification.cert_chain = ["certs/gem-public_cert.pem"]
  specification.required_ruby_version = [">= 2.4", "< 2.8"]
  specification.requirements = ["Terraform >= v0.11.4, < v0.14.0"]
  specification.signing_key = "certs/gem-private_key.pem" if $PROGRAM_NAME =~ /gem\z/
end

Now that I see this is kitchen-terraform, I cloned that repo and copied in this gemspec. I did have to comment out mini_racer because it couldn't build libv8 due to some syntax error/python. I also commented out reek which was causing:

Bundler found conflicting requirements for the Ruby version:
  In gems.rb:
    Ruby (~> 2.7)

    reek (~> 5.5) was resolved to 5.6.0, which depends on
      psych (~> 3.1.0) was resolved to 3.1.0, which depends on
        Ruby (< 2.6, >= 2.3) x64-mingw32

However after commenting those 2 gems, my bundle install with ruby 2.7.1 worked. I wonder if you could try deleting your gems.locked file and try installing again.

Thanks, Matt. Problem is solved.