From ecdbf348756773c640c97d29ac2cfaa28144a4321453219c83328a2c867db64b Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Sat, 25 Jul 2020 07:26:12 +0000 Subject: [PATCH] Accepting request 822743 from home:eeich:branches:science:HPC Fix version parsing for gcc10 and up. OBS-URL: https://build.opensuse.org/request/show/822743 OBS-URL: https://build.opensuse.org/package/show/science:HPC/gnu-compilers-hpc?expand=0&rev=27 --- gnu-compilers-hpc.changes | 1 + gnu-compilers-hpc.spec | 6 ++++-- macros.hpc-gnu | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/gnu-compilers-hpc.changes b/gnu-compilers-hpc.changes index 7b8e7ae..fbdb42d 100644 --- a/gnu-compilers-hpc.changes +++ b/gnu-compilers-hpc.changes @@ -2,6 +2,7 @@ Thu Jul 23 16:13:13 UTC 2020 - Egbert Eich - Add build support for gcc10 to HPC build (bsc#1174439). + Fix version parsing for gcc10 and up. ------------------------------------------------------------------- Fri Aug 2 05:30:55 UTC 2019 - Egbert Eich diff --git a/gnu-compilers-hpc.spec b/gnu-compilers-hpc.spec index 63e3231..5918708 100644 --- a/gnu-compilers-hpc.spec +++ b/gnu-compilers-hpc.spec @@ -52,8 +52,10 @@ ExclusiveArch: do_not_build %endif # Keep in sync with macros.hpc-gnu -%global hpc_gnu_bin_version %{?c_f_ver:-%(echo %c_f_ver | \ - sed -e "s@\\([0-9]\\)@\\1.@g" -e "s@\\([0-9]\\)\\.\\$@\\1@g")} +# ab >= 40 - version: a.b to accompodate for old gcc version scheme of gcc < 5 +%global hpc_gnu_bin_version %{?c_f_ver:-%(v=%c_f_ver; [ $v -lt 40 ] && echo $v || + sed -e "s@\\([0-9]\\)@\\1.@g" \\ + -e "s@\\([0-9]\\)\\.\\$@\\1@g" <<< $v)} %global hpc_gnu_full_version %( gcc%{hpc_gnu_bin_version} --version |\ head -1 |\ sed -e "s#.* \\([0-9]\\+\\.[0-9.]\\+\\)\\(\$\\| .*\\)#\\1#" ) diff --git a/macros.hpc-gnu b/macros.hpc-gnu index 0f9e77e..244e3c8 100644 --- a/macros.hpc-gnu +++ b/macros.hpc-gnu @@ -9,9 +9,9 @@ %{-v: %define _cf_ver %{-v*}} \ %{echo: hpc_gnu_init %{?_cf_ver:version: %_cf_ver}} \ %{expand: %%global hpc_gnu_bin_version %{?_cf_ver:-%(\\\ - echo %_cf_ver | \\\ + v=%_cf_ver; [ $v -lt 40 ] && echo $v || \\\ sed -e "s@\\([0-9]\\)@\\1.@g" \\\ - -e "s@\\([0-9]\\)\\.\\$@\\1@g")}%{!?_cf_ver:%%{nil}}} \ + -e "s@\\([0-9]\\)\\.\\$@\\1@g" <<< $v)}%{!?_cf_ver:%%{nil}}} \ %{expand: %%global hpc_gnu_full_version %(\\\ gcc%{hpc_gnu_bin_version} --version |\\\ head -1 |\\\