ruby-ng.eclass: use the default src_prepare in EAPI 6
authorHans de Graaff <graaff@gentoo.org>
Sun, 19 Feb 2017 07:42:31 +0000 (08:42 +0100)
committerHans de Graaff <graaff@gentoo.org>
Sat, 25 Feb 2017 08:20:55 +0000 (09:20 +0100)
This removes the need for inheriting eutils in EAPI 6.  It also use
the standard PATCHES support instead of RUBY_PATCHES, which was
introduced to handle arrays on patches at the time.

The default phase also handles eapply_user to handle user patches.

eclass/ruby-ng.eclass

index cd6a5ae2ad10959a7f35fc4a67421d3fb7217461..263bf89545b2cc4935383ee22cd423f78df2885c 100644 (file)
 # (e.g. selenium's firefox driver extension). When set this argument is
 # passed to "grep -E" to remove reporting of these shared objects.
 
-inherit eutils java-utils-2 multilib toolchain-funcs ruby-utils
+local inherits=""
+case ${EAPI} in
+       2|3|4|5)
+               inherits="eutils"
+               ;;
+esac
+
+inherit ${inherits} java-utils-2 multilib toolchain-funcs ruby-utils
 
 EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup
 
@@ -399,15 +406,24 @@ ruby-ng_src_unpack() {
 }
 
 _ruby_apply_patches() {
-       for patch in "${RUBY_PATCHES[@]}"; do
-               if [ -f "${patch}" ]; then
-                       epatch "${patch}"
-               elif [ -f "${FILESDIR}/${patch}" ]; then
-                       epatch "${FILESDIR}/${patch}"
-               else
-                       die "Cannot find patch ${patch}"
-               fi
-       done
+       case ${EAPI} in
+               2|3|4|5)
+                       for patch in "${RUBY_PATCHES[@]}"; do
+                               if [ -f "${patch}" ]; then
+                                       epatch "${patch}"
+                               elif [ -f "${FILESDIR}/${patch}" ]; then
+                                       epatch "${FILESDIR}/${patch}"
+                               else
+                                       die "Cannot find patch ${patch}"
+                               fi
+                       done
+                       ;;
+               6)
+                       if [[ -n ${RUBY_PATCHES[@]} ]]; then
+                          eqawarn "RUBY_PATCHES is no longer supported, use PATCHES instead"
+                       fi
+                       ;;
+       esac
 
        # This is a special case: instead of executing just in the special
        # "all" environment, this will actually copy the effects on _all_
@@ -432,14 +448,15 @@ ruby-ng_src_prepare() {
        # almost every other ebuild.
        find . -name '._*' -delete
 
-       _ruby_invoke_environment all _ruby_apply_patches
-
+       # Handle PATCHES and user supplied patches via the default phase
        case ${EAPI} in
                6)
-                       eapply_user
+                       _ruby_invoke_environment all default
                        ;;
        esac
 
+       _ruby_invoke_environment all _ruby_apply_patches
+
        _PHASE="source copy" \
                _ruby_each_implementation _ruby_source_copy