diff options
author | Diego Elio Pettenò <flameeyes@gentoo.org> | 2010-05-22 12:18:07 +0000 |
---|---|---|
committer | Diego Elio Pettenò <flameeyes@gentoo.org> | 2010-05-22 12:18:07 +0000 |
commit | 654d77129c3820223b5f200e24551a70f348c8fd (patch) | |
tree | 5af2cf80a064e35d06b213294bf16705438ec727 /eclass | |
parent | Remove genstef from metadata.xml (#66339) (diff) | |
download | gentoo-2-654d77129c3820223b5f200e24551a70f348c8fd.tar.gz gentoo-2-654d77129c3820223b5f200e24551a70f348c8fd.tar.bz2 gentoo-2-654d77129c3820223b5f200e24551a70f348c8fd.zip |
Allow for standard depend syntax in the single parameter form of ruby_add_rdepend and ruby_add_bdepend.
Make the two parameters form throw a warning for gentoo developers only (for now), and call back the
single-parameter function after wrapping. Update documentation to only suggest using the new syntax.
This allows dropping _ruby_add_rdepend and _ruby_add_bdepend convenience functions, and rather adds a
_ruby_wrap_conditions function.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ruby-ng.eclass | 108 |
1 files changed, 49 insertions, 59 deletions
diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass index 8bcf93704d5f..11516aebb7f7 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.15 2010/05/22 03:39:50 flameeyes Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.16 2010/05/22 12:18:07 flameeyes Exp $ # # @ECLASS: ruby-ng.eclass # @MAINTAINER: @@ -116,38 +116,12 @@ _ruby_implementation_depend() { echo "ruby_targets_${1}? ( ${2}[ruby_targets_${1}] )" } -_ruby_add_bdepend() { - local atom=$1 - local conditions=$2 - - for condition in $conditions; do - hasq $condition "$IUSE" || IUSE="${IUSE} $condition" - atom="${condition}? ( ${atom} )" - done - - DEPEND="${DEPEND} ${atom}" - RDEPEND="${RDEPEND}" -} - -_ruby_add_rdepend() { - local atom=$1 - local conditions=$2 - - for condition in $conditions; do - hasq $condition "$IUSE" || IUSE="${IUSE} $condition" - atom="${condition}? ( ${atom} )" - done - - RDEPEND="${RDEPEND} ${atom}" - _ruby_add_bdepend "$atom" test -} - _ruby_atoms_samelib() { local samelib=$(ruby_samelib) for token in $*; do case "$token" in - "||" | "(" | ")" ) + "||" | "(" | ")" | *"?") echo "${token}" ;; *) echo "${token}${samelib}" ;; @@ -155,61 +129,77 @@ _ruby_atoms_samelib() { done } +_ruby_wrap_conditions() { + local conditions="$1" + local atoms="$2" + + for condition in $conditions; do + hasq $condition "$IUSE" || IUSE="${IUSE} $condition" + atoms="${condition}? ( ${atoms} )" + done + + echo "$atoms" +} + # @FUNCTION: ruby_add_rdepend -# @USAGE: [conditions] atom +# @USAGE: dependencies # @DESCRIPTION: -# Adds the specified atom(s) with optional use condition(s) to -# RDEPEND, taking the current set of ruby targets into account. This -# makes sure that all ruby dependencies of the package are installed -# for the same ruby targets. Use this function for all ruby -# dependencies instead of setting RDEPEND yourself. Both atom and -# conditions can be a space-separated list of atoms or conditions. +# Adds the specified dependencies, with use condition(s) to RDEPEND, +# taking the current set of ruby targets into account. This makes sure +# that all ruby dependencies of the package are installed for the same +# ruby targets. Use this function for all ruby dependencies instead of +# setting RDEPEND yourself. The list of atoms uses the same syntax as +# normal dependencies. +# +# Note: runtime dependencies are also added as build-time test +# dependencies. ruby_add_rdepend() { - local atoms= - local conditions= case $# in - 1) - atoms=$1 - ;; + 1) ;; 2) - conditions=$1 - atoms=$2 + [[ "${GENTOO_DEV}" == "yes" ]] && eqawarn "You can now use the usual syntax in ruby_add_rdepend for $CATEGORY/$PF" + ruby_add_rdepend "$(_ruby_wrap_conditions "$1" "$2")" + return ;; *) die "bad number of arguments to $0" ;; esac - _ruby_add_rdepend "$(_ruby_atoms_samelib "${atoms}")" "$conditions" + local dependency=$(_ruby_atoms_samelib "$1") + + RDEPEND="${RDEPEND} $dependency" + + # Add the dependency as a test-dependency since we're going to + # execute the code during test phase. + DEPEND="${DEPEND} $(_ruby_wrap_conditions test "${dependency}")" } # @FUNCTION: ruby_add_bdepend -# @USAGE: [conditions] atom +# @USAGE: dependencies # @DESCRIPTION: -# Adds the specified atom(s) with optional use condition(s) to both -# DEPEND and RDEPEND, taking the current set of ruby targets into -# account. This makes sure that all ruby dependencies of the package -# are installed for the same ruby targets. Use this function for all -# ruby dependencies instead of setting DEPEND and RDEPEND -# yourself. Both atom and conditions can be a space-separated list of -# atoms or conditions. +# Adds the specified dependencies, with use condition(s) to DEPEND, +# taking the current set of ruby targets into account. This makes sure +# that all ruby dependencies of the package are installed for the same +# ruby targets. Use this function for all ruby dependencies instead of +# setting DEPEND yourself. The list of atoms uses the same syntax as +# normal dependencies. ruby_add_bdepend() { - local atoms= - local conditions= case $# in - 1) - atoms=$1 - ;; + 1) ;; 2) - conditions=$1 - atoms=$2 + [[ "${GENTOO_DEV}" == "yes" ]] && eqawarn "You can now use the usual syntax in ruby_add_bdepend for $CATEGORY/$PF" + ruby_add_bdepend "$(_ruby_wrap_conditions "$1" "$2")" + return ;; *) die "bad number of arguments to $0" ;; esac - _ruby_add_bdepend "$(_ruby_atoms_samelib "${atoms}")" "$conditions" + local dependency=$(_ruby_atoms_samelib "$1") + + DEPEND="${DEPEND} $dependency" } for _ruby_implementation in $USE_RUBY; do |