diff mbox series

[auh,2/4] steps: skip duplicate changelog for shared-source variants

Message ID 20260918120342.772566-2-daniel.turull@ericsson.com
State New
Headers show
Series [auh,1/4] steps: deduplicate same version in subject | expand

Commit Message

Daniel Turull Sept. 18, 2026, 12:03 p.m. UTC
From: Daniel Turull <daniel.turull@ericsson.com>

- Recipe groups sharing one upstream source (e.g. mesa, mesa-native,
  mesa-tools-native) ran 'devtool upgrade' once per variant, each
  re-extracting the same changelog and appending it to the group
  commit message, duplicating it once per variant.
- Only fetch/attach the changelog for the first pkg in the group;
  -native/-tools-native variants still get upgraded but no longer
  duplicate the changelog text.

Assisted-by: kiro:claude-sonnet-5
Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
---
 modules/steps.py | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/modules/steps.py b/modules/steps.py
index 20a213a..b95472d 100644
--- a/modules/steps.py
+++ b/modules/steps.py
@@ -110,14 +110,18 @@  def _append_changelog_to_commit_msg(group, opts):
         group['commit_msg'] += "\n\n" + text
 
 
-def _devtool_upgrade(devtool, bb, git, opts, pkg_ctx, workdir):
+def _devtool_upgrade(devtool, bb, git, opts, pkg_ctx, workdir, want_changelog):
     try:
         devtool_output = devtool.upgrade(pkg_ctx['PN'], pkg_ctx['NPV'], pkg_ctx['NSRCREV'])
         D(" 'devtool upgrade' printed:\n%s" %(devtool_output))
-        # Copy changelog before checking for conflicts — it's useful even on failure
-        changelog_text = _get_changelog(pkg_ctx['PN'], workdir)
-        if changelog_text:
-            pkg_ctx['changelog_text'] = changelog_text
+        # Copy changelog before checking for conflicts — it's useful even on failure.
+        # Only for the first pkg in the group: -native/-tools-native variants share
+        # the same upstream source, so their changelog is identical and would
+        # otherwise be duplicated into the commit message once per variant.
+        if want_changelog:
+            changelog_text = _get_changelog(pkg_ctx['PN'], workdir)
+            if changelog_text:
+                pkg_ctx['changelog_text'] = changelog_text
         # If devtool failed to rebase patches, it does not fail, but we should
         if 'conflict' in devtool_output:
             raise DevtoolError("Running 'devtool upgrade' for recipe %s failed." %(pkg_ctx['PN']), devtool_output)
@@ -136,8 +140,8 @@  def _devtool_upgrade(devtool, bb, git, opts, pkg_ctx, workdir):
 
 
 def devtool_upgrade(devtool, bb, git, opts, group):
-    for p in group['pkgs']:
-        _devtool_upgrade(devtool, bb, git, opts, p, group['workdir'])
+    for i, p in enumerate(group['pkgs']):
+        _devtool_upgrade(devtool, bb, git, opts, p, group['workdir'], i == 0)
     _append_changelog_to_commit_msg(group, opts)