Re: [gentoo-dev] [PATCH] gnustep-base.eclass: Limit SUPPORTED_EAPIS to [5-7], drop eutils

2021-04-07 Thread Bernard Cafarelli
Le Wed, 07 Apr 2021 00:16:26 +0200
Andreas Sturmlechner  a écrit:

> Just some cheap fixes while flag-o-matic.eclass causes cache-regen anyway.
> See also: https://github.com/gentoo/gentoo/pull/20207
> 
> - Add inherit guard
> - Fix some eclassdoc
> - Minor cleanup
> 
> ---
>  eclass/gnustep-base.eclass | 65 --
>  1 file changed, 34 insertions(+), 31 deletions(-)
> 
> diff --git a/eclass/gnustep-base.eclass b/eclass/gnustep-base.eclass
> index 6cd9f532a55..c343dbb5c6b 100644
> --- a/eclass/gnustep-base.eclass
> +++ b/eclass/gnustep-base.eclass
> @@ -1,16 +1,27 @@
> -# Copyright 1999-2018 Gentoo Foundation
> +# Copyright 1999-2021 Gentoo Authors
>  # Distributed under the terms of the GNU General Public License v2
>  
>  # @ECLASS: gnustep-base.eclass
>  # @MAINTAINER:
>  # GNUstep Herd 
> -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
> +# @SUPPORTED_EAPIS: 5 6 7
>  # @BLURB: Internal handling of GNUstep pacakges
>  # @DESCRIPTION:
>  # Inner gnustep eclass, should only be inherited directly by gnustep-base
>  # packages
>  
> -inherit eutils flag-o-matic
> +if [[ -z ${_GNUSTEP_BASE_ECLASS} ]]; then
> +_GNUSTEP_BASE_ECLASS=1
> +
> +inherit flag-o-matic
> +
> +EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_install 
> pkg_postinst
> +
> +case ${EAPI:-0} in
> + [0-4]) die "gnustep-base.eclass: EAPI ${EAPI} is too old." ;;
> + [5-7]) inherit eutils ;;
> + *) die "EAPI ${EAPI} is not supported by gnustep-base.eclass." ;;
> +esac
>  
>  # IUSE variables across all GNUstep packages
>  # "debug": enable code for debugging
> @@ -40,13 +51,6 @@ gnustep-base_pkg_setup() {
>   filter-flags -fomit-frame-pointer
>  }
>  
> -gnustep-base_src_unpack() {
> - unpack ${A}
> - cd "${S}"
> -
> - gnustep-base_src_prepare
> -}
> -
>  gnustep-base_src_prepare() {
>   if [[ -f ./GNUmakefile ]] ; then
>   # Kill stupid includes that are simply overdone or useless on 
> normal
> @@ -63,22 +67,18 @@ gnustep-base_src_prepare() {
>   eend $?
>   fi
>  
> - ! has ${EAPI:-0} 0 1 2 3 4 5 && default
> + ! has ${EAPI:-0} 5 && default
>  }
>  
>  gnustep-base_src_configure() {
>   egnustep_env
>   if [[ -x ./configure ]] ; then
> - econf || die "configure failed"
> + econf
>   fi
>  }
>  
>  gnustep-base_src_compile() {
>   egnustep_env
> - case ${EAPI:-0} in
> - 0|1) gnustep-base_src_configure ;;
> - esac
> -
>   egnustep_make
>  }
>  
> @@ -105,6 +105,8 @@ gnustep-base_pkg_postinst() {
>   elog "  ${SCRIPT_PATH}/config-${PN}.sh"
>  }
>  
> +# @FUNCTION: egnustep_env
> +# @DESCRIPTION:
>  # Clean/reset an ebuild to the installed GNUstep environment
>  egnustep_env() {
>   # Get additional variables
> @@ -113,9 +115,9 @@ egnustep_env() {
>   # Makefiles path
>   local GS_MAKEFILES
>   if [[ -d ${EPREFIX}/usr/share/GNUstep/Makefiles ]]; then
> - GS_MAKEFILES=${EPREFIX}/usr/share/GNUstep/Makefiles
> + GS_MAKEFILES="${EPREFIX}"/usr/share/GNUstep/Makefiles
>   else
> - GS_MAKEFILES=${GNUSTEP_PREFIX}/System/Library/Makefiles
> + GS_MAKEFILES="${GNUSTEP_PREFIX}"/System/Library/Makefiles
>   fi
>   if [[ -f ${GS_MAKEFILES}/GNUstep.sh ]] ; then
>   # Reset GNUstep variables
> @@ -130,7 +132,6 @@ egnustep_env() {
>   -i "${WORKDIR}"/GNUstep.conf || die 
> "GNUstep.conf sed failed"
>   fi
>  
> -
>   if [[ ! -d ${EPREFIX}/usr/share/GNUstep/Makefiles ]]; then
>   # Set rpath in ldflags when available
>   case ${CHOST} in
> @@ -159,8 +160,7 @@ egnustep_env() {
>   && GS_ENV=( "${GS_ENV[@]}" "debug=yes" ) \
>   || GS_ENV=( "${GS_ENV[@]}" "debug=no" )
>  
> - if has_version "gnustep-base/gnustep-make[libobjc2]";
> - then
> + if has_version "gnustep-base/gnustep-make[libobjc2]"; then
>   # Set clang for packages that do not respect 
> gnustep-make
>   # settings (gnustep-base's configure for example)
>   export CC=clang CXX=clang CPP="clang -E" LD="clang"
> @@ -171,36 +171,42 @@ egnustep_env() {
>   die "gnustep-make not installed!"
>  }
>  
> +# @FUNCTION: egnustep_make
> +# @DESCRIPTION:
>  # Make utilizing GNUstep Makefiles
>  egnustep_make() {
>   if [[ -f ./Makefile || -f ./makefile || -f ./GNUmakefile ]] ; then
> - emake ${*} "${GS_ENV[@]}" all || die "package make failed"
> + emake ${*} "${GS_ENV[@]}" all
>   return 0
>   fi
>   die "no Makefile found"
>  }
>  
> +# @FUNCTION: egnustep_install
> +# @DESCRIPTION:
>  # Make-install utilizing GNUstep Makefiles
>  egnustep_install() {
>   if [[ ! -d ${EPREFIX}/usr/share/GNUstep/Makefiles ]]; then
>   # avoid problems due to our "weird" prefix, ma

[gentoo-dev] [PATCH] gnustep-base.eclass: Limit SUPPORTED_EAPIS to [5-7], drop eutils

2021-04-06 Thread Andreas Sturmlechner
Just some cheap fixes while flag-o-matic.eclass causes cache-regen anyway.
See also: https://github.com/gentoo/gentoo/pull/20207

- Add inherit guard
- Fix some eclassdoc
- Minor cleanup

---
 eclass/gnustep-base.eclass | 65 --
 1 file changed, 34 insertions(+), 31 deletions(-)

diff --git a/eclass/gnustep-base.eclass b/eclass/gnustep-base.eclass
index 6cd9f532a55..c343dbb5c6b 100644
--- a/eclass/gnustep-base.eclass
+++ b/eclass/gnustep-base.eclass
@@ -1,16 +1,27 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: gnustep-base.eclass
 # @MAINTAINER:
 # GNUstep Herd 
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7
 # @BLURB: Internal handling of GNUstep pacakges
 # @DESCRIPTION:
 # Inner gnustep eclass, should only be inherited directly by gnustep-base
 # packages
 
-inherit eutils flag-o-matic
+if [[ -z ${_GNUSTEP_BASE_ECLASS} ]]; then
+_GNUSTEP_BASE_ECLASS=1
+
+inherit flag-o-matic
+
+EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_install 
pkg_postinst
+
+case ${EAPI:-0} in
+   [0-4]) die "gnustep-base.eclass: EAPI ${EAPI} is too old." ;;
+   [5-7]) inherit eutils ;;
+   *) die "EAPI ${EAPI} is not supported by gnustep-base.eclass." ;;
+esac
 
 # IUSE variables across all GNUstep packages
 # "debug": enable code for debugging
@@ -40,13 +51,6 @@ gnustep-base_pkg_setup() {
filter-flags -fomit-frame-pointer
 }
 
-gnustep-base_src_unpack() {
-   unpack ${A}
-   cd "${S}"
-
-   gnustep-base_src_prepare
-}
-
 gnustep-base_src_prepare() {
if [[ -f ./GNUmakefile ]] ; then
# Kill stupid includes that are simply overdone or useless on 
normal
@@ -63,22 +67,18 @@ gnustep-base_src_prepare() {
eend $?
fi
 
-   ! has ${EAPI:-0} 0 1 2 3 4 5 && default
+   ! has ${EAPI:-0} 5 && default
 }
 
 gnustep-base_src_configure() {
egnustep_env
if [[ -x ./configure ]] ; then
-   econf || die "configure failed"
+   econf
fi
 }
 
 gnustep-base_src_compile() {
egnustep_env
-   case ${EAPI:-0} in
-   0|1) gnustep-base_src_configure ;;
-   esac
-
egnustep_make
 }
 
@@ -105,6 +105,8 @@ gnustep-base_pkg_postinst() {
elog "  ${SCRIPT_PATH}/config-${PN}.sh"
 }
 
+# @FUNCTION: egnustep_env
+# @DESCRIPTION:
 # Clean/reset an ebuild to the installed GNUstep environment
 egnustep_env() {
# Get additional variables
@@ -113,9 +115,9 @@ egnustep_env() {
# Makefiles path
local GS_MAKEFILES
if [[ -d ${EPREFIX}/usr/share/GNUstep/Makefiles ]]; then
-   GS_MAKEFILES=${EPREFIX}/usr/share/GNUstep/Makefiles
+   GS_MAKEFILES="${EPREFIX}"/usr/share/GNUstep/Makefiles
else
-   GS_MAKEFILES=${GNUSTEP_PREFIX}/System/Library/Makefiles
+   GS_MAKEFILES="${GNUSTEP_PREFIX}"/System/Library/Makefiles
fi
if [[ -f ${GS_MAKEFILES}/GNUstep.sh ]] ; then
# Reset GNUstep variables
@@ -130,7 +132,6 @@ egnustep_env() {
-i "${WORKDIR}"/GNUstep.conf || die 
"GNUstep.conf sed failed"
fi
 
-
if [[ ! -d ${EPREFIX}/usr/share/GNUstep/Makefiles ]]; then
# Set rpath in ldflags when available
case ${CHOST} in
@@ -159,8 +160,7 @@ egnustep_env() {
&& GS_ENV=( "${GS_ENV[@]}" "debug=yes" ) \
|| GS_ENV=( "${GS_ENV[@]}" "debug=no" )
 
-   if has_version "gnustep-base/gnustep-make[libobjc2]";
-   then
+   if has_version "gnustep-base/gnustep-make[libobjc2]"; then
# Set clang for packages that do not respect 
gnustep-make
# settings (gnustep-base's configure for example)
export CC=clang CXX=clang CPP="clang -E" LD="clang"
@@ -171,36 +171,42 @@ egnustep_env() {
die "gnustep-make not installed!"
 }
 
+# @FUNCTION: egnustep_make
+# @DESCRIPTION:
 # Make utilizing GNUstep Makefiles
 egnustep_make() {
if [[ -f ./Makefile || -f ./makefile || -f ./GNUmakefile ]] ; then
-   emake ${*} "${GS_ENV[@]}" all || die "package make failed"
+   emake ${*} "${GS_ENV[@]}" all
return 0
fi
die "no Makefile found"
 }
 
+# @FUNCTION: egnustep_install
+# @DESCRIPTION:
 # Make-install utilizing GNUstep Makefiles
 egnustep_install() {
if [[ ! -d ${EPREFIX}/usr/share/GNUstep/Makefiles ]]; then
# avoid problems due to our "weird" prefix, make sure it exists
-   mkdir -p "${D}"${GNUSTEP_SYSTEM_TOOLS}
+   mkdir -p "${D}"${GNUSTEP_SYSTEM_TOOLS} || die
fi
if [[ -f ./[mM]akefile || -f ./GNUmakefile ]] ; then
-   emake ${*} "${GS_ENV[@]}" in