Change processing of atoms in ruby_add_rdepend and ruby_add_bdepend to
authorDiego Elio Pettenò <flameeyes@gentoo.org>
Fri, 21 May 2010 23:18:46 +0000 (23:18 +0000)
committerDiego Elio Pettenò <flameeyes@gentoo.org>
Fri, 21 May 2010 23:18:46 +0000 (23:18 +0000)
make it possible to process complex dependency strings, such as

|| ( virtual/ruby-test-unit dev-ruby/test-unit:2 )

which is going to be common for test-unit-2 compatible packages; to
have a proper dependency tree.

This, theorically, can also drop the need for the 2-ary calls for
ruby_add_bdepend and ruby_add_rdepend.

eclass/ruby-ng.eclass

index 4e5a3ec4710dcd6fe82a78f40292c92577a283c3..8d86e7c03b2200963d23b81e86fb30fa5ba31ec5 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.13 2010/05/01 16:05:45 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.14 2010/05/21 23:18:46 flameeyes Exp $
 #
 # @ECLASS: ruby-ng.eclass
 # @MAINTAINER:
@@ -142,6 +142,19 @@ _ruby_add_rdepend() {
        _ruby_add_bdepend "$atom" test
 }
 
+_ruby_atoms_samelib() {
+       local samelib=$(ruby_samelib)
+
+       for token in $*; do
+               case "$token" in
+                       "||" | "(" | ")" )
+                               echo "${token}" ;;
+                       *)
+                               echo "${token}${samelib}" ;;
+               esac
+       done
+}
+
 # @FUNCTION: ruby_add_rdepend
 # @USAGE: [conditions] atom
 # @DESCRIPTION:
@@ -167,9 +180,7 @@ ruby_add_rdepend() {
                        ;;
        esac
 
-       for atom in $atoms; do
-               _ruby_add_rdepend "${atom}$(ruby_samelib)" "$conditions"
-       done
+       _ruby_add_rdepend "$(_ruby_atoms_samelib "${atoms}")" "$conditions"
 }
 
 # @FUNCTION: ruby_add_bdepend
@@ -198,9 +209,7 @@ ruby_add_bdepend() {
                        ;;
        esac
 
-       for atom in $atoms; do
-               _ruby_add_bdepend "${atom}$(ruby_samelib)" "$conditions"
-       done
+       _ruby_add_bdepend "$(_ruby_atoms_samelib "${atoms}")" "$conditions"
 }
 
 for _ruby_implementation in $USE_RUBY; do