[v7,02/17] buildtools: fix build with busybox

Message ID 20210319145730.3555384-3-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series Alpine/musl build support |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Thomas Monjalon March 19, 2021, 2:57 p.m. UTC
  If using busybox for mktemp and awk (as in Alpine),
some bugs prevent the script from running:

1/ It seems busybox mktemp requires the pattern to have at least
6 X and no other suffix.
The same has been fixed for other scripts in the past:
commit 3771edc35438 ("buildtools: fix build for some mktemp")

2/ It seems busybox awk does not accept the regex ^.*{
except if the opening curly brace is escaped.

Fixes: 4c82473412e8 ("build: add internal tag check")
Fixes: 68b1f1cda5b4 ("build: check AVX512 rather than binutils version")
Fixes: 3290ac14eb94 ("buildtools: detect discrepancies for experimental symbols")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
 buildtools/binutils-avx512-check.sh | 2 +-
 buildtools/check-symbols.sh         | 2 +-
 buildtools/map-list-symbol.sh       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
  

Comments

Ray Kinsella March 22, 2021, 8:52 a.m. UTC | #1
On 19/03/2021 14:57, Thomas Monjalon wrote:
> If using busybox for mktemp and awk (as in Alpine),
> some bugs prevent the script from running:
> 
> 1/ It seems busybox mktemp requires the pattern to have at least
> 6 X and no other suffix.
> The same has been fixed for other scripts in the past:
> commit 3771edc35438 ("buildtools: fix build for some mktemp")
> 
> 2/ It seems busybox awk does not accept the regex ^.*{
> except if the opening curly brace is escaped.
> 
> Fixes: 4c82473412e8 ("build: add internal tag check")
> Fixes: 68b1f1cda5b4 ("build: check AVX512 rather than binutils version")
> Fixes: 3290ac14eb94 ("buildtools: detect discrepancies for experimental symbols")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Acked-by: David Marchand <david.marchand@redhat.com>
> ---
>  buildtools/binutils-avx512-check.sh | 2 +-
>  buildtools/check-symbols.sh         | 2 +-
>  buildtools/map-list-symbol.sh       | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/buildtools/binutils-avx512-check.sh b/buildtools/binutils-avx512-check.sh
> index a7e068140f..2a833b64b7 100755
> --- a/buildtools/binutils-avx512-check.sh
> +++ b/buildtools/binutils-avx512-check.sh
> @@ -3,7 +3,7 @@
>  # Copyright(c) 2020 Intel Corporation
>  
>  AS=${AS:-as}
> -OBJFILE=$(mktemp -t dpdk.binutils-check.XXXXXX.o)
> +OBJFILE=$(mktemp -t dpdk.binutils-check.XXXXXX)
>  trap 'rm -f "$OBJFILE"' EXIT
>  # from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028
>  GATHER_PARAMS='0x8(,%ymm1,1),%ymm0{%k2}'
> diff --git a/buildtools/check-symbols.sh b/buildtools/check-symbols.sh
> index e407553a34..6723e38450 100755
> --- a/buildtools/check-symbols.sh
> +++ b/buildtools/check-symbols.sh
> @@ -18,7 +18,7 @@ then
>  	exit 0
>  fi
>  
> -DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXX.objdump)
> +DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXXXXX)

Does it make sense to change it to

DUMPFILE=$(mktemp -t dpdk.${0##*/}.objdump.XXXXXX) 

So we can preserve what the file is in the filename?

>  trap 'rm -f "$DUMPFILE"' EXIT
>  objdump -t $OBJFILE >$DUMPFILE
>  
> diff --git a/buildtools/map-list-symbol.sh b/buildtools/map-list-symbol.sh
> index 5509b4a7fa..3bf9bd66f8 100755
> --- a/buildtools/map-list-symbol.sh
> +++ b/buildtools/map-list-symbol.sh
> @@ -44,7 +44,7 @@ for file in $@; do
>  			ret = 1;
>  		}
>  	}
> -	/^.*{/ {
> +	/^.*\{/ {
>  		if ("'$section'" == "all" || $1 == "'$section'") {
>  			current_section = $1;
>  		}
>
  
Thomas Monjalon March 22, 2021, 8:55 a.m. UTC | #2
22/03/2021 09:52, Kinsella, Ray:
> On 19/03/2021 14:57, Thomas Monjalon wrote:
> > --- a/buildtools/check-symbols.sh
> > +++ b/buildtools/check-symbols.sh
> > -DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXX.objdump)
> > +DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXXXXX)
> 
> Does it make sense to change it to
> 
> DUMPFILE=$(mktemp -t dpdk.${0##*/}.objdump.XXXXXX)
> 
> So we can preserve what the file is in the filename?

Yes could be.
There is already the name of the script in the temp filename,
but I am OK to add more details.

If there is no other comment, I will change when applying.
  
Ray Kinsella March 22, 2021, 9:01 a.m. UTC | #3
On 22/03/2021 08:55, Thomas Monjalon wrote:
> 22/03/2021 09:52, Kinsella, Ray:
>> On 19/03/2021 14:57, Thomas Monjalon wrote:
>>> --- a/buildtools/check-symbols.sh
>>> +++ b/buildtools/check-symbols.sh
>>> -DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXX.objdump)
>>> +DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXXXXX)
>>
>> Does it make sense to change it to
>>
>> DUMPFILE=$(mktemp -t dpdk.${0##*/}.objdump.XXXXXX)
>>
>> So we can preserve what the file is in the filename?
> 
> Yes could be.
> There is already the name of the script in the temp filename,
> but I am OK to add more details.
> 
> If there is no other comment, I will change when applying.
> 
Nothing from me ...
  

Patch

diff --git a/buildtools/binutils-avx512-check.sh b/buildtools/binutils-avx512-check.sh
index a7e068140f..2a833b64b7 100755
--- a/buildtools/binutils-avx512-check.sh
+++ b/buildtools/binutils-avx512-check.sh
@@ -3,7 +3,7 @@ 
 # Copyright(c) 2020 Intel Corporation
 
 AS=${AS:-as}
-OBJFILE=$(mktemp -t dpdk.binutils-check.XXXXXX.o)
+OBJFILE=$(mktemp -t dpdk.binutils-check.XXXXXX)
 trap 'rm -f "$OBJFILE"' EXIT
 # from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028
 GATHER_PARAMS='0x8(,%ymm1,1),%ymm0{%k2}'
diff --git a/buildtools/check-symbols.sh b/buildtools/check-symbols.sh
index e407553a34..6723e38450 100755
--- a/buildtools/check-symbols.sh
+++ b/buildtools/check-symbols.sh
@@ -18,7 +18,7 @@  then
 	exit 0
 fi
 
-DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXX.objdump)
+DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXXXXX)
 trap 'rm -f "$DUMPFILE"' EXIT
 objdump -t $OBJFILE >$DUMPFILE
 
diff --git a/buildtools/map-list-symbol.sh b/buildtools/map-list-symbol.sh
index 5509b4a7fa..3bf9bd66f8 100755
--- a/buildtools/map-list-symbol.sh
+++ b/buildtools/map-list-symbol.sh
@@ -44,7 +44,7 @@  for file in $@; do
 			ret = 1;
 		}
 	}
-	/^.*{/ {
+	/^.*\{/ {
 		if ("'$section'" == "all" || $1 == "'$section'") {
 			current_section = $1;
 		}