steps: deduplicate same version in subject
PATCH 1/4 steps: deduplicate same version in subject
From: Daniel Turull <[email protected]>
When multiple components are updated at the same time, we should have one version if it is the same. Before the patch we had duplicated version information in the subject.
Example:
Before: mesa-tools-native,mesa: upgrade 26.2.1 -> 26.2.2,26.2.1 -> 26.2.2
After: mesa-tools-native,mesa: upgrade 26.2.1 -> 26.2.2
--- modules/steps.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
modules/steps.py +2 -1
@@ -77,7 +77,8 @@ def _make_commit_msg(group): return "{} -> {}".format(p['PV'], p['NPV']) pn = group['name'] - return "{}: upgrade {}".format(pn, ",".join([_get_version(p) for p in group['pkgs']])) + versions = list(dict.fromkeys(_get_version(p) for p in group['pkgs'])) + return "{}: upgrade {}".format(pn, ",".join(versions)) def _get_changelog(pn, workdir): """Read the changelog generated by devtool upgrade and copy it to workdir.
PATCH 2/4 steps: skip duplicate changelog for shared-source variants
From: Daniel Turull <[email protected]>
- 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.
--- modules/steps.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
modules/steps.py +11 -7
@@ -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)
Re: [auh][PATCH 2/4] steps: skip duplicate changelog for shared-source variants
Quoted 8 lines · On Fri, 18 Sept 2026 at 14:03, <[email protected]> wrote:
def
devtool_upgrade(devtool, bb, git, opts, group):modules/steps.py +2
-2- 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)
I think this is not quite correct. Recipes in a group may all produce different changelogs, and in that case they should be all included. The idea is to remove proven duplicates, not just add the first changelog in a group.
Alex
Re: [auh][PATCH 2/4] steps: skip duplicate changelog for shared-source variants
Quoted 15 lines · Alexander Kanavin
Quoted 7 lines · On Fri, 18 Sept 2026 at 14:03, <[email protected]> wrote:
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 inenumerate(group['pkgs']):
+_devtool_upgrade(devtool, bb, git, opts, p, group['workdir'], i == 0)_append_changelog_to_commit_msg(group, opts)
Quoted 2 lines
I think this is not quite correct. Recipes in a group may all produce different changelogs, and in that case they should be all included. The idea is to remove proven duplicates, not just add the first changelog in a group.
Ok. I had the wrong assumption that all came from the same recipe. I'll send a v2 that checks and removes duplicates.
Cheers,
Daniel
Re: [auh][PATCH 2/4] steps: skip duplicate changelog for shared-source variants
Quoted 9 lines · Daniel Turull
Quoted 1 line
I think this is not quite correct. Recipes in a group may all produce
different changelogs, and in that case they should be all included. The idea is to remove proven duplicates, not just add the first changelog in a group.
Quoted 1 line
Ok. I had the wrong assumption that all came from the same recipe. I'll send a
v2 that checks and removes duplicates.
Recipe groups can all build from the same source tree, but they can also be using entirely different sources, for example gstreamer plugins do. Groups are determined by checking if recipes share a common include file.
Alex
PATCH 3/4 upgrade-helper: increase changelog truncation to 5000 charaters
In reply to [email protected]From: Daniel Turull <[email protected]>
Increase to include more text in the commit message.
It has been requested by Richard Purdie in
https://lore.kernel.org/all/e13a77790d4c9bb55bd61aa59ff433c703b6f3d8.camel@linuxfoundation.org/
--- upgrade-helper.conf | 2 +- upgrade-helper.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
upgrade-helper.conf +1 -1
@@ -144,4 +144,4 @@ # Maximum number of characters from the changelog to include in the # commit message. Longer changelogs are truncated. The full changelog # is always available as an attachment. -#changelog_max_len=3000 +#changelog_max_len=5000
upgrade-helper.py +1 -1
@@ -219,7 +219,7 @@ class Updater(object): self.opts['skip_compilation'] = self.args.skip_compilation self.opts['buildhistory'] = self._buildhistory_is_enabled() self.opts['testimage'] = self._testimage_is_enabled() - self.opts['changelog_max_len'] = settings.get('changelog_max_len', '3000') + self.opts['changelog_max_len'] = settings.get('changelog_max_len', '5000') def _make_dirs(self, build_dir): self.uh_dir = os.path.join(build_dir, "upgrade-helper")
PATCH 4/4 steps: remove unnecessary removal of metadata
In reply to [email protected]From: Daniel Turull <[email protected]>
In devtool upgrade now the metadata is stored in a json file and the changelog file contains only the changelog.
--- modules/steps.py | 2 -- 1 file changed, 2 deletions(-)
modules/steps.py +0 -2
@@ -102,8 +102,6 @@ def _append_changelog_to_commit_msg(group, opts): if 'changelog_text' not in p: continue text = p['changelog_text'].strip() - if text.startswith('Changelog for '): - text = text[text.index('\n') + 1:].strip() if len(text) > max_len: text = (text[:max_len] + "\n\n[Changelog truncated as it exceeds {} characters; \n" "the full changelog can be found in an attachment to the AUH email]".format(max_len))
Quoted 9 lines · On Fri, 18 Sept 2026 at 14:04, <[email protected]> wrote:
When multiple components are updated at the same time, we should have one version if it is the same. Before the patch we had duplicated version information in the subject.
Example:
Before: mesa-tools-native,mesa: upgrade 26.2.1 -> 26.2.2,26.2.1 -> 26.2.2
After: mesa-tools-native,mesa: upgrade 26.2.1 -> 26.2.2
This, 3/4 and 4/4 have been applied and pushed, thanks!
Alex