From d42b00a38a140dd95ce2d739691762c026dd156e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 20 May 2020 12:21:35 +0200 Subject: [PATCH] Upgrade rubygems in CI We want to use rubygems versions that keep requirements as originally specified instead of sorting them, since it's the behavior of the most recent rubygems. So we revert commit 5efae43e697b49ee5dd792464c1f039fdf97947a that first changed the expectation to "sorted requirements". Because of the revert, we need to make sure we test against rubygems versions that don't sort requirements. That means either versions higher than 3.1.0.pre1, because they include [the change where sorting was reverted](https://github.com/rubygems/rubygems/commit/f2d95173d8fcbddea468db842b4671575544f1d0), or versions lower than 2.7.8, because they don't include [the change where the sorting was first introduced](https://github.com/rubygems/rubygems/commit/8ce0598a91db18108f6a4e5efeb23fa3bacd9d9f). So, since the latest rubygems doesn't support old rubies, install 2.7.7 in the case of ruby 2.0.0, and the latest rubygems otherwise. --- .travis.yml | 7 ++++++- spec/resolver_spec.rb | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8c98919..0025b99 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,12 @@ env: - LANG="en_US.UTF-8" install: - - gem update --system 2.7.10 + - if [ "$TRAVIS_RUBY_VERSION" = "2.0.0" ]; then + gem update --system 2.7.7; + else + gem update --system 3.1.3; + fi + - gem install bundler -v "~> 1.17" - rake bootstrap diff --git a/spec/resolver_spec.rb b/spec/resolver_spec.rb index 7f4dcfe..02e9347 100644 --- a/spec/resolver_spec.rb +++ b/spec/resolver_spec.rb @@ -182,7 +182,7 @@ def self.save!(path, name, index, requirements, resolved) Unable to satisfy the following requirements: - `json (>= 1.7.7)` required by `berkshelf (2.0.7)` -- `json (>= 1.4.4, <= 1.7.7)` required by `chef (10.26)` +- `json (<= 1.7.7, >= 1.4.4)` required by `chef (10.26)` EOS expect(conflict.message_with_trees(:version_for_spec => lambda(&:version))).to eq <<-EOS.strip Molinillo could not find compatible versions for possibility named "json": @@ -193,7 +193,7 @@ def self.save!(path, name, index, requirements, resolved) chef_app_error (>= 0) was resolved to 1.0.0, which depends on chef (~> 10.26) was resolved to 10.26, which depends on - json (>= 1.4.4, <= 1.7.7) + json (<= 1.7.7, >= 1.4.4) EOS end end