From 10fd92b3c99b4ac72ea3eca712d420471c01c445 Mon Sep 17 00:00:00 2001 From: Flatcar Buildbot Date: Mon, 23 Mar 2026 07:34:06 +0000 Subject: [PATCH] eclass/flag-o-matic: Sync with Gentoo It's from Gentoo commit 0391884e82912c23dda0c74ecdb16752f5e2d1cd. Signed-off-by: Flatcar Buildbot --- .../portage-stable/eclass/flag-o-matic.eclass | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/sdk_container/src/third_party/portage-stable/eclass/flag-o-matic.eclass b/sdk_container/src/third_party/portage-stable/eclass/flag-o-matic.eclass index 830e42f1b9..8474e844f7 100644 --- a/sdk_container/src/third_party/portage-stable/eclass/flag-o-matic.eclass +++ b/sdk_container/src/third_party/portage-stable/eclass/flag-o-matic.eclass @@ -4,7 +4,7 @@ # @ECLASS: flag-o-matic.eclass # @MAINTAINER: # toolchain@gentoo.org -# @SUPPORTED_EAPIS: 7 8 +# @SUPPORTED_EAPIS: 7 8 9 # @BLURB: common functions to manipulate and query toolchain flags # @DESCRIPTION: # This eclass contains a suite of functions to help developers sanely @@ -14,7 +14,7 @@ if [[ -z ${_FLAG_O_MATIC_ECLASS} ]]; then _FLAG_O_MATIC_ECLASS=1 case ${EAPI} in - 7|8) ;; + 7|8|9) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac @@ -853,9 +853,24 @@ get-flag() { # `get-flag march` == "i686" for var in $(all-flag-vars) ; do for f in ${!var} ; do - if [ "${f/${findflag}}" != "${f}" ] ; then - printf "%s\n" "${f/-${findflag}=}" - return 0 + if [[ ${EAPI} = [78] && -z "${_FLAG_O_MATIC_TESTS_FAKE_EAPI_NINE}" ]]; then + if [[ "${f/${findflag}}" != "${f}" ]] ; then + printf "%s\n" "${f/-${findflag}=}" + return 0 + fi + else + # Print RHS for "flag" (no leading "-") + if [[ "${f#-${findflag}=}" != "${f}" ]] ; then + printf "%s\n" "${f#-${findflag}=}" + return 0 + fi + # Print full match for any of: + # "-flag" with leading "-" + # "flag" without leading "-" that has no unmatched succeeding =value + if [[ ${f} = -${findflag#-} || ${f%=*} = ${findflag} ]] ; then + printf "%s\n" "${f}" + return 0 + fi fi done done