In https://github.com/gentoo/gentoo/blob/3a7d6bc69a8f49ac4e2c9b3953b1d867e4ef8c37/eclass/ruby-ng.eclass#L242, instead of adding 'test' to IUSE when it's not assigned, it's probably better to only add the test? dependencies when 'test' has been assigned in IUSE instead. This will not force 'test' to always exist in gems that rely on ruby-fakegem.eclas because of 'ruby_add_rdepend virtual/rubygems' unlike how it is right now. I checked ruby-fakegem.eclass and it only calls ruby_add_*depend after test has been conditionally assigned to IUSE. A sensible ebuild that doesn't rely on ruby-fakegem.eclass will also only call the function after declaring the value of IUSE. diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass index 70cb5be74b87..3126ba09be6c 100644 --- a/eclass/ruby-ng.eclass +++ b/eclass/ruby-ng.eclass @@ -233,16 +233,16 @@ ruby_add_rdepend() { RDEPEND="${RDEPEND} $dependency" - # Add the dependency as a test-dependency since we're going to - # execute the code during test phase. - case ${EAPI} in - 5|6) DEPEND="${DEPEND} test? ( ${dependency} )" ;; - *) BDEPEND="${BDEPEND} test? ( ${dependency} )" ;; - esac - if ! has test "$IUSE"; then - IUSE+=" test" - RESTRICT+=" !test? ( test )" + if has test "$IUSE"; then + # Add the dependency as a test-dependency since we're going to + # execute the code during test phase. + case ${EAPI} in + 5|6) DEPEND="${DEPEND} test? ( ${dependency} )" ;; + *) BDEPEND="${BDEPEND} test? ( ${dependency} )" ;; + esac fi + + [[ " ${RESTRICT} " != *" !test? ( test ) "* ]] && RESTRICT+=" !test? ( test )" } # @FUNCTION: ruby_add_bdepend
Last line should probably be placed inside the `if has test ...` block as well.
The idea is that you always need runtime dependencies at test time so it's doing DEPEND="test? ( ${RDEPEND} )". Python packages do the same if using d_e_t.
What problem are you trying to fix here? I'm not sure what problem the existing situation would cause or what approaches this would be blocking.
(In reply to Sam James from comment #2) > The idea is that you always need runtime dependencies at test time so it's > doing DEPEND="test? ( ${RDEPEND} )". > > Python packages do the same if using d_e_t. That's ok but the problem is about test being forced as an IUSE even in packages that don't want or can't have it; not the dependencies being forced to 'test'.
(In reply to Hans de Graaff from comment #3) > What problem are you trying to fix here? I'm not sure what problem the > existing situation would cause or what approaches this would be blocking. No situation. Just troublesome inconsistency that made me check the eclasses plenty of times already. If the ebuild doesn't provide a test, 'test' shouldn't be forced in it and appear in `emerge -v`.