diff mbox series

toolchain: adjust version check to allow for single numbers

Message ID 20200610235313.204905-1-nolange79@gmail.com
State Accepted
Headers show
Series toolchain: adjust version check to allow for single numbers | expand

Commit Message

Norbert Lange June 10, 2020, 11:53 p.m. UTC
A gcc compiler, which was configured with
--with-gcc-major-version-only, will only return a single
number. (debian does this for example).

A simple modification allows the check to work with both
single numbers (eg. '9') and full versions (eg. '9.2.1').

Signed-off-by: Norbert Lange <nolange79@gmail.com>
---
 toolchain/helpers.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Romain Naour June 14, 2020, 6:30 p.m. UTC | #1
Hi,

Le 11/06/2020 à 01:53, Norbert Lange a écrit :
> A gcc compiler, which was configured with
> --with-gcc-major-version-only, will only return a single
> number. (debian does this for example).

This option is available since gcc 8:

https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=3c36aa6ba2be894d4092a6ce8129d39ef846c964

So older toolchain always provide a full version.

Reviewed-by: Romain Naour <romain.naour@gmail.com>

Best regards,
Romain

> 
> A simple modification allows the check to work with both
> single numbers (eg. '9') and full versions (eg. '9.2.1').
> 
> Signed-off-by: Norbert Lange <nolange79@gmail.com>
> ---
>  toolchain/helpers.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> index 44d0c83d1e..17bc159f3e 100644
> --- a/toolchain/helpers.mk
> +++ b/toolchain/helpers.mk
> @@ -184,7 +184,7 @@ check_gcc_version = \
>  		exit 0 ; \
>  	fi; \
>  	real_version=`$(1) -dumpversion` ; \
> -	if [[ ! "$${real_version}" =~ ^$${expected_version}\. ]] ; then \
> +	if [[ ! "$${real_version}." =~ ^$${expected_version}\. ]] ; then \
>  		printf "Incorrect selection of gcc version: expected %s.x, got %s\n" \
>  			"$${expected_version}" "$${real_version}" ; \
>  		exit 1 ; \
>
Yann E. MORIN June 14, 2020, 8:05 p.m. UTC | #2
Norbert, All,

On 2020-06-11 01:53 +0200, Norbert Lange spake thusly:
> A gcc compiler, which was configured with
> --with-gcc-major-version-only, will only return a single
> number. (debian does this for example).
> 
> A simple modification allows the check to work with both
> single numbers (eg. '9') and full versions (eg. '9.2.1').
> 
> Signed-off-by: Norbert Lange <nolange79@gmail.com>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
>  toolchain/helpers.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> index 44d0c83d1e..17bc159f3e 100644
> --- a/toolchain/helpers.mk
> +++ b/toolchain/helpers.mk
> @@ -184,7 +184,7 @@ check_gcc_version = \
>  		exit 0 ; \
>  	fi; \
>  	real_version=`$(1) -dumpversion` ; \
> -	if [[ ! "$${real_version}" =~ ^$${expected_version}\. ]] ; then \
> +	if [[ ! "$${real_version}." =~ ^$${expected_version}\. ]] ; then \
>  		printf "Incorrect selection of gcc version: expected %s.x, got %s\n" \
>  			"$${expected_version}" "$${real_version}" ; \
>  		exit 1 ; \
> -- 
> 2.26.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Peter Korsgaard July 13, 2020, 7:05 a.m. UTC | #3
>>>>> "Norbert" == Norbert Lange <nolange79@gmail.com> writes:

 > A gcc compiler, which was configured with
 > --with-gcc-major-version-only, will only return a single
 > number. (debian does this for example).

 > A simple modification allows the check to work with both
 > single numbers (eg. '9') and full versions (eg. '9.2.1').

 > Signed-off-by: Norbert Lange <nolange79@gmail.com>

Committed to 2020.02.x and 2020.05.x, thanks.
diff mbox series

Patch

diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 44d0c83d1e..17bc159f3e 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -184,7 +184,7 @@  check_gcc_version = \
 		exit 0 ; \
 	fi; \
 	real_version=`$(1) -dumpversion` ; \
-	if [[ ! "$${real_version}" =~ ^$${expected_version}\. ]] ; then \
+	if [[ ! "$${real_version}." =~ ^$${expected_version}\. ]] ; then \
 		printf "Incorrect selection of gcc version: expected %s.x, got %s\n" \
 			"$${expected_version}" "$${real_version}" ; \
 		exit 1 ; \