From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net,
edumazet@google.com
Subject: [patch net-next] tools: ynl-gen: add "spec" arg to regen allowing to use only selected spec
Date: Tue, 22 Aug 2023 13:50:00 +0200 [thread overview]
Message-ID: <20230822115000.2471206-1-jiri@resnulli.us> (raw)
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(+)
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
--
2.41.0
next reply other threads:[~2023-08-22 11:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-22 11:50 Jiri Pirko [this message]
2023-08-22 17:09 ` [patch net-next] tools: ynl-gen: add "spec" arg to regen allowing to use only selected spec Jakub Kicinski
2023-08-22 17:41 ` Jiri Pirko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230822115000.2471206-1-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).