summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Graaff <graaff@gentoo.org>2011-07-22 09:41:17 +0000
committerHans de Graaff <graaff@gentoo.org>2011-07-22 09:41:17 +0000
commita5b4649d5e9af9b597df955edbf7b239f474fd6e (patch)
tree99d476423e24e9fa07d5d9a40e2edbd3ae2a5673
parentFixed a bug causing bogus ini files to be installed (diff)
downloadgentoo-2-a5b4649d5e9af9b597df955edbf7b239f474fd6e.tar.gz
gentoo-2-a5b4649d5e9af9b597df955edbf7b239f474fd6e.tar.bz2
gentoo-2-a5b4649d5e9af9b597df955edbf7b239f474fd6e.zip
Provide ruby_implementations_depend() to facilitate ebuilds with RUBY_OPTIONAL=yes. Also use it internally to avoid duplication of code. Patch by Nathan Phillip Brink in bug 373139.
-rw-r--r--eclass/ruby-ng.eclass45
1 files changed, 35 insertions, 10 deletions
diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index 6a0d1419f810..b64a0e870882 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.37 2011/07/22 09:10:22 graaff Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.38 2011/07/22 09:41:17 graaff Exp $
#
# @ECLASS: ruby-ng.eclass
# @MAINTAINER:
@@ -46,7 +46,9 @@
# @ECLASS-VARIABLE: RUBY_OPTIONAL
# @DESCRIPTION:
-# Set the value to "yes" to make the dependency on a Ruby interpreter optional.
+# Set the value to "yes" to make the dependency on a Ruby interpreter
+# optional and then ruby_implementations_depend() to help populate
+# DEPEND and RDEPEND.
# @ECLASS-VARIABLE: RUBY_S
# @DEFAULT_UNSET
@@ -283,16 +285,39 @@ if [[ ${EAPI:-0} -ge 4 && ${RUBY_OPTIONAL} != "yes" ]]; then
REQUIRED_USE=" || ( $(ruby_get_use_targets) )"
fi
-for _ruby_implementation in $USE_RUBY; do
- IUSE="${IUSE} ruby_targets_${_ruby_implementation}"
+# @FUNCTION: ruby_implementations_depend
+# @RETURN: Dependencies suitable for injection into DEPEND and RDEPEND.
+# @DESCRIPTION:
+# Produces the dependency string for the various implementations of ruby
+# which the package is being built against. This should not be used when
+# RUBY_OPTIONAL is unset but must be used if RUBY_OPTIONAL=yes. Do not
+# confuse this function with ruby_implementation_depend().
+#
+# @EXAMPLE:
+# EAPI=4
+# RUBY_OPTIONAL=yes
+#
+# inherit ruby-ng
+# ...
+# DEPEND="ruby? ( $(ruby_implementations_depend) )"
+# RDEPEND="${DEPEND}"
+ruby_implementations_depend() {
+ local depend
+ for _ruby_implementation in ${USE_RUBY}; do
+ depend="${depend}${depend+ }ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )"
+ done
+ echo "${depend}"
+}
- # If you specify RUBY_OPTIONAL you also need to take care of
- # ruby useflag and dependency.
- if [[ ${RUBY_OPTIONAL} != "yes" ]]; then
- DEPEND="${DEPEND} ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )"
- RDEPEND="${RDEPEND} ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )"
- fi
+for _ruby_implementation in ${USE_RUBY}; do
+ IUSE="${IUSE} ruby_targets_${_ruby_implementation}"
done
+# If you specify RUBY_OPTIONAL you also need to take care of
+# ruby useflag and dependency.
+if [[ ${RUBY_OPTIONAL} != yes ]]; then
+ DEPEND="${DEPEND} $(ruby_implementations_depend)"
+ RDEPEND="${RDEPEND} $(ruby_implementations_depend)"
+fi
_ruby_invoke_environment() {
old_S=${S}