The ruby-ng eclass supports RUBY_OPTIONAL (cfr bug #373139) but does not check it in the ruby-ng_pkg_setup phase. As a result, users still need to set RUBY_TARGETS in their make.conf even if they have USE="-ruby" (see bug #488102). Perhaps ruby-ng_pkg_setup() could check RUBY_OPTIONAL. If not set, or set to "yes" and USE="ruby" is set, only then execute its logic? Reproducible: Always
Created attachment 362080 [details, diff] Sample logic in ruby-ng_pkg_setup to honor RUBY_OPTIONAL (Untested) example approach for in ruby-ng_pkg_setup() to honor the RUBY_OPTIONAL parameter before calling the ruby-specific logic.
This change is necessary to support installing net-irc/epic5 with USE=-ruby. I checked swift’s patch’s logic and tested it, fixes bug #497080 for me.
Can you be sure that ruby is always the USE-Flag set when depending on an optional ruby implementation?
(In reply to Manuel Rüger from comment #3) > Can you be sure that ruby is always the USE-Flag set when depending on an > optional ruby implementation? So you are suggesting that some flag other than ruby could active the need to DEPEND on ruby. This is consistent with the documentation for ruby_implementations_depend() which specifies that the ebuild may trigger the dependencies with any sort of conditional syntax possible in {R,}DEPEND. Thus, no, it would be possible for other useflags to trigger optional ruby dependence. So perhaps instead the ebuild can be expected to inform ruby-ng.eclass of whether or not an optional ruby is needed at pkg_setup() time. If it really comes down to the ebuild calculating, in pkg_setup(), whether or not ruby-ng_pkg_setup() should be called or not, then it seems that the “hack” of preventing ruby-ng_pkg_setup() from running when the package has ruby disabled is actually the correct way to go about solving this issue. Then, attachment 362080 [details, diff] is unnecessary. But, please update the documentation and examples around ruby_implementations_depend() and RUBY_OPTIONAL to state that RUBY_OPTIONAL=yes ebuilds *must* conditionally call ruby-ng_pkg_setup() in pkg_setup(). Also, as a separate issue I guess, it would be quite nice to update RUBY_OPTIONAL’s documentation. It should state that EAPI>3 ebuilds should include ruby_get_use_targets() in REQUIRED_USE surrounded by the same useflag conditionals as ruby_implementations_depend() is wrapped with in DEPEND.