Skip to contentSkip to conversation

devtool: add annotations if the changelog is not well format

PATCH New [email protected] 1 participant 3 messages Oct 22

lore
Share & tools
lore
#0 lore raw

cover devtool: add annotations if the changelog is not well format

From: Daniel Turull <[email protected]>

Some components are difficult to extract the changelog and create badly formatted changelogs by devtool.

This series is a follow up on the first attempt in AUH and yocto-autobuilder-helper. We can remove components once the changelogs get better for them.

https://lists.yoctoproject.org/g/yocto-patches/topic/121846157?msg=5121#msg5121

A companion patch will be sent to AUH that reads the new parameter.

Daniel

Daniel Turull (2):
devtool: upgrade: flag badly formed changelogs in metadata maintainers.inc: add RECIPE_UPGRADE_CHANGELOG_SKIP

 meta/conf/distro/include/maintainers.inc | 29 ++++++++++++++++++++++++
 meta/lib/oeqa/selftest/cases/devtool.py  |  7 ++++--
 scripts/lib/devtool/upgrade.py           | 10 ++++++--
 3 files changed, 42 insertions(+), 4 deletions(-)
#1 lore raw

PATCH 1/2 devtool: upgrade: flag badly formed changelogs in metadata

From: Daniel Turull <[email protected]>

Some upstream changelogs are badly formed for use in a commit
message: whole release notes documents, raw git log dumps or markup banners. Whether that is the case is a property of the recipe, so let recipe metadata say so rather than each consumer keeping its own list.

Add RECIPE_UPGRADE_CHANGELOG_SKIP, a space separated list of recipe names (BPN). For listed recipes 'devtool upgrade' still extracts the changelog as before, but sets "changelog_skip": true in the changelogs/<pn>.json metadata so that tools such as AUH can leave it out of the commit message.

Extend the devtool upgrade selftest to check the new key.

Assisted-by kiro:claude-opus-5.5
---
 meta/lib/oeqa/selftest/cases/devtool.py |  7 +++++--
 scripts/lib/devtool/upgrade.py          | 10 ++++++++--
 2 files changed, 13 insertions(+), 4 deletions(-)
meta/lib/oeqa/selftest/cases/devtool.py +5 -2
index b848623a6e7..6156ad9840b 100644
@@ -2339,7 +2339,7 @@ class DevtoolUpgradeTests(DevtoolBase):
         except:
             self.skip("Git user.name and user.email must be set")
 
-    def _check_changelog(self, recipe, oldrecipefile, old_ver=None, new_ver=None):
+    def _check_changelog(self, recipe, oldrecipefile, old_ver=None, new_ver=None, changelog_skip=False):
         """Compare extracted changelog against reference data."""
         changelog_ref = oldrecipefile + '.changelog'
         self.assertExists(changelog_ref, 'Changelog reference file must exist for %s' % recipe)
@@ -2366,6 +2366,7 @@ class DevtoolUpgradeTests(DevtoolBase):
             if new_ver:
                 self.assertEqual(metadata.get('new_version'), new_ver)
             self.assertEqual(metadata.get('changelog_file'), '%s.txt' % recipe)
+            self.assertEqual(metadata.get('changelog_skip'), changelog_skip)
 
     def test_devtool_upgrade(self):
         # Check preconditions
@@ -2383,6 +2384,8 @@ class DevtoolUpgradeTests(DevtoolBase):
         oldrecipefile = get_bb_var('FILE', recipe)
         tempdir = tempfile.mkdtemp(prefix='devtoolqa')
         self.track_for_cleanup(tempdir)
+        # Flag the changelog as badly formed; checked in the JSON metadata below
+        self.append_config('RECIPE_UPGRADE_CHANGELOG_SKIP = "%s"' % recipe)
         # Check that recipe is not already under devtool control
         result = runCmd('devtool status')
         self.assertNotIn(recipe, result.output)
@@ -2407,7 +2410,7 @@ class DevtoolUpgradeTests(DevtoolBase):
             newlines = f.readlines()
         self.assertEqual(desiredlines, newlines)
         # Check changelog
-        self._check_changelog(recipe, oldrecipefile, old_version, version)
+        self._check_changelog(recipe, oldrecipefile, old_version, version, changelog_skip=True)
         # Check devtool reset recipe
         result = runCmd('devtool reset %s -n' % recipe)
         result = runCmd('devtool status')
scripts/lib/devtool/upgrade.py +8 -2
index ba7348664fd..6cec34d2d5a 100644
@@ -695,7 +695,8 @@ def _cleanup_changelog(content):
     return _join_single_line_paragraphs(text)
 
 
-def _extract_changelog(srctree, pn, old_ver, new_ver, old_tag, new_tag, workspace_path, is_git_source):
+def _extract_changelog(srctree, pn, old_ver, new_ver, old_tag, new_tag, workspace_path, is_git_source,
+                       changelog_skip=False):
     """Extract changelog between old and new version using devtool git tags."""
     changelog_content = None
     changelog_fname = None
@@ -803,6 +804,9 @@ def _extract_changelog(srctree, pn, old_ver, new_ver, old_tag, new_tag, workspac
         'new_version': new_ver,
         'changelog_file': os.path.basename(changelog_path),
         'changelog_source': changelog_fname.split(', ') if changelog_fname else None,
+        # Hint from RECIPE_UPGRADE_CHANGELOG_SKIP: changelog is badly formed
+        # for use in a commit message
+        'changelog_skip': changelog_skip,
     }
     metadata_path = os.path.join(changelog_dir, '%s.json' % pn)
     with open(metadata_path, 'w') as f:
@@ -898,9 +902,11 @@ def upgrade(args, config, basepath, workspace):
         is_git = old_srcrev is not None
         newpv = args.version or rd.getVar('PV')
         new_tag = 'devtool-base-new' if is_git else 'devtool-base-%s' % newpv
+        changelog_skip = rd.getVar('BPN') in (rd.getVar('RECIPE_UPGRADE_CHANGELOG_SKIP') or '').split()
         changelog_file = _extract_changelog(srctree, pn, old_ver, newpv,
                                             'devtool-base', new_tag,
-                                            config.workspace_path, is_git)
+                                            config.workspace_path, is_git,
+                                            changelog_skip)
         if changelog_file:
             logger.info('Changelog extracted to %s' % changelog_file)
             metadata_file = os.path.join(os.path.dirname(changelog_file), '%s.json' % pn)
#2 lore raw

PATCH 2/2 maintainers.inc: add RECIPE_UPGRADE_CHANGELOG_SKIP

In reply to [email protected]

From: Daniel Turull <[email protected]>

List the recipes whose changelog, as extracted by 'devtool upgrade', is badly formed for a commit message: whole release notes documents (mesa, gstreamer, cmake, python3), raw git log dumps (u-boot, openssh, acpica, freetype, vulkan-validation-layers, parted) or markup banners (expat).

devtool upgrade reads this variable and sets "changelog_skip": true in workspace/changelogs/<pn>.json for listed recipes.

Keeping the list here makes it visible and updatable alongside the recipes, and customisable from other layers.

Assisted-by kiro:claude-opus-5.5
---
 meta/conf/distro/include/maintainers.inc | 29 ++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
meta/conf/distro/include/maintainers.inc +29 -0
index 7fe1be9851e..5846b09bd02 100644
@@ -951,3 +951,32 @@ RECIPE_MAINTAINER:pn-xz = "Denys Dmytriyenko <[email protected]>"
 RECIPE_MAINTAINER:pn-zip = "Denys Dmytriyenko <[email protected]>"
 RECIPE_MAINTAINER:pn-zlib = "Denys Dmytriyenko <[email protected]>"
 RECIPE_MAINTAINER:pn-zstd = "Unassigned <[email protected]>"
+
+# Recipes (BPN) whose changelog from 'devtool upgrade' is not suitable
+# for a commit message; devtool flags them in its changelog JSON metadata.
+RECIPE_UPGRADE_CHANGELOG_SKIP ??= "\
+    acpica \
+    cmake \
+    expat \
+    freetype \
+    gst-devtools \
+    gst-examples \
+    gstreamer1.0 \
+    gstreamer1.0-libav \
+    gstreamer1.0-plugins-bad \
+    gstreamer1.0-plugins-base \
+    gstreamer1.0-plugins-good \
+    gstreamer1.0-plugins-ugly \
+    gstreamer1.0-python \
+    gstreamer1.0-rtsp-server \
+    mesa \
+    mesa-gl \
+    mesa-libclc \
+    mesa-tools \
+    openssh \
+    parted \
+    python3 \
+    u-boot \
+    u-boot-tools \
+    vulkan-validation-layers \
+"