commit: 29cc93987663a18fbce076d6432cb58671e4b772 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Sat May 13 10:18:38 2017 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Mon May 15 13:28:00 2017 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=29cc9398
ruby-ng.eclass: Indirect USE_RUBY into a function eclass/ruby-fakegem.eclass | 2 +- eclass/ruby-ng.eclass | 29 ++++++++++++++++++++++------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/eclass/ruby-fakegem.eclass b/eclass/ruby-fakegem.eclass index 230f55d7cfe..3c10e577a41 100644 --- a/eclass/ruby-fakegem.eclass +++ b/eclass/ruby-fakegem.eclass @@ -336,7 +336,7 @@ ruby_fakegem_binwrapper() { # calling the script by default (see for instance the # JRuby-specific commands). local rubycmd= - for implementation in ${USE_RUBY}; do + for implementation in $(_ruby_get_all_impls); do # ignore non-enabled implementations use ruby_targets_${implementation} || continue if [ -z $rubycmd ]; then diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass index 13b00553c0b..64f1b4f402f 100644 --- a/eclass/ruby-ng.eclass +++ b/eclass/ruby-ng.eclass @@ -109,6 +109,21 @@ ruby_implementation_depend() { _ruby_implementation_depend $1 } +# @FUNCTION: _ruby_get_all_impls +# @INTERNAL +# @RETURN: list of valid values in USE_RUBY +# Return a list of valid implementations in USE_RUBY, skipping the old +# implementations that are no longer supported. +_ruby_get_all_impls() { + local i + for i in ${USE_RUBY}; do + case ${i} in + *) + echo ${i};; + esac + done +} + # @FUNCTION: ruby_samelib # @RETURN: use flag string with current ruby implementations # @DESCRIPTION: @@ -118,7 +133,7 @@ ruby_implementation_depend() { # more complex dependencies. ruby_samelib() { local res= - for _ruby_implementation in $USE_RUBY; do + for _ruby_implementation in $(_ruby_get_all_impls); do has -${_ruby_implementation} $@ || \ res="${res}ruby_targets_${_ruby_implementation}?," done @@ -159,7 +174,7 @@ ruby_implementation_command() { _ruby_atoms_samelib() { local atoms=$(_ruby_atoms_samelib_generic "$*") - for _ruby_implementation in $USE_RUBY; do + for _ruby_implementation in $(_ruby_get_all_impls); do echo "${atoms//RUBYTARGET/ruby_targets_${_ruby_implementation}}" done } @@ -243,7 +258,7 @@ ruby_add_bdepend() { # Gets an array of ruby use targets enabled by the user ruby_get_use_implementations() { local i implementation - for implementation in ${USE_RUBY}; do + for implementation in $(_ruby_get_all_impls); do use ruby_targets_${implementation} && i+=" ${implementation}" done echo $i @@ -254,7 +269,7 @@ ruby_get_use_implementations() { # Gets an array of ruby use targets that the ebuild sets ruby_get_use_targets() { local t implementation - for implementation in ${USE_RUBY}; do + for implementation in $(_ruby_get_all_impls); do t+=" ruby_targets_${implementation}" done echo $t @@ -278,7 +293,7 @@ ruby_get_use_targets() { # RDEPEND="${DEPEND}" ruby_implementations_depend() { local depend - for _ruby_implementation in ${USE_RUBY}; do + for _ruby_implementation in $(_ruby_get_all_impls); do depend="${depend}${depend+ }ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )" done echo "${depend}" @@ -358,7 +373,7 @@ _ruby_invoke_environment() { _ruby_each_implementation() { local invoked=no - for _ruby_implementation in ${USE_RUBY}; do + for _ruby_implementation in $(_ruby_get_all_impls); do # only proceed if it's requested use ruby_targets_${_ruby_implementation} || continue @@ -374,7 +389,7 @@ _ruby_each_implementation() { if [[ ${invoked} == "no" ]]; then eerror "You need to select at least one compatible Ruby installation target via RUBY_TARGETS in make.conf." - eerror "Compatible targets for this package are: ${USE_RUBY}" + eerror "Compatible targets for this package are: $(_ruby_get_all_impls)" eerror eerror "See https://www.gentoo.org/proj/en/prog_lang/ruby/index.xml#doc_chap3 for more information." eerror