commit:     92902571781915a800816c1a89e68c3d1b9cad94
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 29 15:17:28 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 31 00:54:35 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=92902571

ruby-ng.eclass: improve error when no valid Ruby in USE_RUBY

This means we don't get confusing *DEPEND/REQUIRED_USE errors about it being
unparseable and instead just get a straightforward die message indicating
the problem.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 eclass/ruby-ng.eclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index c273a431c5b1..b81038237a6b 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -103,16 +103,21 @@ ruby_implementation_depend() {
 # Return a list of valid implementations in USE_RUBY, skipping the old
 # implementations that are no longer supported.
 _ruby_get_all_impls() {
-       local i
+       local i found_valid_impl
        for i in ${USE_RUBY}; do
                case ${i} in
                        # removed implementations
                        
ruby19|ruby20|ruby21|ruby22|ruby23|ruby24|ruby25|ruby26|jruby)
                                ;;
                        *)
+                               found_valid_impl=1
                                echo ${i};;
                esac
        done
+
+       if [[ -z ${found_valid_impl} ]] ; then
+               die "No supported implementation in USE_RUBY."
+       fi
 }
 
 # @FUNCTION: ruby_samelib

Reply via email to