rust: Use grep -Ev rather than relying on GNU grep
PATCH 1/1 rust: Use grep -Ev rather than relying on GNU grep
While GNU grep supports '\|' when in basic regular expression mode, not all grep implementations do (notably toybox grep, used to build the Android kernel, does not). Switching to grep -Ev enables extended regular expresions which includes support for the '|' operator.
--- rust/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
rust/Makefile +2 -2
@@ -336,13 +336,13 @@ quiet_cmd_bindgen = BINDGEN $@ $(bindgen_target_cflags) $(bindgen_target_extra) $(obj)/bindings/bindings_generated.rs: private bindgen_target_flags = \ - $(shell grep -v '^#\|^$$' $(srctree)/$(src)/bindgen_parameters) + $(shell grep -Ev '^#|^$$' $(srctree)/$(src)/bindgen_parameters) $(obj)/bindings/bindings_generated.rs: $(src)/bindings/bindings_helper.h \ $(src)/bindgen_parameters FORCE $(call if_changed_dep,bindgen) $(obj)/uapi/uapi_generated.rs: private bindgen_target_flags = \ - $(shell grep -v '^#\|^$$' $(srctree)/$(src)/bindgen_parameters) + $(shell grep -Ev '^#|^$$' $(srctree)/$(src)/bindgen_parameters) $(obj)/uapi/uapi_generated.rs: $(src)/uapi/uapi_helper.h \ $(src)/bindgen_parameters FORCE $(call if_changed_dep,bindgen)
Signature · 1 line
2.42.0.582.g8ccd20d70d-goog
Quoted 8 lines · Matthew Maurer
While GNU grep supports '\|' when in basic regular expression mode, not all grep implementations do (notably toybox grep, used to build the Android kernel, does not). Switching to grep -Ev enables extended regular expresions which includes support for the '|' operator.
Signed-off-by Matthew Maurer <[email protected]>---
Quoted 8 lines · Matthew Maurer
While GNU grep supports '\|' when in basic regular expression mode, not all grep implementations do (notably toybox grep, used to build the Android kernel, does not). Switching to grep -Ev enables extended regular expresions which includes support for the '|' operator.
Signed-off-by Matthew Maurer <[email protected]>---
[...]
Quoted 7 lines · Matthew Maurer
While GNU grep supports '\|' when in basic regular expression mode, not all grep implementations do (notably toybox grep, used to build the Android kernel, does not). Switching to grep -Ev enables extended regular expresions which includes support for the '|' operator.
Signed-off-by Matthew Maurer <[email protected]>
LGTM. I tested this in my Android build.
Alice Ryhl
reviewerQuoted 11 lines · Alice Ryhl
Quoted 7 lines · Matthew Maurer
While GNU grep supports '\|' when in basic regular expression mode, not all grep implementations do (notably toybox grep, used to build the Android kernel, does not). Switching to grep -Ev enables extended regular expresions which includes support for the '|' operator.
Signed-off-by Matthew Maurer <[email protected]>LGTM. I tested this in my Android build.
Also tested in a non-Android build. Works both places.
Quoted 2 lines
Reviewed-by Alice Ryhl <[email protected]>Tested-by Alice Ryhl <[email protected]>
Miguel Ojeda
AppliedQuoted 7 lines · Matthew Maurer
While GNU grep supports '\|' when in basic regular expression mode, not all grep implementations do (notably toybox grep, used to build the Android kernel, does not). Switching to grep -Ev enables extended regular expresions which includes support for the '|' operator.
Signed-off-by Matthew Maurer <[email protected]>
Applied to rust-next (with typo fixed) -- thanks everyone!
Cheers,
Miguel