Use a slightly different syntax for expliciting implementation-dependent dependencies.
authorDiego Elio Pettenò <flameeyes@gentoo.org>
Sat, 22 May 2010 12:31:03 +0000 (12:31 +0000)
committerDiego Elio Pettenò <flameeyes@gentoo.org>
Sat, 22 May 2010 12:31:03 +0000 (12:31 +0000)
Rather than using a single, huge USE-conditional per atom, put the dependendencies under conditional
_and_ USE-dependency. This allows for syntax like:

USE_RUBY="ruby18 ruby19"
...

ruby_add_bdepend "test? ( dev-ruby/first )"
USE_RUBY="ruby18" ruby_add_bdepend "test? ( dev-ruby/second )"
USE_RUBY="ruby19" ruby_add_bdepend "test? ( dev-ruby/third )"

eclass/ruby-ng.eclass

index 11516aebb7f7cf70acab6623414fe50b569629e6..7c5de961ce74956c151e926a974bc2d27d5bcef2 100644 (file)
@@ -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.16 2010/05/22 12:18:07 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.17 2010/05/22 12:31:03 flameeyes Exp $
 #
 # @ECLASS: ruby-ng.eclass
 # @MAINTAINER:
@@ -112,21 +112,27 @@ ruby_samelib() {
        echo "[${res%,}]"
 }
 
-_ruby_implementation_depend() {
-       echo "ruby_targets_${1}? ( ${2}[ruby_targets_${1}] )"
-}
-
-_ruby_atoms_samelib() {
-       local samelib=$(ruby_samelib)
-
+_ruby_atoms_samelib_generic() {
+       echo "RUBYTARGET? ("
        for token in $*; do
                case "$token" in
                        "||" | "(" | ")" | *"?")
                                echo "${token}" ;;
                        *)
-                               echo "${token}${samelib}" ;;
+                               # TODO we need to deal with merging USE-based
+                               # dependencies
+                               echo "${token}[RUBYTARGET]" ;;
                esac
        done
+       echo ")"
+}
+
+_ruby_atoms_samelib() {
+       local atoms=$(_ruby_atoms_samelib_generic "$*")
+
+       for _ruby_implementation in $USE_RUBY; do
+               echo "${atoms//RUBYTARGET/ruby_targets_${_ruby_implementation}}"
+       done
 }
 
 _ruby_wrap_conditions() {