diff options
author | Bundlerbot <bot@bundler.io> | 2020-01-13 18:10:17 +0000 |
---|---|---|
committer | Bundlerbot <bot@bundler.io> | 2020-01-13 18:10:17 +0000 |
commit | 64ac7b22c440fbb7f428a3b2936b094319dff5d4 (patch) | |
tree | a6f09c833eab6211a767f642155b01bbe2816cd4 /spec/bundler/plugin/index_spec.rb | |
parent | 6346c036a12cbae94c02bacb08c81a8fc5302238 (diff) | |
parent | 5f5561ea0556a54922fd4e144f6e3034359f89bb (diff) | |
download | bundler-64ac7b22c440fbb7f428a3b2936b094319dff5d4.tar.gz |
Merge #7554
7554: Fix ruby version parsing in compact index r=deivid-rodriguez a=kou
### What was the end-user problem that led to this PR?
The end-user can't use multiple Ruby version requirements (e.g. ">= 2.2, < 2.7.dev") provided by each gem to resolve suitable version.
See also: https://github.com/bundler/bundler/pull/7522#issuecomment-571090513
### What was your diagnosis of the problem?
https://rubygems.org/info/ffi returns the following information:
```text
1.11.3-x86-mingw32 |checksum:99e4845796c8dec1c3fc80dc772860a01633b33291bd7534007f5c7724f0b876,ruby:>= 2.2, < 2.7.dev
```
The current parser doesn't parse the line correctly. It drops "< 2.7.dev" requirement for Ruby version.
It means that the parsed requirement is "ruby >= 2.2" instead of "ruby >=2.2 && ruby < 2.7.dev".
### What is your fix for the problem, implemented in this PR?
I implemented a new parsing logic for "requirements". It assumes that "requirements" has at most three fields: "checksum", "ruby" and "rubygems". Because https://github.com/rubygems/compact_index/blob/master/lib/compact_index/gem_version.rb#L26-L28 implements so.
### Why did you choose this fix out of the possible options?
I chose this fix because it's difficult to implement generic parsing logic without "," escape in version. For example, "," leading to "2.2" and "," leading to "2.7.dev" in "ruby:>= 2.2, < 2.7.dev,rubygems:> 1.3.1" are conflict. We need to know field name such as "ruby" and "rubygems" to detect "," as field delimiter.
"," in "dependencies" are escaped as "&": https://github.com/rubygems/compact_index/blob/master/lib/compact_index/gem_version.rb#L37
Co-authored-by: Sutou Kouhei <kou@clear-code.com>
Diffstat (limited to 'spec/bundler/plugin/index_spec.rb')
0 files changed, 0 insertions, 0 deletions