steps: skip changelog in commit message when devtool flags it
PATCH v2 1/1 steps: skip changelog in commit message when devtool flags it
From: Daniel Turull <[email protected]>
Some upstream changelogs are badly formed for a commit message (e.g. mesa, gstreamer release notes, raw git log dumps). 'devtool upgrade' now marks these with "changelog_skip": true in workspace/changelogs/<pn>.json, driven by RECIPE_UPGRADE_CHANGELOG_SKIP in OE-Core.
Read that flag and leave the changelog out of the commit message for flagged recipes. The changelog is still attached to the AUH email. A missing key or metadata file means no skip, so behaviour with older devtool is unchanged.
This depends on the OE-Core patch "devtool: upgrade: flag badly formed changelogs in metadata".
--- modules/steps.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
modules/steps.py +18 -0
@@ -19,6 +19,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # +import json import os import shutil import re
@@ -96,12 +97,28 @@ def _get_changelog(pn, workdir): return None +def _changelog_skip(pn): + """Return True if devtool flagged the changelog of pn as badly formed + for a commit message (RECIPE_UPGRADE_CHANGELOG_SKIP in oe-core).""" + metadata_path = os.path.join(os.environ.get('BUILDDIR', ''), + 'workspace', 'changelogs', '{}.json'.format(pn)) + try: + with open(metadata_path, 'r', encoding='utf-8') as f: + return bool(json.load(f).get('changelog_skip', False)) + except (OSError, ValueError): + return False + + def _append_changelog_to_commit_msg(group, opts): max_len = int(opts['changelog_max_len']) seen = set() for p in group['pkgs']: if 'changelog_text' not in p: continue + # Changelog stays attached to the email, only the commit message skips it + if p.get('changelog_skip'): + I(" %s: changelog not added to commit message (RECIPE_UPGRADE_CHANGELOG_SKIP)" % p['PN']) + continue text = p['changelog_text'].strip() # Group recipes may share a source and produce identical changelogs # (e.g. mesa, mesa-native); skip proven duplicates, keep the rest.
@@ -122,6 +139,7 @@ def _devtool_upgrade(devtool, bb, git, opts, pkg_ctx, workdir): changelog_text = _get_changelog(pkg_ctx['PN'], workdir) if changelog_text: pkg_ctx['changelog_text'] = changelog_text + pkg_ctx['changelog_skip'] = _changelog_skip(pkg_ctx['PN']) # 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)
modules/steps.py def _get_changelog(pn, workdir): · line 109
Quoted 13 lines · On Thu, 22 Oct 2026 at 16:46, <[email protected]> wrote:
modules/steps.py +5
-0+def _changelog_skip(pn): + """Return True if devtool flagged the changelog of pn as badly formed + for a commit message (RECIPE_UPGRADE_CHANGELOG_SKIP in oe-core).""" + metadata_path = os.path.join(os.environ.get('BUILDDIR', ''), + 'workspace', 'changelogs','{}.json'.format(pn))
modules/steps.py +5
-0+ try: + with open(metadata_path, 'r', encoding='utf-8') as f: + return bool(json.load(f).get('changelog_skip', False)) + except (OSError, ValueError): + return False
The json laoding/parsing should be probably refactored so it's done only once, and set as a property of pkg_ctx?
Alex