From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id AC00F4307C;
	Wed, 16 Aug 2023 09:16:13 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 83B5840EF0;
	Wed, 16 Aug 2023 09:16:13 +0200 (CEST)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.129.124])
 by mails.dpdk.org (Postfix) with ESMTP id 2216340041
 for <dev@dpdk.org>; Wed, 16 Aug 2023 09:16:12 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1692170171;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=ffTtxlCEqecE/ByNKUBa9cW1IkSxbl6OkeDKoafIZ3k=;
 b=HoPWcxh8AaHcdN7fUPxp8CQj9jP+Y6hPPgyQCc0hqMUPjIAJ9nxmYrcjuELQcxVAwD0k1M
 UXpcAaNuXMP4RvH5Bgcq06CSTO9SqnhjDugMigHTLfbniMyYFA77mLcvk8zpAc2r20MylJ
 /PJ8i4NWq2m/czvKHh0jwlTnX4x2Wfc=
Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by
 relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 us-mta-595-3BtSOHIQNki8kh7TnIfshg-1; Wed, 16 Aug 2023 03:16:10 -0400
X-MC-Unique: 3BtSOHIQNki8kh7TnIfshg-1
Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com
 [10.11.54.10])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0FE811C068E0;
 Wed, 16 Aug 2023 07:16:10 +0000 (UTC)
Received: from dmarchan.redhat.com (unknown [10.45.226.19])
 by smtp.corp.redhat.com (Postfix) with ESMTP id 39C3F401E6A;
 Wed, 16 Aug 2023 07:16:09 +0000 (UTC)
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
 Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH v4 2/2] devtools: list symbols by version
Date: Wed, 16 Aug 2023 09:16:03 +0200
Message-ID: <20230816071603.1002271-2-david.marchand@redhat.com>
In-Reply-To: <20230816071603.1002271-1-david.marchand@redhat.com>
References: <20230811154944.2947783-1-david.marchand@redhat.com>
 <20230816071603.1002271-1-david.marchand@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="US-ASCII"; x-default=true
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

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(-)

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;
 			}
 		}
 	}
-- 
2.41.0