public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scripts: generate_rust_analyzer.py: define scripts
@ 2026-01-22 16:53 Tamir Duberstein
  2026-01-26  2:09 ` Miguel Ojeda
  0 siblings, 1 reply; 9+ messages in thread
From: Tamir Duberstein @ 2026-01-22 16:53 UTC (permalink / raw)
  To: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Kees Cook, David Gow, Alex Gaynor,
	Wedson Almeida Filho
  Cc: rust-for-linux, linux-kernel, stable, Daniel Almeida,
	Fiona Behrens, Tamir Duberstein

Generate rust-project.json entries for scripts written in Rust.

Use `Pathlib.path.stem` for consistency.

Fixes: 9a8ff24ce584 ("scripts: add `generate_rust_target.rs`")
Cc: stable@vger.kernel.org
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Tested-by: Daniel Almeida <daniel.almeida@collabora.com>
Reviewed-by: Fiona Behrens <me@kloenk.dev>
Reviewed-by: Trevor Gross <tmgross@umich.edu>
Signed-off-by: Tamir Duberstein <tamird@kernel.org>
---
 scripts/generate_rust_analyzer.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
index 3b645da90092..650535f2228d 100755
--- a/scripts/generate_rust_analyzer.py
+++ b/scripts/generate_rust_analyzer.py
@@ -188,6 +188,18 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs, core_edit
     append_crate_with_generated("uapi", ["core", "ffi", "pin_init"])
     append_crate_with_generated("kernel", ["core", "macros", "build_error", "pin_init", "ffi", "bindings", "uapi"])
 
+    scripts = srctree / "scripts"
+    makefile = (scripts / "Makefile").read_text()
+    for path in scripts.glob("*.rs"):
+        name = path.stem
+        if f"{name}-rust" not in makefile:
+            continue
+        append_crate(
+            name,
+            path,
+            deps=["std"],
+        )
+
     def is_root_crate(build_file, target):
         try:
             return f"{target}.o" in open(build_file).read()
@@ -203,7 +215,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs, core_edit
     for folder in extra_dirs:
         for path in folder.rglob("*.rs"):
             logging.info("Checking %s", path)
-            name = path.name.replace(".rs", "")
+            name = path.stem
 
             # Skip those that are not crate roots.
             if not is_root_crate(path.parent / "Makefile", name) and \

---
base-commit: 2af6ad09fc7dfe9b3610100983cccf16998bf34d
change-id: 20260122-rust-analyzer-scripts-39e673a918ff

Best regards,
--  
Tamir Duberstein <tamird@kernel.org>


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-03-02 16:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-22 16:53 [PATCH] scripts: generate_rust_analyzer.py: define scripts Tamir Duberstein
2026-01-26  2:09 ` Miguel Ojeda
2026-01-27 13:53   ` Tamir Duberstein
2026-01-27 15:13     ` Miguel Ojeda
2026-01-27 17:07       ` Tamir Duberstein
2026-01-30 20:14         ` Tamir Duberstein
2026-01-30 20:22           ` Miguel Ojeda
2026-01-30 20:25             ` Tamir Duberstein
2026-03-02 16:25               ` Tamir Duberstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox