Repository navigation
Respect enclosing group and platforms for gemspec dependencies - #9990
Merged
Merged
Conversation
Since Bundler 2.6.4, `gemspec` adds its gem without normalizing options, so a surrounding `group`, `platforms` or `install_if` block is ignored. Fixes ruby#9989. Co-Authored-By: Clanker
hsbt
approved these changes
Oct 30, 2026
This was referenced Oct 30, 2026
abbbi
added a commit
to vagrant-libvirt/vagrant-libvirt
that referenced
this pull request
Nov 24, 2026
The ubuntu-22.04 images were deprecated on 2026-09-17 and are fully unsupported from 2027-04-17. Rather than pin the patch versions to a runner that will be deprecated in turn, move the unit test matrix to ruby versions that are available there, paired with a vagrant that accepts them: ruby 3.1 + vagrant v2.4.9 oldest ruby still shipped (Debian 12) ruby 3.3 + vagrant v2.4.9 latest release, accepts ruby < 3.5 ruby 3.4 + vagrant v2.4.9 ruby 3.4 + vagrant main allowed to fail ruby 4.0 + vagrant main allowed to fail This drops ruby 2.3 to 2.7 with vagrant 2.1.5 to 2.2.14. Those combinations no longer correspond to any supported distribution: the newest of them, vagrant 2.2.14 on ruby 2.6, is Debian 11, whose LTS ended in August 2026. The vagrant releases that current distributions do package cannot be tested either, as 2.3.4 fails on google-protobuf having removed the DescriptorPool#build API its generated code calls, and 2.3.7 only accepts ruby up to 3.2, which cannot build vagrant's pinned ed25519 1.3.0 against the ubuntu-26.04 compiler. Ruby 4.0 can only be tested against vagrant main for now, as no release accepts it yet. Setting up ruby also pins bundler, because bundler 2.6 up to 4.0.23 does not apply the enclosing group block to `gemspec` (ruby/rubygems#9990). The integration tests move the same way. Two of the packages they install were transitional and no longer exist on ubuntu-26.04, so qemu-kvm becomes qemu-system-x86 and libz-dev becomes zlib1g-dev.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was the end-user or developer problem that led to this PR?
Fixes #9989. Since Bundler 2.6.4, a
gemspeccall inside agroupblock puts the gem in the:defaultgroup, and inside aplatformsblock it loses the platform. Apps that load path gems withBundler.require(*groups)end up requiring every engine.What is your fix for the problem, implemented in this PR?
#8480 replaced
gem spec.name, ...with a directadd_dependency spec.name, which skipsnormalize_options, wheregemreads the enclosing groups, platforms andinstall_ifconditions. The fix runsnormalize_optionsfor the gemspec's gem before adding it.Development dependencies still get only
development_group, as they have since 2.6.4. I left them alone to keep this change small.Make sure the following tasks are checked