commit:     eb46994435c54900a00e7d2e2a13383ce8c0b822
Author:     Andrei Horodniceanu <a.horodniceanu <AT> proton <DOT> me>
AuthorDate: Sun Aug 24 16:51:42 2025 +0000
Commit:     Horodniceanu Andrei <a.horodniceanu <AT> proton <DOT> me>
CommitDate: Sun Aug 24 17:06:15 2025 +0000
URL:        https://gitweb.gentoo.org/repo/user/dlang.git/commit/?id=eb469944

eclass: Drop ugly KEYWORDS abuse

The code paths are not useful for users, they're only meant for
developers to help with pkgcheck usage. The newly added profiles are a
better tool, being more expressive, not requiring code and not being
visible to users.

On top of this, because the eclasses were inherited before the KEYWORDS
were defined, the code wasn't doing anything.

Signed-off-by: Andrei Horodniceanu <a.horodniceanu <AT> proton.me>

 eclass/dlang-compilers-r1.eclass | 192 ++++++---------------------------------
 eclass/dlang-r1.eclass           |  19 ++--
 eclass/dlang-single.eclass       |  17 +---
 eclass/dlang-utils.eclass        |   3 +-
 4 files changed, 42 insertions(+), 189 deletions(-)

diff --git a/eclass/dlang-compilers-r1.eclass b/eclass/dlang-compilers-r1.eclass
index 8c95f17..453d4a4 100644
--- a/eclass/dlang-compilers-r1.eclass
+++ b/eclass/dlang-compilers-r1.eclass
@@ -12,8 +12,8 @@
 # @VCSURL: https://github.com/gentoo/dlang
 # @BLURB: Support data for dlang-utils.eclass
 # @DESCRIPTION:
-# Contains the available D compiler versions with their stable
-# architectures and the language version they support.
+# Contains the available D compiler and the language version they
+# support.
 
 if [[ ! ${_DLANG_COMPILERS_R1_ECLASS} ]] ; then
 _DLANG_COMPILERS_R1_ECLASS=1
@@ -22,69 +22,61 @@ _DLANG_COMPILERS_R1_ECLASS=1
 # @INTERNAL
 # @DESCRIPTION:
 # A list of dmd implementations with their dlang frontend version (which
-# happens to coincide with the implementation version) and the
-# architectures they support as a list of keywords. Only stable and
-# unstable keywords will appear.
+# happens to coincide with the implementation version)
 #
 # The elements are ordered, the higher implementation version has the
 # higher index.
 #
 # Example value for an element:
 # @CODE
-# "2.102 2.102 ~amd64 x86"
+# "2.102 2.102"
 # @CODE
-# Where the first 2.102 represents the implementation version,
-# the second one represents the D language version the implementation
-# supports and, lastly, there are two keywords.
+# Where the first 2.102 represents the implementation version and the
+# second one represents the D language version the implementation
+# supports.
 readonly _DLANG_DMD_FRONTENDS=(
-       "2.107 2.107 ~amd64 ~x86"
-       "2.108 2.108 ~amd64 ~x86"
-       "2.109 2.109 ~amd64 ~x86"
-       "2.110 2.110 ~amd64 ~x86"
-       "2.111 2.111 ~amd64 ~x86"
+       "2.107 2.107"
+       "2.108 2.108"
+       "2.109 2.109"
+       "2.110 2.110"
+       "2.111 2.111"
 )
 
 # @ECLASS_VARIABLE: _DLANG_GDC_FRONTENDS
 # @INTERNAL
 # @DESCRIPTION:
-# A list of gdc implementations with their dlang frontend version and
-# the architectures they support as a list of keywords. Only stable and
-# unstable keywords will appear.
+# A list of gdc implementations with their dlang frontend version
 #
 # The elements are ordered, the higher implementation version has the
 # higher index.
 #
 # Example value for an element:
 # @CODE
-# "13 2.103 amd64 ~arm64 x86"
+# "13 2.103"
 # @CODE
-# Where 13 represents the implementation version, 2.103 represents the D
-# language version the implementation supports and, lastly, there are
-# three keywords.
+# Where 13 represents the implementation version and 2.103 represents
+# the D language version the implementation supports.
 readonly _DLANG_GDC_FRONTENDS=(
-       "12 2.100 ~amd64 ~arm64 ~x86"
-       "13 2.103 ~amd64 ~arm64 ~x86"
-       "14 2.108 ~amd64 ~arm64 ~x86"
-       "15 2.111 ~amd64 ~arm64 ~x86"
+       "12 2.100"
+       "13 2.103"
+       "14 2.108"
+       "15 2.111"
 )
 
 # @ECLASS_VARIABLE: _DLANG_LDC2_FRONTENDS
 # @INTERNAL
 # @DESCRIPTION:
-# A list of ldc2 implementations with their dlang frontend version and
-# the architectures they support as a list of keywords. Only stable and
-# unstable keywords will appear.
+# A list of ldc2 implementations with their dlang frontend version.
 #
 # The elements are ordered, the higher implementation version has the
 # higher index.
 #
 # Example value for an element:
 # @CODE
-# 1.34 2.104 ~amd64 ~arm64
+# "1.34 2.104"
 # @CODE
-# Where 1.34 represents the implementation version, 2.104 represents the
-# D language version the implementation supports and, lastly, there are
-# two keywords.
+# Where 1.34 represents the implementation version and 2.104 represents
+# the D language version the implementation supports.
 readonly _DLANG_LDC2_FRONTENDS=(
        "1.36 2.106 ~amd64 ~arm64 ~x86"
        "1.37 2.107 ~amd64 ~arm64 ~x86"
@@ -149,138 +141,13 @@ readonly _DLANG_HISTORICAL_IMPLS=(
        gdc-11
 )
 
-# @FUNCTION: dlang_compilers_stabs_required_use
-# @USAGE: <use_expand_name> [<impls>...]
-# @DESCRIPTION:
-# Generate a required-use expression which ensures that only supported
-# implementations can be selected.
-#
-# Check _dlang_get_bad_arches for a more detailed description of what
-# an implementation being supported means.
-#
-# <use_expand_name> is a string used to transform implementations as
-# they appear in <impls> into USE flags. Possible values are
-# "dlang_targets" and "dlang_single_target".
-#
-# Example: If we had the implementation dmd-2_105 with the keywords,
-# i.e. the keywords in _DLANG_DMD_FRONTENDS, `amd64 ~x86' and $KEYWORDS
-# has the contents `amd64 arm64 x86' the output should be:
-# @CODE
-# "<use_expand_name>_dmd-2_105? ( !x86 ) <use_expand_name>_dmd-2_105? ( !arm64 
)"
-# @CODE
-dlang_compilers_stabs_required_use() {
-       debug-print-function ${FUNCNAME} "${@}"
-
-       local use_expand_name=${1}
-       local impls=( ${@:2} )
-
-       local result=() impl
-       for impl in "${impls[@]}"; do
-               local badArches=( $(_dlang_get_bad_arches "${impl}") )
-               local arch
-               for arch in "${badArches[@]}"; do
-                       result+=( "${use_expand_name}_${impl}? ( !${arch} )" )
-               done
-       done
-
-       echo "${result[@]}"
-}
-
-# @FUNCTION: dlang_compilers_stabs_impl_dep
-# @USAGE: <impl> <dep_string>
-# @DESCRIPTION:
-# Print a dependency string based on <dep_string>, USE disabled on
-# architectures found in $KEYWORDS that are not supported by <impl>.
-#
-# To see what it means for an architecture to be unsupported check
-# _dlang_get_bad_arches.
-#
-# Example: If we had the implementation dmd-2_105 with the keywords,
-# i.e. the keywords in _DLANG_DMD_FRONTENDS, `amd64 ~x86' and $KEYWORDS
-# has the contents `amd64 arm64 x86' the output should be:
-# @CODE
-# "!arm64? ( !x86? ( <dep_string> ) ) "
-# @CODE
-# Where <dep_string> looks like `dlang_single_target_dmd-2_105? ( 
dev-lang/dmd:2.105= ) '
-dlang_compilers_stabs_impl_dep() {
-       debug-print-function ${FUNCNAME} "${@}"
-
-       local impl=${1} dep=${2}
-       local badArches=( $(_dlang_get_bad_arches "${impl}") )
-
-       local arch
-       for arch in "${badArches[@]}"; do
-               dep="!${arch}? ( ${dep}) "
-       done
-
-       echo "${dep}"
-}
-
-# @FUNCTION: _dlang_get_bad_arches
-# @USAGE: <impl>
-# @INTERNAL
-# @DESCRIPTION:
-# Output a string of all the arches that are unsupported by <impl> in
-# regards to $KEYWORDS.
-#
-# An architecture is considered unsupported if it:
-#
-# - appears in $KEYWORDS (either as stable or unstable) and it doesn't
-#   appear in the keywords of <impl>, the ones from the
-#   _DLANG_*_FRONTENDS arrays.
-#
-# - appears in $KEYWORDS as stable and it appears in the keywords of
-#   <impl> as unstable.
-#
-# For example, if we had the implementation dmd-2_105 with the keywords,
-# i.e. the keywords in _DLANG_DMD_FRONTENDS, `amd64 ~x86' and $KEYWORDS
-# has the contents `amd64 arm64 x86' the output should be, in no
-# particular order:
-# @CODE
-# x86 arm64
-# @CODE
-_dlang_get_bad_arches() {
-       debug-print-function ${FUNCNAME} "${@}"
-
-       local details=( $(_dlang_get_impl_details "${1}") )
-       local implKeywords=( ${details[@]:2} )
-
-       local result=() keyword
-       # Meh, $KEYWORDS can contain -* (like for dmd) and that is globing
-       # so bad.
-       local keywords
-       read -ra keywords <<<"${KEYWORDS}"
-       for keyword in "${keywords[@]}"; do
-               [[ ${keyword::1} == - ]] && continue
-
-               local arch=${keyword}
-               [[ ${keyword::1} == "~" ]] && arch=${keyword:1}
-
-               local found=0
-               if [[ ${keyword::1} == "~" ]]; then
-                       # An unstable package accepts a stable or an unstable 
implementation
-                       has "${arch}" "${implKeywords[@]}" && found=1
-                       has "~${arch}" "${implKeywords[@]}" && found=1
-               else
-                       # A stable package accepts only a stable implementation
-                       has "${arch}" "${implKeywords[@]}" && found=1
-               fi
-
-               if [[ ${found} == 0 ]]; then
-                       result+=( "${arch}" )
-               fi
-       done
-
-       echo "${result[@]}"
-}
-
-# @FUNCTION: _dlang_get_impl_details
+# @FUNCTION: _dlang_get_fe_version
 # @USAGE: <impl>
 # @INTERNAL
 # @DESCRIPTION:
-# Print the details of the implementation denoted by <impl>, as they
-# appear in _DLANG_*_FRONTENDS.
-_dlang_get_impl_details() {
+# Print the frontend version of the implementation denoted by <impl>, as
+# it appears in _DLANG_*_FRONTENDS.
+_dlang_get_fe_version() {
        debug-print-function ${FUNCNAME} "${@}"
 
        local impl="${1/_/.}"
@@ -292,7 +159,8 @@ _dlang_get_impl_details() {
        local details
        for details in "${!arr}"; do
                if [[ ${details%% *} == ${ver} ]]; then
-                       echo "${details}"
+                       local fields=( ${details} )
+                       echo "${fields[1]}"
                        return
                fi
        done

diff --git a/eclass/dlang-r1.eclass b/eclass/dlang-r1.eclass
index 3ec24fe..2ac2826 100644
--- a/eclass/dlang-r1.eclass
+++ b/eclass/dlang-r1.eclass
@@ -1,4 +1,4 @@
-# Copyright 2024 Gentoo Authors
+# Copyright 2024-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: dlang-r1.eclass
@@ -219,22 +219,15 @@ _dlang_set_globals() {
 
        for i in "${_DLANG_SUPPORTED_IMPLS[@]}"; do
                _dlang_export "${i}" DLANG_PKG_DEP
-               deps+=$(
-                       dlang_compilers_stabs_impl_dep \
-                               "${i}" \
-                               "dlang_targets_${i}? (
-                                       ${DLANG_PKG_DEP}
-                                ) "
-                        )
+               deps+="
+               dlang_targets_${i}? (
+                       ${DLANG_PKG_DEP}
+               ) "
        done
 
        local flags=( "${_DLANG_SUPPORTED_IMPLS[@]/#/dlang_targets_}" )
        local optflags=${flags[@]/%/(-)?}
-       local stabilization_mock=$(dlang_compilers_stabs_required_use \
-                                                                  
dlang_targets \
-                                                                  
"${_DLANG_SUPPORTED_IMPLS[@]}"
-                 )
-       local requse="( || ( ${flags[*]} )${stabilization_mock:+ 
${stabilization_mock}} )"
+       local requse="( || ( ${flags[*]} ) )"
        local usedep=${optflags// /,}
 
        if [[ ${DLANG_DEPS+1} ]]; then

diff --git a/eclass/dlang-single.eclass b/eclass/dlang-single.eclass
index a94bc80..82b85ce 100644
--- a/eclass/dlang-single.eclass
+++ b/eclass/dlang-single.eclass
@@ -233,24 +233,17 @@ _dlang_single_set_globals() {
                IUSE="${flags[*]}"
        fi
 
-       local stabilization_mock=$(dlang_compilers_stabs_required_use \
-                                                                  
dlang_single_target \
-                                                                  
"${_DLANG_SUPPORTED_IMPLS[@]}"
-                 )
-       local requse="( ^^ ( ${flags[*]} )${stabilization_mock:+ 
${stabilization_mock}} )"
+       local requse="( ^^ ( ${flags[*]} ) )"
        local single_flags="${flags[@]/%/(-)?}"
        local single_usedep=${single_flags// /,}
 
        local deps= i DLANG_PKG_DEP
        for i in "${_DLANG_SUPPORTED_IMPLS[@]}"; do
                _dlang_export "${i}" DLANG_PKG_DEP
-               deps+=$(
-                       dlang_compilers_stabs_impl_dep \
-                               "${i}" \
-                               "dlang_single_target_${i}? (
-                                       ${DLANG_PKG_DEP}
-                               ) "
-                        )
+               deps+="
+               dlang_single_target_${i}? (
+                       ${DLANG_PKG_DEP}
+               ) "
        done
 
        if [[ ${DLANG_DEPS+1} ]]; then

diff --git a/eclass/dlang-utils.eclass b/eclass/dlang-utils.eclass
index 89ca344..a47bc9d 100644
--- a/eclass/dlang-utils.eclass
+++ b/eclass/dlang-utils.eclass
@@ -1052,8 +1052,7 @@ _dlang_export() {
                                debug-print "${FUNCNAME}: DLANG_VERSION_FLAG = 
${DLANG_VERSION_FLAG}"
                                ;;
                        DLANG_FE_VERSION)
-                               local implDetails=( $(_dlang_get_impl_details 
"${impl}") )
-                               export DLANG_FE_VERSION=${implDetails[1]}
+                               export DLANG_FE_VERSION=$(_dlang_get_fe_version 
"${impl}")
                                debug-print "${FUNCNAME}: DLANG_FE_VERSION = 
${DLANG_FE_VERSION}"
                                ;;
                        DLANG_BE_VERSION)

Reply via email to