diff mbox series

[2/3] devtool: upgrade: detect per-version release notes files

Message ID 20260512072446.2323529-3-daniel.turull@ericsson.com
State New
Headers show
Series devtool: add changelog extraction | expand

Commit Message

Daniel Turull May 12, 2026, 7:24 a.m. UTC
From: Daniel Turull <daniel.turull@ericsson.com>

Extend the changelog file detection loop to also match per-version
release notes files like git's Documentation/RelNotes/2.53.0.adoc
or mesa's docs/relnotes/26.0.3.rst.

These are detected by matching filenames that contain a version
number with a documentation extension (.txt, .md, .rst, .adoc).
Their full content is read via git show since they are new files
rather than modifications to an existing changelog.

Assisted-by: kiro:claude-opus-4.6
Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
---
 scripts/lib/devtool/upgrade.py | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index 6adaf5185e..f2a2c8a6fb 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -576,6 +576,12 @@  def _extract_changelog(srctree, pn, old_ver, new_ver, old_tag, new_tag, workspac
                     if lines:
                         changelog_content = '\n'.join(lines)
                         break
+            # Per-version release notes (e.g., git RelNotes/2.53.0.adoc, mesa relnotes/26.0.3.rst)
+            elif re.search(r'(\d+[.\-])+\d+\.(txt|md|rst|adoc)$', basename):
+                file_content, _ = _run('git show %s' % shlex.quote('%s:%s' % (new_tag, fname)), srctree)
+                if file_content.strip():
+                    changelog_content = file_content.strip()
+                    break
     except bb.process.ExecutionError as e:
         logger.warning('Changelog file extraction failed: %s' % str(e))