diff options
author | Michał Górny <mgorny@gentoo.org> | 2017-05-13 12:18:38 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2017-05-15 15:28:00 +0200 |
commit | 29cc93987663a18fbce076d6432cb58671e4b772 (patch) | |
tree | 64d90529d21e7ea6f37bcf1372657f1eb84d173d /eclass/ruby-ng.eclass | |
parent | dev-games/cegui: Added sub-slot dependency for dev-games/ogre (diff) | |
download | gentoo-29cc93987663a18fbce076d6432cb58671e4b772.tar.gz gentoo-29cc93987663a18fbce076d6432cb58671e4b772.tar.bz2 gentoo-29cc93987663a18fbce076d6432cb58671e4b772.zip |
ruby-ng.eclass: Indirect USE_RUBY into a function
Diffstat (limited to 'eclass/ruby-ng.eclass')
-rw-r--r-- | eclass/ruby-ng.eclass | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass index 13b00553c0b0..64f1b4f402f5 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 |