commit:     a1c0c8e4cc2a6a95e459f81fec6d50860870a07c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 31 07:06:04 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Apr 11 20:59:57 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a1c0c8e4

gnuconfig.eclass: use BDEPEND, BROOT where available (drop support for EAPI <5)

EPREFIX is only available in > EAPI 2 but let's take the opportuinty
to clean up in general. We don't want to keep worrying about
*very* old EAPI cases, especially given other eclasses
either barely - or don't - support it.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 eclass/gnuconfig.eclass | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/eclass/gnuconfig.eclass b/eclass/gnuconfig.eclass
index 24f2714b6c1..173df6fd25e 100644
--- a/eclass/gnuconfig.eclass
+++ b/eclass/gnuconfig.eclass
@@ -16,7 +16,13 @@
 # other files that come with automake, e.g. depcomp, mkinstalldirs, etc.
 #
 
-DEPEND="sys-devel/gnuconfig"
+case ${EAPI:-0} in
+       5|6|7)
+               ;;
+       *)
+               die "EAPI ${EAPI} is unsupported!"
+               ;;
+esac
 
 if [[ -z ${_GNUCONFIG_ECLASS} ]] ; then
  _GNUCONFIG_CLASS=1
@@ -99,12 +105,25 @@ gnuconfig_do_update() {
 # This searches the standard locations for the newest config.{sub|guess}, and
 # returns the directory where they can be found.
 gnuconfig_findnewest() {
-       local locations=(
-               "${EPREFIX}"/usr/share/misc/config.sub
-               "${EPREFIX}"/usr/share/gnuconfig/config.sub
-               "${EPREFIX}"/usr/share/automake*/config.sub
-               "${EPREFIX}"/usr/share/libtool/config.sub
+       local locations=()
+       local prefix
+
+       case ${EAPI} in
+               5|6)
+                       prefix="${EPREFIX}"
+                       ;;
+               *)
+                       prefix="${BROOT}"
+                       ;;
+       esac
+
+       locations+=(
+               "${prefix}"/usr/share/misc/config.sub
+               "${prefix}"/usr/share/gnuconfig/config.sub
+               "${prefix}"/usr/share/automake*/config.sub
+               "${prefix}"/usr/share/libtool/config.sub
        )
+
        grep -s '^timestamp' "${locations[@]}" | \
                sort -r -n -t\' -k2 | \
                sed -n '1{s,/config.sub:.*$,,;p;q}'

Reply via email to