numam-dpdk/buildtools/map-list-symbol.sh
Thomas Monjalon e1ab26df48 buildtools: fix build with busybox
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 3771edc354 ("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: 4c82473412 ("build: add internal tag check")
Fixes: 68b1f1cda5 ("build: check AVX512 rather than binutils version")
Fixes: 3290ac14eb ("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>
2021-03-23 08:39:11 +01:00

71 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2018 David Marchand <david.marchand@redhat.com>
section=all
symbol=all
quiet=
while getopts 'S:s:q' name; do
case $name in
S)
[ $section = 'all' ] || {
echo 'Cannot list in multiple sections'
exit 1
}
section=$OPTARG
;;
s)
[ $symbol = 'all' ] || {
echo 'Cannot list multiple symbols'
exit 1
}
symbol=$OPTARG
;;
q)
quiet='y'
;;
?)
echo 'usage: $0 [-S section] [-s symbol] [-q]'
exit 1
;;
esac
done
shift $(($OPTIND - 1))
for file in $@; do
cat "$file" |awk '
BEGIN {
current_section = "";
if ("'$section'" == "all" && "'$symbol'" == "all") {
ret = 0;
} else {
ret = 1;
}
}
/^.*\{/ {
if ("'$section'" == "all" || $1 == "'$section'") {
current_section = $1;
}
}
/.*}/ { current_section = ""; }
/^[^}].*[^:*];/ {
if (current_section != "") {
gsub(";","");
if ("'$symbol'" == "all" || $1 == "'$symbol'") {
ret = 0;
if ("'$quiet'" == "") {
print "'$file' "current_section" "$1;
}
if ("'$symbol'" != "all") {
exit 0;
}
}
}
}
END {
exit ret;
}'
done