All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ross Burton <ross.burton@arm.com>
To: meta-arm@lists.yoctoproject.org
Subject: [PATCH 2/6] scripts/machine-summary: harvest more patch data
Date: Wed, 19 Jan 2022 21:20:46 +0000	[thread overview]
Message-ID: <20220119212050.1886613-2-ross.burton@arm.com> (raw)
In-Reply-To: <20220119212050.1886613-1-ross.burton@arm.com>

Instead of just putting whether there are patches or not into the
context, store the list of patches, the layer they came from, and the
upstream status.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 scripts/machine-summary.py | 30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/scripts/machine-summary.py b/scripts/machine-summary.py
index 7d2eb53f..e0c7870d 100755
--- a/scripts/machine-summary.py
+++ b/scripts/machine-summary.py
@@ -1,9 +1,10 @@
 #! /usr/bin/env python3
 
-import os
-import sys
 import argparse
 import datetime
+import os
+import re
+import sys
 
 import jinja2
 
@@ -42,8 +43,28 @@ def layer_path(layername, d):
             return path
     return None
 
+def extract_patch_info(src_uri, d):
+    """
+    Parse the specified patch entry from a SRC_URI and return (base name, layer name, status) tuple
+    """
+    import bb.fetch, bb.utils
+
+    info = {}
+    localpath = bb.fetch.decodeurl(src_uri)[2]
+    info["name"] = os.path.basename(localpath)
+    info["layer"] = bb.utils.get_file_layer(localpath, d)
+
+    status = "Unknown"
+    with open(localpath, errors="ignore") as f:
+        m = re.search(r"^[\t ]*Upstream[-_ ]Status:?[\t ]*(\w*)", f.read(), re.IGNORECASE | re.MULTILINE)
+        if m:
+            # TODO: validate
+            status = m.group(1)
+    info["status"] = status
+    return info
+
 def harvest_data(machines, recipes):
-    import bb.tinfoil, bb.utils
+    import bb.tinfoil
     with bb.tinfoil.Tinfoil() as tinfoil:
         tinfoil.prepare(config_only=True)
         corepath = layer_path("core", tinfoil.config_data)
@@ -83,7 +104,8 @@ def harvest_data(machines, recipes):
                 details = versions[machine][recipe] = {}
                 details["recipe"] = d.getVar("PN")
                 details["version"] = trim_pv(d.getVar("PV"))
-                details["patched"] = bool(oe.patch.src_patches(d))
+                details["patches"] = [extract_patch_info(p, d) for p in oe.patch.src_patches(d)]
+                details["patched"] = bool(details["patches"])
 
     # Now backfill the upstream versions
     for machine in versions:
-- 
2.25.1



  reply	other threads:[~2022-01-19 21:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19 21:20 [PATCH 1/6] scripts/layer-overview: improve layer detection Ross Burton
2022-01-19 21:20 ` Ross Burton [this message]
2022-01-19 21:20 ` [PATCH 3/6] scripts/machine-summary: refactor output to classes Ross Burton
2022-01-19 21:20 ` [PATCH 4/6] scripts/machine-summary: put more version information into the context Ross Burton
2022-01-19 21:20 ` [PATCH 5/6] scripts/machine-summary: write per-machine reports with more details Ross Burton
2022-01-19 21:20 ` [PATCH 6/6] CI: update for changes to machine-summary Ross Burton
2022-01-20  3:50 ` [PATCH 1/6] scripts/layer-overview: improve layer detection Jon Mason

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=20220119212050.1886613-2-ross.burton@arm.com \
    --to=ross.burton@arm.com \
    --cc=meta-arm@lists.yoctoproject.org \
    /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 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.