public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Diego Petteno (flameeyes)" <flameeyes@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-x86 commit in eclass: ruby-ng.eclass
Date: Sat, 22 May 2010 12:18:07 +0000 (UTC)	[thread overview]
Message-ID: <20100522121808.005412CBD7@corvid.gentoo.org> (raw)

flameeyes    10/05/22 12:18:07

  Modified:             ruby-ng.eclass
  Log:
  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.

Revision  Changes    Path
1.16                 eclass/ruby-ng.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ruby-ng.eclass?rev=1.16&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ruby-ng.eclass?rev=1.16&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ruby-ng.eclass?r1=1.15&r2=1.16

Index: ruby-ng.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ruby-ng.eclass	22 May 2010 03:39:50 -0000	1.15
+++ ruby-ng.eclass	22 May 2010 12:18:07 -0000	1.16
@@ -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 @@
 	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 @@
 	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






             reply	other threads:[~2010-05-22 12:26 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-22 12:18 Diego Petteno (flameeyes) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-06-23 14:56 [gentoo-commits] gentoo-x86 commit in eclass: ruby-ng.eclass Hans de Graaff (graaff)
2011-10-24 18:20 Hans de Graaff (graaff)
2011-10-22 10:08 Tomas Chvatal (scarabeus)
2011-10-21  6:48 Hans de Graaff (graaff)
2011-10-05 17:46 Hans de Graaff (graaff)
2011-07-22  9:41 Hans de Graaff (graaff)
2011-07-22  9:10 Hans de Graaff (graaff)
2011-07-22  9:08 Hans de Graaff (graaff)
2011-07-19  5:48 Hans de Graaff (graaff)
2011-07-16  9:50 Hans de Graaff (graaff)
2011-04-25  8:37 Hans de Graaff (graaff)
2011-04-25  6:27 Hans de Graaff (graaff)
2010-11-07 22:52 Christian Faulhammer (fauli)
2010-09-10 13:03 Diego Petteno (flameeyes)
2010-07-30 17:28 Diego Petteno (flameeyes)
2010-07-30 16:56 Diego Petteno (flameeyes)
2010-07-30 15:05 Diego Petteno (flameeyes)
2010-07-14 13:11 Diego Petteno (flameeyes)
2010-07-08  4:00 Diego Petteno (flameeyes)
2010-05-24  7:33 Diego Petteno (flameeyes)
2010-05-22 13:15 Diego Petteno (flameeyes)
2010-05-22 12:45 Diego Petteno (flameeyes)
2010-05-22 12:31 Diego Petteno (flameeyes)
2010-05-22  3:39 Diego Petteno (flameeyes)
2010-05-21 23:18 Diego Petteno (flameeyes)
2010-05-01 16:05 Diego Petteno (flameeyes)
2010-04-30 17:40 Diego Petteno (flameeyes)
2010-04-26 15:07 Alex Legler (a3li)
2010-04-05  7:41 Alex Legler (a3li)
2010-04-02 20:26 Alex Legler (a3li)
2010-01-15 12:58 Diego Petteno (flameeyes)
2009-12-25 18:01 Diego Petteno (flameeyes)
2009-12-14 12:25 Alex Legler (a3li)
2009-12-06 13:01 Hans de Graaff (graaff)
2009-12-05 11:33 Diego Petteno (flameeyes)
2009-12-05 11:32 Diego Petteno (flameeyes)
2009-12-05 11:30 Diego Petteno (flameeyes)
2009-12-05  9:35 Hans de Graaff (graaff)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100522121808.005412CBD7@corvid.gentoo.org \
    --to=flameeyes@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox