diff options
Diffstat (limited to 'eclass/ruby-ng.eclass')
-rw-r--r-- | eclass/ruby-ng.eclass | 135 |
1 files changed, 46 insertions, 89 deletions
diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass index d80ae96dd40b..f3745b5d3eab 100644 --- a/eclass/ruby-ng.eclass +++ b/eclass/ruby-ng.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2023 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @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: 6 7 8 +# @SUPPORTED_EAPIS: 7 8 # @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 @@ -66,15 +66,14 @@ # (e.g. selenium's firefox driver extension). When set this argument is # passed to "grep -E" to remove reporting of these shared objects. +if [[ -z ${_RUBY_NG_ECLASS} ]]; then +_RUBY_NG_ECLASS=1 + case ${EAPI} in - 6|7|8) ;; + 7|8) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac -if [[ -z ${_RUBY_NG_ECLASS} ]]; then -_RUBY_NG_ECLASS=1 - -[[ ${EAPI} == 6 ]] && inherit eqawarn toolchain-funcs inherit multilib ruby-utils # S is no longer automatically assigned when it doesn't exist. @@ -91,7 +90,7 @@ S="${WORKDIR}" # Set `comparator' and `version' to include a comparator (=, >=, etc.) and a # version string to the returned string ruby_implementation_depend() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" _ruby_implementation_depend $1 } @@ -133,7 +132,7 @@ _ruby_get_all_impls() { # ruby_add_bdepend(), but may also be useful in an ebuild to specify # more complex dependencies. ruby_samelib() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" _ruby_set_globals_invalidate_if_stale @@ -152,7 +151,7 @@ ruby_samelib() { # Not all implementations have the same command basename as the # target; This function translate between the two ruby_implementation_command() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" local _ruby_name=$1 @@ -213,21 +212,12 @@ _ruby_wrap_conditions() { # Note: runtime dependencies are also added as build-time test # dependencies. ruby_add_rdepend() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" case $# in 1) ;; 2) - case ${EAPI} in - 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 "Use the usual depend syntax with a single argument in ruby_add_rdepend" ;; *) die "bad number of arguments to $0" @@ -241,10 +231,7 @@ ruby_add_rdepend() { # Add the dependency as a test-dependency since we're going to # execute the code during test phase. - case ${EAPI} in - 6) DEPEND+=" test? ( ${_RUBY_ATOMS_SAMELIB_RESULT} )" ;; - *) BDEPEND+=" test? ( ${_RUBY_ATOMS_SAMELIB_RESULT} )" ;; - esac + BDEPEND+=" test? ( ${_RUBY_ATOMS_SAMELIB_RESULT} )" if ! has test "$IUSE"; then IUSE+=" test" RESTRICT+=" !test? ( test )" @@ -254,28 +241,19 @@ ruby_add_rdepend() { # @FUNCTION: ruby_add_bdepend # @USAGE: dependencies # @DESCRIPTION: -# Adds the specified dependencies, with use condition(s) to DEPEND (or -# BDEPEND in EAPI7), taking the current set of ruby targets into +# Adds the specified dependencies, with use condition(s) to BDEPEND, +# 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() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" case $# in 1) ;; 2) - case ${EAPI} in - 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 "Use the usual depend syntax with a single argument in ruby_add_bdepend" ;; *) die "bad number of arguments to $0" @@ -285,24 +263,15 @@ ruby_add_bdepend() { _ruby_set_globals_invalidate_if_stale _ruby_atoms_samelib "$1" - case ${EAPI} in - 6) DEPEND+=" ${_RUBY_ATOMS_SAMELIB_RESULT}" ;; - *) BDEPEND+=" ${_RUBY_ATOMS_SAMELIB_RESULT}" ;; - esac + BDEPEND+=" ${_RUBY_ATOMS_SAMELIB_RESULT}" } # @FUNCTION: ruby_add_depend # @USAGE: dependencies # @DESCRIPTION: -# Adds the specified dependencies to DEPEND in EAPI7, similar to -# ruby_add_bdepend. +# Adds the specified dependencies to DEPEND, similar to ruby_add_bdepend. ruby_add_depend() { - debug-print-function ${FUNCNAME} "${@}" - - case ${EAPI} in - 6) die "only available in EAPI 7 and newer" ;; - *) ;; - esac + debug-print-function ${FUNCNAME} "$@" case $# in 1) ;; @@ -319,7 +288,7 @@ ruby_add_depend() { # @DESCRIPTION: # Gets an array of ruby use targets enabled by the user ruby_get_use_implementations() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" _ruby_set_globals_invalidate_if_stale @@ -334,7 +303,7 @@ ruby_get_use_implementations() { # @DESCRIPTION: # Gets an array of ruby use targets that the ebuild sets ruby_get_use_targets() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" _ruby_set_globals_invalidate_if_stale _ruby_get_use_targets @@ -347,7 +316,7 @@ ruby_get_use_targets() { # Gets an array of ruby use targets that the ebuild sets _RUBY_GET_USE_TARGETS="" _ruby_get_use_targets() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" _ruby_set_globals_invalidate_if_stale @@ -365,7 +334,7 @@ _ruby_get_use_targets() { # confuse this function with ruby_implementation_depend(). # # @EXAMPLE: -# EAPI=7 +# EAPI=8 # RUBY_OPTIONAL=yes # # inherit ruby-ng @@ -374,7 +343,7 @@ _ruby_get_use_targets() { # RDEPEND="${DEPEND}" _RUBY_IMPLEMENTATIONS_DEPEND="" ruby_implementations_depend() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" _ruby_set_globals_invalidate_if_stale _ruby_implementations_depend @@ -417,10 +386,7 @@ if [[ ${RUBY_OPTIONAL} != yes ]]; then DEPEND+=" ${_RUBY_IMPLEMENTATIONS_DEPEND}" RDEPEND+=" ${_RUBY_IMPLEMENTATIONS_DEPEND}" REQUIRED_USE+=" || ( ${_RUBY_GET_USE_TARGETS} )" - case ${EAPI} in - 6) ;; - *) BDEPEND+=" ${_RUBY_IMPLEMENTATIONS_DEPEND}" ;; - esac + BDEPEND+=" ${_RUBY_IMPLEMENTATIONS_DEPEND}" fi _ruby_invoke_environment() { @@ -506,7 +472,7 @@ _ruby_each_implementation() { # @DESCRIPTION: # Check whether at least one ruby target implementation is present. ruby-ng_pkg_setup() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" # This only checks that at least one implementation is present # before doing anything; by leaving the parameters empty we know @@ -518,7 +484,7 @@ ruby-ng_pkg_setup() { # @DESCRIPTION: # Unpack the source archive. ruby-ng_src_unpack() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" mkdir "${WORKDIR}"/all pushd "${WORKDIR}"/all &>/dev/null || die @@ -534,18 +500,9 @@ ruby-ng_src_unpack() { } _ruby_apply_patches() { - case ${EAPI} in - 6) - if [[ -n ${RUBY_PATCHES[@]} ]]; then - 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 + if [[ -n ${RUBY_PATCHES[@]} ]]; then + die "RUBY_PATCHES is no longer supported, use PATCHES instead" + fi # This is a special case: instead of executing just in the special # "all" environment, this will actually copy the effects on _all_ @@ -565,7 +522,7 @@ _ruby_source_copy() { # Apply patches and prepare versions for each ruby target # implementation. Also carry out common clean up tasks. ruby-ng_src_prepare() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" # Way too many Ruby packages are prepared on OSX without removing # the extra data forks, we do it here to avoid repeating it for @@ -589,7 +546,7 @@ ruby-ng_src_prepare() { # @DESCRIPTION: # Configure the package. ruby-ng_src_configure() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" if type each_ruby_configure &>/dev/null; then _ruby_each_implementation each_ruby_configure @@ -603,7 +560,7 @@ ruby-ng_src_configure() { # @DESCRIPTION: # Compile the package. ruby-ng_src_compile() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" if type each_ruby_compile &>/dev/null; then _ruby_each_implementation each_ruby_compile @@ -617,7 +574,7 @@ ruby-ng_src_compile() { # @DESCRIPTION: # Run tests for the package. ruby-ng_src_test() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" if type each_ruby_test &>/dev/null; then _ruby_each_implementation each_ruby_test @@ -660,7 +617,7 @@ _each_ruby_check_install() { # @DESCRIPTION: # Install the package for each ruby target implementation. ruby-ng_src_install() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" if type each_ruby_install &>/dev/null; then _ruby_each_implementation each_ruby_install @@ -677,7 +634,7 @@ ruby-ng_src_install() { # @USAGE: rbconfig item # @RETURN: Returns the value of the given rbconfig item of the Ruby interpreter in ${RUBY}. ruby_rbconfig_value() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" echo $(${RUBY} --disable=did_you_mean -rrbconfig -e "puts RbConfig::CONFIG['$1']" || die "Could not read ruby configuration for '${1}'") } @@ -687,7 +644,7 @@ ruby_rbconfig_value() { # @DESCRIPTION: # Installs the specified file(s) into the sitelibdir of the Ruby interpreter in ${RUBY}. doruby() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" [[ -z ${RUBY} ]] && die "\$RUBY is not set" ( # don't want to pollute calling env @@ -695,13 +652,13 @@ doruby() { insinto "${sitelibdir#${EPREFIX}}" insopts -m 0644 doins "$@" - ) || die "failed to install $@" + ) } # @FUNCTION: ruby_get_libruby # @RETURN: The location of libruby*.so belonging to the Ruby interpreter in ${RUBY}. ruby_get_libruby() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" ${RUBY} -rrbconfig -e 'puts File.join(RbConfig::CONFIG["libdir"], RbConfig::CONFIG["LIBRUBY"])' } @@ -709,7 +666,7 @@ ruby_get_libruby() { # @FUNCTION: ruby_get_hdrdir # @RETURN: The location of the header files belonging to the Ruby interpreter in ${RUBY}. ruby_get_hdrdir() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" local rubyhdrdir=$(ruby_rbconfig_value 'rubyhdrdir') @@ -723,7 +680,7 @@ ruby_get_hdrdir() { # @FUNCTION: ruby_get_version # @RETURN: The version of the Ruby interpreter in ${RUBY}, or what 'ruby' points to. ruby_get_version() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" local ruby=${RUBY:-$(type -p ruby 2>/dev/null)} @@ -733,7 +690,7 @@ ruby_get_version() { # @FUNCTION: ruby_get_implementation # @RETURN: The implementation of the Ruby interpreter in ${RUBY}, or what 'ruby' points to. ruby_get_implementation() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" local ruby=${RUBY:-$(type -p ruby 2>/dev/null)} @@ -756,7 +713,7 @@ ruby_get_implementation() { # rspec version that must be executed. It defaults to 2 for historical # compatibility. ruby-ng_rspec() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" local version=${RSPEC_VERSION-2} local files="$@" @@ -798,7 +755,7 @@ 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() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" if [[ "${DEPEND}${BDEPEND}" != *"dev-util/cucumber"* ]]; then ewarn "Missing test dependency dev-util/cucumber" @@ -831,7 +788,7 @@ ruby-ng_cucumber() { # This is simply a wrapper around the sus-parallel command (executed by $RUBY}) # which also respects TEST_VERBOSE and NOCOLOR environment variables. ruby-ng_sus() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" if [[ "${DEPEND}${BDEPEND}" != *"dev-ruby/sus"* ]]; then ewarn "Missing test dependency dev-ruby/sus" @@ -859,7 +816,7 @@ ruby-ng_sus() { # their script and we installed a broken wrapper for a while. # This also respects TEST_VERBOSE and NOCOLOR environment variables. ruby-ng_testrb-2() { - debug-print-function ${FUNCNAME} "${@}" + debug-print-function ${FUNCNAME} "$@" if [[ "${DEPEND}${BDEPEND}" != *"dev-ruby/test-unit"* ]]; then ewarn "Missing test dependency dev-ruby/test-unit" |