summaryrefslogtreecommitdiff
path: root/eclass/ruby-ng.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-08-02 19:14:55 +0100
committerV3n3RiX <venerix@redcorelinux.org>2019-08-02 19:14:55 +0100
commitb24bd25253fe093f722ab576d29fdc41d04cb1ee (patch)
tree0fcf2afd9f852c4d4c291cf8afaa2c244d598105 /eclass/ruby-ng.eclass
parent121ed4eec41fbf03e1998d09eede1bf449da63b9 (diff)
gentoo resync : 02.08.2019
Diffstat (limited to 'eclass/ruby-ng.eclass')
-rw-r--r--eclass/ruby-ng.eclass167
1 files changed, 96 insertions, 71 deletions
diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index 90c36cd86e40..dd9d3f2418ca 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -8,7 +8,7 @@
# Author: Diego E. Pettenò <flameeyes@gentoo.org>
# Author: Alex Legler <a3li@gentoo.org>
# Author: Hans de Graaff <graaff@gentoo.org>
-# @SUPPORTED_EAPIS: 2 3 4 5 6
+# @SUPPORTED_EAPIS: 4 5 6 7
# @BLURB: An eclass for installing Ruby packages with proper support for multiple Ruby slots.
# @DESCRIPTION:
# The Ruby eclass is designed to allow an easier installation of Ruby packages
@@ -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
@@ -68,20 +68,25 @@
local inherits=""
case ${EAPI} in
- 2|3|4|5)
- inherits="eutils"
+ 4|5)
+ inherits="eutils toolchain-funcs"
+ ;;
+ 6)
+ inherits="estack toolchain-funcs"
+ ;;
+ *)
+ inherits="estack"
;;
esac
-inherit ${inherits} java-utils-2 multilib toolchain-funcs ruby-utils
+inherit ${inherits} multilib ruby-utils
EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup
case ${EAPI} in
- 0|1)
+ 0|1|2|3)
die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;;
- 2|3) ;;
- 4|5|6)
+ 4|5|6|7)
# S is no longer automatically assigned when it doesn't exist.
S="${WORKDIR}"
;;
@@ -203,9 +208,16 @@ ruby_add_rdepend() {
case $# in
1) ;;
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
+ case ${EAPI} in
+ 4|5|6)
+ [[ "${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 "Use the usual depend syntax with a single argument in ruby_add_rdepend"
+ ;;
+ esac
;;
*)
die "bad number of arguments to $0"
@@ -218,26 +230,36 @@ 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) ;;
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
+ case ${EAPI} in
+ 4|5|6)
+ [[ "${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 "Use the usual depend syntax with a single argument in ruby_add_bdepend"
+ ;;
+ esac
;;
*)
die "bad number of arguments to $0"
@@ -246,10 +268,34 @@ 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
@@ -281,7 +327,7 @@ ruby_get_use_targets() {
# confuse this function with ruby_implementation_depend().
#
# @EXAMPLE:
-# EAPI=6
+# EAPI=7
# RUBY_OPTIONAL=yes
#
# inherit ruby-ng
@@ -302,40 +348,25 @@ IUSE+=" $(ruby_get_use_targets)"
if [[ ${RUBY_OPTIONAL} != yes ]]; then
DEPEND="${DEPEND} $(ruby_implementations_depend)"
RDEPEND="${RDEPEND} $(ruby_implementations_depend)"
-
- case ${EAPI:-0} in
- 4|5|6)
- REQUIRED_USE+=" || ( $(ruby_get_use_targets) )"
- ;;
+ REQUIRED_USE+=" || ( $(ruby_get_use_targets) )"
+ case ${EAPI} in
+ 4|5|6) ;;
+ *) BDEPEND="${BDEPEND} $(ruby_implementations_depend)" ;;
esac
fi
_ruby_invoke_environment() {
old_S=${S}
- case ${EAPI} in
- 4|5|6)
- if [ -z "${RUBY_S}" ]; then
- sub_S=${P}
- else
- sub_S=${RUBY_S}
- fi
- ;;
- *)
- sub_S=${S#${WORKDIR}/}
- ;;
- esac
+ if [ -z "${RUBY_S}" ]; then
+ sub_S=${P}
+ else
+ sub_S=${RUBY_S}
+ fi
# Special case, for the always-lovely GitHub fetches. With this,
# we allow the star glob to just expand to whatever directory it's
# called.
if [[ "${sub_S}" = *"*"* ]]; then
- case ${EAPI} in
- 2|3)
- #The old method of setting S depends on undefined package
- # manager behaviour, so encourage upgrading to EAPI=4.
- eqawarn "Using * expansion of S is deprecated. Use EAPI and RUBY_S instead."
- ;;
- esac
pushd "${WORKDIR}"/all &>/dev/null || die
# use an array to trigger filename expansion
# fun fact: this expansion fails in src_unpack() but the original
@@ -402,8 +433,6 @@ ruby-ng_pkg_setup() {
# before doing anything; by leaving the parameters empty we know
# it's a special case.
_ruby_each_implementation
-
- has ruby_targets_jruby ${IUSE} && use ruby_targets_jruby && java-pkg_setup-vm
}
# @FUNCTION: ruby-ng_src_unpack
@@ -425,7 +454,7 @@ ruby-ng_src_unpack() {
_ruby_apply_patches() {
case ${EAPI} in
- 2|3|4|5)
+ 4|5)
for patch in "${RUBY_PATCHES[@]}"; do
if [ -f "${patch}" ]; then
epatch "${patch}"
@@ -441,6 +470,11 @@ _ruby_apply_patches() {
eqawarn "RUBY_PATCHES is no longer supported, use PATCHES instead"
fi
;;
+ *)
+ if [[ -n ${RUBY_PATCHES[@]} ]]; then
+ die "RUBY_PATCHES is no longer supported, use PATCHES instead"
+ fi
+ ;;
esac
# This is a special case: instead of executing just in the special
@@ -468,7 +502,9 @@ ruby-ng_src_prepare() {
# Handle PATCHES and user supplied patches via the default phase
case ${EAPI} in
- 6)
+ 4|5)
+ ;;
+ *)
_ruby_invoke_environment all default
;;
esac
@@ -524,12 +560,10 @@ _each_ruby_check_install() {
# we have a Mach-O object here
[[ ${CHOST} == *-darwin ]] && scancmd=scanmacho
- has "${EAPI}" 2 && ! use prefix && EPREFIX=
-
- local libruby_basename=$(${RUBY} -rrbconfig -e 'puts RbConfig::CONFIG["LIBRUBY_SO"]')
+ local libruby_basename=$(ruby_rbconfig_value 'LIBRUBY_SO')
local libruby_soname=$(basename $(${scancmd} -F "%S#F" -qS "${EPREFIX}/usr/$(get_libdir)/${libruby_basename}") 2>/dev/null)
- local sitedir=$(${RUBY} -rrbconfig -e 'puts RbConfig::CONFIG["sitedir"]')
- local sitelibdir=$(${RUBY} -rrbconfig -e 'puts RbConfig::CONFIG["sitelibdir"]')
+ local sitedir=$(ruby_rbconfig_value 'sitedir')
+ local sitelibdir=$(ruby_rbconfig_value 'sitelibdir')
# The current implementation lacks libruby (i.e.: jruby)
[[ -z ${libruby_soname} ]] && return 0
@@ -578,7 +612,6 @@ ruby_rbconfig_value() {
# Installs the specified file(s) into the sitelibdir of the Ruby interpreter in ${RUBY}.
doruby() {
[[ -z ${RUBY} ]] && die "\$RUBY is not set"
- has "${EAPI}" 2 && ! use prefix && EPREFIX=
( # don't want to pollute calling env
sitelibdir=$(ruby_rbconfig_value 'sitelibdir')
insinto ${sitelibdir#${EPREFIX}}
@@ -619,9 +652,6 @@ ruby_get_implementation() {
local ruby=${RUBY:-$(type -p ruby 2>/dev/null)}
case $(${ruby} --version) in
- *jruby*)
- echo "jruby"
- ;;
*rubinius*)
echo "rbx"
;;
@@ -649,8 +679,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=
@@ -680,8 +710,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=
@@ -703,11 +733,6 @@ ruby-ng_cucumber() {
;;
esac
- if [[ ${RUBY} == *jruby ]]; then
- ewarn "Skipping cucumber tests on JRuby (unsupported)."
- return 0
- fi
-
${RUBY} -S cucumber ${cucumber_params} "$@" || die "cucumber failed"
}
@@ -719,8 +744,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=