From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 575A1138334 for ; Thu, 25 Jul 2019 06:10:23 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EFA9CE0907; Thu, 25 Jul 2019 06:10:21 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C24BCE0903 for ; Thu, 25 Jul 2019 06:10:21 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5B4E53488FB for ; Thu, 25 Jul 2019 06:10:20 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 344C9738 for ; Thu, 25 Jul 2019 06:10:18 +0000 (UTC) From: "Hans de Graaff" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Hans de Graaff" Message-ID: <1564034982.e47f327c324516be66f4fd1f73339f0ddcc2f199.graaff@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/ruby-ng.eclass X-VCS-Directories: eclass/ X-VCS-Committer: graaff X-VCS-Committer-Name: Hans de Graaff X-VCS-Revision: e47f327c324516be66f4fd1f73339f0ddcc2f199 X-VCS-Branch: master Date: Thu, 25 Jul 2019 06:10:18 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 20809c2f-d00f-43d1-a8d3-c796d227dbd1 X-Archives-Hash: 0dfbae24d2159331acbe07cbb3e1ede4 commit: e47f327c324516be66f4fd1f73339f0ddcc2f199 Author: Hans de Graaff gentoo org> AuthorDate: Sun Jul 21 07:32:10 2019 +0000 Commit: Hans de Graaff gentoo org> CommitDate: Thu Jul 25 06:09:42 2019 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e47f327c ruby-ng.eclass: handle BDEPEND for EAPI 7 Add support for BDEPEND in EAPI 7. It is not clear how to handle test dependencies since the test framework will need to run on the CBUILD host but the code that needs to run is already cross-compiled for the CHOST. Most likely tests won't work at all in this case. Add test dependencies to BDEPEND in EAPI 7 since this matches most closely to how the test will be executed. Adjust `ruby_add_bdepend` to add to BDEPEND on EAPI 7. This also allows us to keep the name for this method. Add a new `ruby_add_depend` to add to DEPEND in EAPI 7 and newer only. This allows for the rare case where gems need to link to other gem code (e.g. dev-ruby/nokogumbo). Add ruby itself to RDEPEND, BDEPEND, and DEPEND since it is expected to be present in all three cases. Signed-off-by: Hans de Graaff gentoo.org> eclass/ruby-ng.eclass | 62 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass index 8663033a499..9fb6965a079 100644 --- a/eclass/ruby-ng.eclass +++ b/eclass/ruby-ng.eclass @@ -43,7 +43,7 @@ # @DESCRIPTION: # 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. +# BDEPEND, DEPEND and RDEPEND. # @ECLASS-VARIABLE: RUBY_S # @DEFAULT_UNSET @@ -223,19 +223,22 @@ ruby_add_rdepend() { # Add the dependency as a test-dependency since we're going to # execute the code during test phase. - DEPEND="${DEPEND} test? ( ${dependency} )" + case ${EAPI} in + 4|5|6) DEPEND="${DEPEND} test? ( ${dependency} )" ;; + *) BDEPEND="${BDEPEND} test? ( ${dependency} )" ;; + esac has test "$IUSE" || IUSE="${IUSE} test" } # @FUNCTION: ruby_add_bdepend # @USAGE: dependencies # @DESCRIPTION: -# 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. +# Adds the specified dependencies, with use condition(s) to DEPEND (or +# BDEPEND in EAPI7), 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 or BDEPEND yourself. The list +# of atoms uses the same syntax as normal dependencies. ruby_add_bdepend() { case $# in 1) ;; @@ -251,10 +254,35 @@ ruby_add_bdepend() { local dependency=$(_ruby_atoms_samelib "$1") - DEPEND="${DEPEND} $dependency" + case ${EAPI} in + 4|5|6) DEPEND="${DEPEND} $dependency" ;; + *) BDEPEND="${BDEPEND} $dependency" ;; + esac RDEPEND="${RDEPEND}" } +# @FUNCTION: ruby_add_depend +# @USAGE: dependencies +# @DESCRIPTION: + +# Adds the specified dependencies to DEPEND in EAPI7, similar to +# ruby_add_bdepend. +ruby_add_depend() { + case ${EAPI} in + 4|5|6) die "only available in EAPI 7 and newer" ;; + *) ;; + esac + + case $# in + 1) ;; + *) die "bad number of arguments to $0" ;; + esac + + local dependency=$(_ruby_atoms_samelib "$1") + + DEPEND="${DEPEND} $dependency" +} + # @FUNCTION: ruby_get_use_implementations # @DESCRIPTION: # Gets an array of ruby use targets enabled by the user @@ -308,6 +336,10 @@ if [[ ${RUBY_OPTIONAL} != yes ]]; then DEPEND="${DEPEND} $(ruby_implementations_depend)" RDEPEND="${RDEPEND} $(ruby_implementations_depend)" REQUIRED_USE+=" || ( $(ruby_get_use_targets) )" + case ${EAPI} in + 4|5|6) ;; + *) BDEPEND="${BDEPEND} $(ruby_implementations_depend)" ;; + esac fi _ruby_invoke_environment() { @@ -634,8 +666,8 @@ ruby-ng_rspec() { files="spec" fi - if [[ ${DEPEND} != *"dev-ruby/rspec"* ]]; then - ewarn "Missing dev-ruby/rspec in \${DEPEND}" + if [[ "${DEPEND}${BDEPEND}" != *"dev-ruby/rspec"* ]]; then + ewarn "Missing test dependency dev-ruby/rspec" fi local rspec_params= @@ -665,8 +697,8 @@ ruby-ng_rspec() { # This is simply a wrapper around the cucumber command (executed by $RUBY}) # which also respects TEST_VERBOSE and NOCOLOR environment variables. ruby-ng_cucumber() { - if [[ ${DEPEND} != *"dev-util/cucumber"* ]]; then - ewarn "Missing dev-util/cucumber in \${DEPEND}" + if [[ "${DEPEND}${BDEPEND}" != *"dev-util/cucumber"* ]]; then + ewarn "Missing test dependency dev-util/cucumber" fi local cucumber_params= @@ -699,8 +731,8 @@ ruby-ng_cucumber() { # their script and we installed a broken wrapper for a while. # This also respects TEST_VERBOSE and NOCOLOR environment variables. ruby-ng_testrb-2() { - if [[ ${DEPEND} != *"dev-ruby/test-unit"* ]]; then - ewarn "Missing dev-ruby/test-unit in \${DEPEND}" + if [[ "${DEPEND}${BDEPEND}" != *"dev-ruby/test-unit"* ]]; then + ewarn "Missing test dependency dev-ruby/test-unit" fi local testrb_params=