diff mbox series

[net-next] tools: ynl-gen: add "spec" arg to regen allowing to use only selected spec

Message ID 20230822115000.2471206-1-jiri@resnulli.us (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series [net-next] tools: ynl-gen: add "spec" arg to regen allowing to use only selected spec | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 9 this patch: 9
netdev/cc_maintainers warning 1 maintainers not CCed: sdf@google.com
netdev/build_clang success Errors and warnings before: 9 this patch: 9
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 9 this patch: 9
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 23 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jiri Pirko Aug. 22, 2023, 11:50 a.m. UTC
From: Jiri Pirko <jiri@nvidia.com>

ynl-regen git greps and re-generates all generated files. Introduce a
command line argument "spec" allowing the user to specify only one yaml
spec file to use as a source of re-generation.

Example:
$ tools/net/ynl/ynl-regen.sh -s Documentation/netlink/specs/devlink.yaml -f
	GEN kernel	net/devlink/netlink_gen.c
	GEN kernel	net/devlink/netlink_gen.h
	GEN user	tools/net/ynl/generated/devlink-user.c
	GEN user	tools/net/ynl/generated/devlink-user.h

This is handy while working on a specific spec.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
 tools/net/ynl/ynl-regen.sh | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Jakub Kicinski Aug. 22, 2023, 5:09 p.m. UTC | #1
On Tue, 22 Aug 2023 13:50:00 +0200 Jiri Pirko wrote:
> $ tools/net/ynl/ynl-regen.sh -s Documentation/netlink/specs/devlink.yaml -f

touch Documentation/netlink/specs/devlink.yaml && ./tools/net/ynl/ynl-regen.sh

?
Jiri Pirko Aug. 22, 2023, 5:41 p.m. UTC | #2
Tue, Aug 22, 2023 at 07:09:40PM CEST, kuba@kernel.org wrote:
>On Tue, 22 Aug 2023 13:50:00 +0200 Jiri Pirko wrote:
>> $ tools/net/ynl/ynl-regen.sh -s Documentation/netlink/specs/devlink.yaml -f
>
>touch Documentation/netlink/specs/devlink.yaml && ./tools/net/ynl/ynl-regen.sh

Ah, leveraging the skip. Okay, makes sense.

>
>?
diff mbox series

Patch

diff --git a/tools/net/ynl/ynl-regen.sh b/tools/net/ynl/ynl-regen.sh
index bdba24066cf1..ee77f6fcad60 100755
--- a/tools/net/ynl/ynl-regen.sh
+++ b/tools/net/ynl/ynl-regen.sh
@@ -5,11 +5,13 @@  TOOL=$(dirname $(realpath $0))/ynl-gen-c.py
 
 force=
 search=
+spec=
 
 while [ ! -z "$1" ]; do
   case "$1" in
     -f ) force=yes; shift ;;
     -p ) search=$2; shift 2 ;;
+    -s ) spec=$2; shift 2 ;;
     * )  echo "Unrecognized option '$1'"; exit 1 ;;
   esac
 done
@@ -24,6 +26,10 @@  for f in $files; do
     params=( $(git grep -B1 -h '/\* YNL-GEN' $f | sed 's@/\*\(.*\)\*/@\1@') )
     args=$(sed -n 's@/\* YNL-ARG \(.*\) \*/@\1@p' $f)
 
+    if [ ! -z "$spec" -a "$spec" != "${params[0]}" ]; then
+	continue
+    fi
+
     if [ $f -nt ${params[0]} -a -z "$force" ]; then
 	echo -e "\tSKIP $f"
 	continue