public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: Ali Alnubani <alialnu@nvidia.com>
To: <dev@dpdk.org>
Cc: <david.marchand@redhat.com>
Subject: [PATCH v2] devtools: fix symbol change check for non-lib patches
Date: Thu, 5 Mar 2026 12:50:16 +0200	[thread overview]
Message-ID: <20260305105016.1093351-1-alialnu@nvidia.com> (raw)
In-Reply-To: <20260305091039.1057276-1-alialnu@nvidia.com>

Handle patches that do not touch lib/drivers (e.g. doc-only) without
crashing. Treat every '--- a/' line as the start of a new file: if the
path is under lib/ or drivers/, set lib and process symbol lines;
otherwise set lib to None and ignore lines until the next file. This
avoids both NameError exceptions and misattributing export-like lines
from doc (or other) files to the previous lib when file order varies.

Fixes: 1a0c104a7fa9 ("build: generate symbol maps")
Cc: david.marchand@redhat.com

Suggested-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
---

v2:
Treat every '--- a/' as a new file: set lib only for paths under lib/
or drivers/, otherwise set lib to None and skip lines until the next
file, so behavior no longer depends on patch file order.

 devtools/check-symbol-change.py | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/devtools/check-symbol-change.py b/devtools/check-symbol-change.py
index 1efeb82fcd..a476ceae5e 100755
--- a/devtools/check-symbol-change.py
+++ b/devtools/check-symbol-change.py
@@ -29,17 +29,21 @@
 symbols = {}
 
 for file in args.patch:
+    lib = None
     for ln in file.readlines():
-        if file_header_regexp.match(ln):
-            if file_header_regexp.match(ln).group(2) == "lib":
-                lib = "/".join(file_header_regexp.match(ln).group(2, 3))
-            elif file_header_regexp.match(ln).group(3) == "intel":
-                lib = "/".join(file_header_regexp.match(ln).group(2, 3, 4))
+        if ln.startswith("--- a/"):
+            if file_header_regexp.match(ln):
+                m = file_header_regexp.match(ln)
+                if m.group(2) == "lib":
+                    lib = "/".join(m.group(2, 3))
+                elif m.group(3) == "intel":
+                    lib = "/".join(m.group(2, 3, 4))
+                else:
+                    lib = "/".join(m.group(2, 3))
+                if lib not in symbols:
+                    symbols[lib] = {}
             else:
-                lib = "/".join(file_header_regexp.match(ln).group(2, 3))
-
-            if lib not in symbols:
-                symbols[lib] = {}
+                lib = None
             continue
 
         if export_exp_sym_regexp.match(ln):
@@ -54,6 +58,8 @@
         else:
             continue
 
+        if lib is None:
+            continue
         if symbol not in symbols[lib]:
             symbols[lib][symbol] = {}
         added = ln[0] == "+"
-- 
2.53.0


  parent reply	other threads:[~2026-03-05 10:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05  9:10 [PATCH] devtools: fix symbol change check for non-lib patches Ali Alnubani
2026-03-05 10:10 ` David Marchand
2026-03-05 10:50 ` Ali Alnubani [this message]
2026-03-05 13:50   ` [PATCH v2] " David Marchand
2026-03-09 15:08   ` [PATCH v3] " Ali Alnubani
2026-03-17 15:45     ` David Marchand

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=20260305105016.1093351-1-alialnu@nvidia.com \
    --to=alialnu@nvidia.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox