Noticed when looking at bug 771744 which seems hard to trigger deliberately - the webkit-gtk ebuild already tries to check the chosen Ruby has rubygems available.
Anyway, when looking at that, I noticed it's possible for Portage to queue the following, even if it's not what's happening in this case: - dev-lang/ruby:2.7 is already installed - virtual/rubygems[ruby_targets_ruby27] is already installed (PDEPEND of ruby) and then, in a fresh emerge: - dev-lang/ruby:3.0 is installed - app-misc/foo (with only USE_RUBY="ruby30") using ruby-single.eclass is queued and fails because the installed Ruby isn't fully usable yet, because the eclass only guarantees dev-lang/ruby:3.0 and virtual/rubygems is installed, not necessarily rubygems for that interpreter. - virtual/rubygems[ruby_targets_ruby30] is built (PDEPEND of ruby) This isn't a subsittute for a ruby-any.eclass and/or a pkg_setup which helps enforcement, but that's another thing to handle. Followup to d078ec2a151d16b7ed045f1889bb5b97c4b9e6af ("Add virtual/rubygems to dependencies[...]"). Bug: https://bugs.gentoo.org/771744 Signed-off-by: Sam James <s...@gentoo.org> --- eclass/ruby-single.eclass | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/eclass/ruby-single.eclass b/eclass/ruby-single.eclass index 035675c4810a0..5f6cf9e46dcee 100644 --- a/eclass/ruby-single.eclass +++ b/eclass/ruby-single.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: ruby-single.eclass @@ -72,10 +72,13 @@ _ruby_single_implementations_depend() { local depend for _ruby_implementation in ${RUBY_TARGETS_PREFERENCE}; do if [[ ${USE_RUBY} =~ ${_ruby_implementation} ]]; then - depend="${depend} $(_ruby_implementation_depend $_ruby_implementation)" + depend+=" (" + depend+=" $(_ruby_implementation_depend $_ruby_implementation)" + depend+=" virtual/rubygems[ruby_targets_${_ruby_implementation}(-)]" + depend+=" )" fi done - echo "|| ( ${depend} ) virtual/rubygems" + echo "|| ( ${depend} )" } _ruby_single_set_globals() { -- 2.40.0