Re: [gentoo-dev] [PATCH 2/3] ruby-ng.eclass: Use eapply for RUBY_PATCHES in EAPI 6

2017-02-21 Thread Hans de Graaff
On Sun, 2017-02-19 at 09:26 +0100, Michał Górny wrote:
> W dniu 19.02.2017, nie o godzinie 09∶03 +0100, użytkownik Hans de
> Graaff
> napisał:
> > 
> > This also removes the need for inheriting eutils in EAPI 6.
> > 
> Wouldn't EAPI 6 be a good opportunity to kill this dualism and just
> require people to say FILESDIR explicitly?

Which made me think: why have RUBY_PATCHES at all. I think we added
that at the time to allow bash arrays as input. So I've changed this
patch to use the default phase in EAPI 6 instead, removing the need for
explicit eapply_user and PATCHES support.

Hans

1b2b8abde99a59e72fbcc0bc8f9e835dcaee2176
Author: Hans de Graaff 
AuthorDate: Sun Feb 19 08:42:31 2017 +0100
Commit: Hans de Graaff 
CommitDate: Tue Feb 21 20:18:17 2017 +0100

Parent: 1d36503 ruby-ng.eclass: add support for EAPI=6
Merged: eapi6 master
Containing: eapi6

ruby-ng.eclass: use the default src_prepare in EAPI 6

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.

1 file changed, 30 insertions(+), 13 deletions(-)
eclass/ruby-ng.eclass | 43 ++-

modified   eclass/ruby-ng.eclass
@@ -73,7 +73,14 @@
 # (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
 

signature.asc
Description: This is a digitally signed message part


Re: [gentoo-dev] [PATCH 2/3] ruby-ng.eclass: Use eapply for RUBY_PATCHES in EAPI 6

2017-02-19 Thread Michał Górny
W dniu 19.02.2017, nie o godzinie 09∶03 +0100, użytkownik Hans de Graaff
napisał:
> This also removes the need for inheriting eutils in EAPI 6.
> ---
>  eclass/ruby-ng.eclass | 23 ---
>  1 file changed, 20 insertions(+), 3 deletions(-)
> 
> diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
> index cd6a5ae..bc42e66 100644
> --- a/eclass/ruby-ng.eclass
> +++ b/eclass/ruby-ng.eclass
> @@ -73,7 +73,14 @@
>  # (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
>  
> @@ -400,13 +407,23 @@ ruby-ng_src_unpack() {
>  
>  _ruby_apply_patches() {
>   for patch in "${RUBY_PATCHES[@]}"; do
> + local patch_file=""
>   if [ -f "${patch}" ]; then
> - epatch "${patch}"
> + patch_file="${patch}"
>   elif [ -f "${FILESDIR}/${patch}" ]; then
> - epatch "${FILESDIR}/${patch}"
> + patch_file="${FILESDIR}/${patch}"

Wouldn't EAPI 6 be a good opportunity to kill this dualism and just
require people to say FILESDIR explicitly?

>   else
>   die "Cannot find patch ${patch}"
>   fi
> +
> + case ${EAPI} in
> + 2|3|4|5)
> + epatch "${patch_file}"
> + ;;
> + 6)
> + eapply "${patch_file}"
> + ;;
> + esac
>   done
>  
>   # This is a special case: instead of executing just in the special

-- 
Best regards,
Michał Górny


signature.asc
Description: This is a digitally signed message part


[gentoo-dev] [PATCH 2/3] ruby-ng.eclass: Use eapply for RUBY_PATCHES in EAPI 6

2017-02-19 Thread Hans de Graaff
This also removes the need for inheriting eutils in EAPI 6.
---
 eclass/ruby-ng.eclass | 23 ---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index cd6a5ae..bc42e66 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -73,7 +73,14 @@
 # (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
 
@@ -400,13 +407,23 @@ ruby-ng_src_unpack() {
 
 _ruby_apply_patches() {
for patch in "${RUBY_PATCHES[@]}"; do
+   local patch_file=""
if [ -f "${patch}" ]; then
-   epatch "${patch}"
+   patch_file="${patch}"
elif [ -f "${FILESDIR}/${patch}" ]; then
-   epatch "${FILESDIR}/${patch}"
+   patch_file="${FILESDIR}/${patch}"
else
die "Cannot find patch ${patch}"
fi
+
+   case ${EAPI} in
+   2|3|4|5)
+   epatch "${patch_file}"
+   ;;
+   6)
+   eapply "${patch_file}"
+   ;;
+   esac
done
 
# This is a special case: instead of executing just in the special
-- 
2.10.2