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