Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporarily lock msgpack version for Ruby 2.0 and 2.1 #1336

Merged
merged 1 commit into from
Jan 28, 2021

Conversation

marcotc
Copy link
Member

@marcotc marcotc commented Jan 28, 2021

The newest release of msgpack (1.4) is not currently compatible with Ruby 2.0 and 2.1.

This PR locks the msgpack version to < 1.4 until we know if support will be restored and completely dropped for these old rubies.

@marcotc marcotc added the dev/testing Involves testing processes (e.g. RSpec) label Jan 28, 2021
@marcotc marcotc self-assigned this Jan 28, 2021
@marcotc marcotc requested a review from a team January 28, 2021 17:20
@marcotc marcotc merged commit c94b2cb into master Jan 28, 2021
@github-actions github-actions bot added this to the 0.46.0 milestone Jan 28, 2021
@ivoanjo
Copy link
Member

ivoanjo commented Feb 1, 2021

Just a note: while this fix works for our CI, I'm not sure it's correct if we were to publish it to rubygems.org, because the metadata uploaded is the one that matches the ruby version used to build/upload the gem.

At least on the website it wouldn't be correct; not sure if bundler/rubygems would re-run the gemspec locally after downloading the gem and spot it.

@marcotc
Copy link
Member Author

marcotc commented Feb 1, 2021

@ivoanjo, your assessment is correct. Having if conditions in the gemspec is not great: we should have these in the local Gemfile instead, that might have been a better approach here which I overlooked.

Overall, even if the gemspec is reevaluated locally, which I'm not sure it is, the index build by RubyGems is not and would download an unrestricted msgpack version for Ruby < 2.2.

We unfortunately don't have a way to tell RubyGems that for Ruby versions older than Ruby 2.2 we'd like to lock msgpack.

@ivoanjo ivoanjo deleted the tmp-lock-msgpack-old-rubies branch April 12, 2021 07:57
@ivoanjo
Copy link
Member

ivoanjo commented Apr 12, 2021

I actually thought of a way we could fix this completely, with a bit of indirection.

The trick is to introduce a new gem dependency that we control. Let's call it ddtrace-internal-compat. Then, we release two versions for it on Rubygems.org:

  • ddtrace-internal-compat 1.0.0, has required_ruby_version < 2.2, depends on msgpack < 1.4
  • ddtrace-internal-compat 1.0.1, has required_ruby_version >= 2.2, depens on msgpack (no specific version)

And then in our gem, we just depend on ddtrace-internal-compat ~> 1.0. During dependency resolution, rubygems will pick 1.0.0 for the old rubies, thus forcing the constraint on msgpack.

(This solution would seem to work generically for any dependency on which you want to add a Ruby version constraint after the fact. For instance, we could have used this to make sure older rubies also don't pick up a too-modern rexml (see ruby/rexml#69))

@ivoanjo ivoanjo mentioned this pull request Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev/testing Involves testing processes (e.g. RSpec)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants