Messages in this thread Patch in this message | | | Subject | Re: [PATCH] rust: Use awk instead of recent xargs | From | Joe Perches <> | Date | Fri, 29 Sep 2023 16:29:17 -0700 |
| |
On Fri, 2023-09-29 at 21:36 +0000, David Laight wrote: > From: Joe Perches > > Sent: 28 September 2023 21:33 > > > > On Thu, 2023-09-28 at 20:21 +0000, Matthew Maurer wrote: > > > `awk` is already required by the kernel build, and the `xargs` feature > > > used in current Rust detection is not present in all `xargs` (notably, > > > toybox based xargs, used in the Android kernel build). > > [] > > > diff --git a/rust/Makefile b/rust/Makefile > > [] > > > @@ -365,8 +365,7 @@ quiet_cmd_exports = EXPORTS $@ > > > cmd_exports = \ > > > $(NM) -p --defined-only $< \ > > > | grep -E ' (T|R|D) ' | cut -d ' ' -f 3 \ > > > - | xargs -Isymbol \ > > > - echo 'EXPORT_SYMBOL_RUST_GPL(symbol);' > $@ > > > + | awk 'NF {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$0}' > $@ > > > > Perhaps remove the cut as well and use $$3 instead of $$0 ? > > Maybe integrate the grep as well. > > Or keep the grep and use a shell loop? > grep -E ' (T|R|D) ' | while read val flag symbol; do \ > echo "EXPORT_SYMBOL_RUST_GPL($symbol);"; done > > (The grep is typically much faster than a shell conditional.) >
Bikeshed:
no grep just a single awk with whatever the appropriate syntax is like
awk '{ if ($$2 ~ /^[TRD]$/) { printf "EXPORT_SYMBOL_RUST(%s);\n", $$3 } }'
| |