Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] toolchain/external: better check for gcc-5
@ 2015-08-09 11:11 Yann E. MORIN
  2015-08-09 15:17 ` Thomas Petazzoni
  2015-08-09 18:13 ` Jörg Krause
  0 siblings, 2 replies; 3+ messages in thread
From: Yann E. MORIN @ 2015-08-09 11:11 UTC (permalink / raw)
  To: buildroot

gcc will always report a three-digit version sting, like 4.9.3 or 5.1.0.

For gcc before 5, we want to check the first two digits, while starting
with gcc 5, we are only concerned about the first digit.

So, change our matching code to test for the leading part of the version
string, up to the first dot after as-many version digit we're interested
in.

Note: we're adding the dot in the .mk code rather than in the Kconfig
symbol, because it seemed cleaner to do so.

Reported-by: J?rg Krause <joerg.krause@embedded.rocks>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 toolchain/helpers.mk | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 018f3ed..7c70d35 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -191,16 +191,12 @@ check_kernel_headers_version = \
 #   - eat all the remaining chars on the line
 #   - replace by the matched expression
 #
-# - s/\.[[:digit:]]+$//
-#   - eat a dot followed by as many digits as possible up to the end
-#     of line
-#   - replace with nothing
-#
 check_gcc_version = \
 	expected_version="$(strip $2)" ; \
-	real_version=`$(1) --version | sed -r -e '1!d; s/^[^)]+\) ([^[:space:]]+).*/\1/; s/\.[[:digit:]]+$$//;'` ; \
-	if [ "$${real_version}" != "$${expected_version}" ] ; then \
-		echo "Incorrect selection of gcc version: expected $${expected_version}, got $${real_version}" ; \
+	real_version=`$(1) --version | sed -r -e '1!d; s/^[^)]+\) ([^[:space:]]+).*/\1/;'` ; \
+	if [[ ! "$${real_version}" =~ ^$${expected_version}\. ]] ; then \
+		printf "Incorrect selection of gcc version: expected %s.x, got %s\n" \
+			"$${expected_version}" "$${real_version}" ; \
 		exit 1 ; \
 	fi
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] toolchain/external: better check for gcc-5
  2015-08-09 11:11 [Buildroot] [PATCH] toolchain/external: better check for gcc-5 Yann E. MORIN
@ 2015-08-09 15:17 ` Thomas Petazzoni
  2015-08-09 18:13 ` Jörg Krause
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2015-08-09 15:17 UTC (permalink / raw)
  To: buildroot

Dear Yann E. MORIN,

On Sun,  9 Aug 2015 13:11:42 +0200, Yann E. MORIN wrote:
> gcc will always report a three-digit version sting, like 4.9.3 or 5.1.0.
> 
> For gcc before 5, we want to check the first two digits, while starting
> with gcc 5, we are only concerned about the first digit.
> 
> So, change our matching code to test for the leading part of the version
> string, up to the first dot after as-many version digit we're interested
> in.
> 
> Note: we're adding the dot in the .mk code rather than in the Kconfig
> symbol, because it seemed cleaner to do so.
> 
> Reported-by: J?rg Krause <joerg.krause@embedded.rocks>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  toolchain/helpers.mk | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)

Applied, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] toolchain/external: better check for gcc-5
  2015-08-09 11:11 [Buildroot] [PATCH] toolchain/external: better check for gcc-5 Yann E. MORIN
  2015-08-09 15:17 ` Thomas Petazzoni
@ 2015-08-09 18:13 ` Jörg Krause
  1 sibling, 0 replies; 3+ messages in thread
From: Jörg Krause @ 2015-08-09 18:13 UTC (permalink / raw)
  To: buildroot

Dear Yann,

On So, 2015-08-09 at 13:11 +0200, Yann E. MORIN wrote:
> gcc will always report a three-digit version sting, like 4.9.3 or 
> 5.1.0.
> 
> For gcc before 5, we want to check the first two digits, while 
> starting
> with gcc 5, we are only concerned about the first digit.
> 
> So, change our matching code to test for the leading part of the 
> version
> string, up to the first dot after as-many version digit we're 
> interested
> in.
> 
> Note: we're adding the dot in the .mk code rather than in the Kconfig
> symbol, because it seemed cleaner to do so.
> 
> Reported-by: J?rg Krause <joerg.krause@embedded.rocks>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  toolchain/helpers.mk | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> index 018f3ed..7c70d35 100644
> --- a/toolchain/helpers.mk
> +++ b/toolchain/helpers.mk
> @@ -191,16 +191,12 @@ check_kernel_headers_version = \
>  #   - eat all the remaining chars on the line
>  #   - replace by the matched expression
>  #
> -# - s/\.[[:digit:]]+$//
> -#   - eat a dot followed by as many digits as possible up to the end
> -#     of line
> -#   - replace with nothing
> -#
>  check_gcc_version = \
>  	expected_version="$(strip $2)" ; \
> -	real_version=`$(1) --version | sed -r -e '1!d; s/^[^)]+\) 
> ([^[:space:]]+).*/\1/; s/\.[[:digit:]]+$$//;'` ; \
> -	if [ "$${real_version}" != "$${expected_version}" ] ; then \
> -		echo "Incorrect selection of gcc version: expected 
> $${expected_version}, got $${real_version}" ; \
> +	real_version=`$(1) --version | sed -r -e '1!d; s/^[^)]+\) 
> ([^[:space:]]+).*/\1/;'` ; \
> +	if [[ ! "$${real_version}" =~ ^$${expected_version}\. ]] ; 
> then \
> +		printf "Incorrect selection of gcc version: expected 
> %s.x, got %s\n" \
> +			"$${expected_version}" "$${real_version}" ; 
> \
>  		exit 1 ; \
>  	fi
>  

Many thanks! This works fine for my gcc 5.2.0 toolchain. Although, it
is already commited and applied:

Tested-by: J?rg Krause <joerg.krause@embedded.rocks>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-09 18:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-09 11:11 [Buildroot] [PATCH] toolchain/external: better check for gcc-5 Yann E. MORIN
2015-08-09 15:17 ` Thomas Petazzoni
2015-08-09 18:13 ` Jörg Krause

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox