commit:     27eec8a39f8bcfac00a292667273cc60100cd97b
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 28 07:11:47 2023 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Wed Jun 28 07:11:47 2023 +0000
URL:        https://gitweb.gentoo.org/proj/java.git/commit/?id=27eec8a3

gradle.eclass: drop usage of compgen

Bash's compgen builtin is only available if bash was built with readline
support. And PMS does not require that this is the case.

See also https://bugs.gentoo.org/909163

Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 eclass/gradle.eclass | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/eclass/gradle.eclass b/eclass/gradle.eclass
index 070a3e12..7595923d 100644
--- a/eclass/gradle.eclass
+++ b/eclass/gradle.eclass
@@ -105,20 +105,14 @@ gradle-set_EGRADLE() {
                return
        fi
 
-       local candidates candidate selected selected_ver
+       local candidate selected selected_ver ver
 
-       candidates=$(compgen -c gradle-)
-       for candidate in ${candidates}; do
-               if [[ ! ${candidate} =~ gradle(-bin)?-([.0-9]+) ]]; then
+       for candidate in "${BROOT}"/usr/bin/gradle-; do
+               if [[ ${candidate} != */gradle?(-bin)-+([.0-9]) ]]; then
                        continue
                fi
 
-               local ver
-               if (( ${#BASH_REMATCH[@]} == 3 )); then
-                       ver="${BASH_REMATCH[2]}"
-               else
-                       ver="${BASH_REMATCH[1]}"
-               fi
+               ver=${candidate##*-}
 
                if [[ -n ${EGRADLE_EXACT_VER} ]]; then
                        ver_test "${ver}" -ne "${EGRADLE_EXACT_VER}" && continue
@@ -150,7 +144,7 @@ gradle-set_EGRADLE() {
        done
 
        if [[ -z ${selected} ]]; then
-               die "Could not find (suitable) gradle installation in PATH"
+               die "Could not find (suitable) gradle installation in 
${BROOT}/usr/bin"
        fi
 
        EGRADLE="${selected}"

Reply via email to