All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scripts: add tool to generate a layer overview
@ 2021-04-30 14:23 Ross Burton
  0 siblings, 0 replies; only message in thread
From: Ross Burton @ 2021-04-30 14:23 UTC (permalink / raw)
  To: meta-arm

Change-Id: Icb4e29d80f1db9791ce801910563695c9fdc76b3
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 scripts/layer-overview.py | 52 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100755 scripts/layer-overview.py

diff --git a/scripts/layer-overview.py b/scripts/layer-overview.py
new file mode 100755
index 0000000..24a9a5b
--- /dev/null
+++ b/scripts/layer-overview.py
@@ -0,0 +1,52 @@
+#! /usr/bin/env python3
+
+"""
+Print an overview of the layer to help writing release notes.
+
+Output includes sublayers, machines, recipes.
+"""
+
+# TODO:
+# - More human-readable output
+# - Diff mode, give two revisions and list the changes
+# - Support finding no sublayers, meaning the path is a single layer
+
+import argparse
+parser = argparse.ArgumentParser()
+parser.add_argument("repository")
+parser.add_argument("revision", nargs="?")
+args = parser.parse_args()
+
+if args.revision:
+    import gitpathlib
+    base = gitpathlib.GitPath(args.repository, args.revision)
+else:
+    import pathlib
+    base = pathlib.Path(args.repository)
+
+print("Sub-Layers")
+sublayers = sorted(p for p in base.glob("meta-*") if p.is_dir())
+for l in sublayers:
+    print(f" {l.name}")
+print()
+
+for layer in sublayers:
+    print(layer.name)
+
+    machines = sorted(p for p in layer.glob("conf/machine/*.conf"))
+    if machines:
+        print(" Machines")
+        for m in machines:
+            print(f"  {m.stem}")
+        print()
+
+    recipes = sorted((p for p in layer.glob("recipes-*/*/*.bb")), key=lambda p:p.name)
+    if recipes:
+        print(" Recipes")
+        for r in recipes:
+            if "_" in r.stem:
+                pn, pv = r.stem.rsplit("_", 1)
+                print(f"  {pn} {pv}")
+            else:
+                print(f"  {r.stem}")
+        print()
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-30 14:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-30 14:23 [PATCH] scripts: add tool to generate a layer overview Ross Burton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.