commit:     6302dd47e23ee32cfcb446355704ba8bc61b668e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 25 00:05:20 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Sep 25 02:06:51 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6302dd47

toolchain.eclass: fix should_we_gcc_config for major-version slotting

Reported by the-horo on IRC.

For example, with slot as major version:
```
$ gcc-config -c x86_64-pc-linux-gnu
x86_64-pc-linux-gnu-13
$ gcc-config -S x86_64-pc-linux-gnu-13
x86_64-pc-linux-gnu 13
```
so we're indeed comparing 13 with 13.2 and hence we decide to run gcc-config
unnecessarily because we think it's a major version change.

Fix that by taking into account tc_use_major_version_only and comparing
based on GCCMAJOR for that case.

Bug: https://bugs.gentoo.org/865835
Bug: https://bugs.gentoo.org/873505
Reported-by: the-horo
Closes: https://github.com/gentoo/gentoo/pull/33042
Signed-off-by: Sam James <sam <AT> gentoo.org>

 eclass/toolchain.eclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 6a88676b750d..d93068619cf9 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -2244,7 +2244,9 @@ should_we_gcc_config() {
 
        local curr_branch_ver=$(ver_cut 1-2 ${curr_config_ver})
 
-       if [[ ${curr_branch_ver} == ${GCC_BRANCH_VER} ]] ; then
+       if tc_use_major_version_only && [[ ${curr_config_ver} == ${GCCMAJOR} ]] 
; then
+               return 0
+       elif ! tc_use_major_version_only && [[ ${curr_branch_ver} == 
${GCC_BRANCH_VER} ]] ; then
                return 0
        else
                # If we're installing a genuinely different compiler version,

Reply via email to