[v5,2/2] devtools: list symbols by version

Message ID 20231115104259.3045847-2-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series [v5,1/2] devtools: add check on symbol maps format |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

David Marchand Nov. 15, 2023, 10:42 a.m. UTC
  Make it easier to list experimental symbols added in a certain version.

Example:
$ ./buildtools/map-list-symbol.sh -V 18.11 lib/eal/version.map
lib/eal/version.map EXPERIMENTAL rte_dev_event_callback_process
lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_disable
lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_enable

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
 buildtools/map-list-symbol.sh | 39 ++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 14 deletions(-)
  

Comments

David Marchand Nov. 27, 2023, 7:37 a.m. UTC | #1
On Wed, Nov 15, 2023 at 11:43 AM David Marchand
<david.marchand@redhat.com> wrote:
>
> Make it easier to list experimental symbols added in a certain version.
>
> Example:
> $ ./buildtools/map-list-symbol.sh -V 18.11 lib/eal/version.map
> lib/eal/version.map EXPERIMENTAL rte_dev_event_callback_process
> lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_disable
> lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_enable
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>

Series applied, thanks.
  

Patch

diff --git a/buildtools/map-list-symbol.sh b/buildtools/map-list-symbol.sh
index 3bf9bd66f8..a834399816 100755
--- a/buildtools/map-list-symbol.sh
+++ b/buildtools/map-list-symbol.sh
@@ -6,7 +6,7 @@  section=all
 symbol=all
 quiet=
 
-while getopts 'S:s:q' name; do
+while getopts 'S:s:qV:' name; do
 	case $name in
 	S)
 		[ $section = 'all' ] || {
@@ -25,8 +25,11 @@  while getopts 'S:s:q' name; do
 	q)
 		quiet='y'
 	;;
+	V)
+		version=$OPTARG
+	;;
 	?)
-		echo 'usage: $0 [-S section] [-s symbol] [-q]'
+		echo 'usage: $0 [-S section] [-s symbol] [-V version] [-q]'
 		exit 1
 	;;
 	esac
@@ -38,7 +41,8 @@  for file in $@; do
 	cat "$file" |awk '
 	BEGIN {
 		current_section = "";
-		if ("'$section'" == "all" && "'$symbol'" == "all") {
+		current_version = "";
+		if ("'$section'" == "all" && "'$symbol'" == "all" && "'$version'" == "") {
 			ret = 0;
 		} else {
 			ret = 1;
@@ -49,18 +53,25 @@  for file in $@; do
 			current_section = $1;
 		}
 	}
-	/.*}/ { current_section = ""; }
+	/.*}/ { current_section = ""; current_version = ""; }
+	/^\t# added in / {
+		current_version=$4;
+	}
 	/^[^}].*[^:*];/ {
-		if (current_section != "") {
-			gsub(";","");
-			if ("'$symbol'" == "all" || $1 == "'$symbol'") {
-				ret = 0;
-				if ("'$quiet'" == "") {
-					print "'$file' "current_section" "$1;
-				}
-				if ("'$symbol'" != "all") {
-					exit 0;
-				}
+		if (current_section == "") {
+			next;
+		}
+		if ("'$version'" != "" && "'$version'" != current_version) {
+			next;
+		}
+		gsub(";","");
+		if ("'$symbol'" == "all" || $1 == "'$symbol'") {
+			ret = 0;
+			if ("'$quiet'" == "") {
+				print "'$file' "current_section" "$1;
+			}
+			if ("'$symbol'" != "all") {
+				exit 0;
 			}
 		}
 	}