On Tue, 12 May 2026 at 09:25, Daniel Turull via lists.openembedded.org
<[email protected]> wrote:
> Automatically extract changelog information when upgrading a recipe.
> Uses the devtool-base tags created during upgrade to diff known
> changelog files (NEWS, ChangeLog, CHANGES, etc.) between the old and
> new versions. For git-based sources, falls back to git log --oneline
> if no changelog file changed.
>
> Output is written to workspace/changelogs/<pn>.txt and cleaned up on
> devtool reset. This allows AUH and other tools to pick up the changelog
> without implementing their own extraction logic.
Thanks, I like this a lot, and I think this should be fairly easy to
get merged. Just a couple notes:
- probably patches 2/3 and 3/3 should all be folded into the main
commit? (but also add those commit messages to the main commit
message, don't discard the additional information)
- please see below this about testing the functionality
> + def test_devtool_upgrade_changelog(self):
> + # Check preconditions
> + self.assertTrue(not os.path.exists(self.workspacedir), 'This test
> cannot be run with a workspace directory under the build directory')
> + self.track_for_cleanup(self.workspacedir)
> + self.add_command_to_tearDown('bitbake-layers remove-layer
> */workspace')
> + # dbus-wait has ChangeLog/NEWS files and one commit between these
> revisions
> + recipe = 'devtool-upgrade-test2'
> + commit = '6cc6077a36fe2648a5f993fe7c16c9632f946517'
> + tempdir = tempfile.mkdtemp(prefix='devtoolqa')
> + self.track_for_cleanup(tempdir)
> + # Perform upgrade
> + runCmd('devtool upgrade %s %s -S %s' % (recipe, tempdir, commit))
> + # Check changelog file was created with expected content
> + changelog_file = os.path.join(self.workspacedir, 'changelogs',
> '%s.txt' % recipe)
> + self.assertExists(changelog_file, 'Changelog file should exist after
> upgrade')
> + with open(changelog_file, 'r') as f:
> + content = f.read()
> + self.assertIn(recipe, content)
> + # The commit between versions fixes a typo - verify we got real
> content
> + self.assertIn('typo', content)
> + # Check devtool reset cleans up changelog
> + runCmd('devtool reset %s -n' % recipe)
> + self.assertNotExists(changelog_file, 'Changelog file should be
> removed after reset')
Rather than write a whole new test (which adds to the overall testing
time, copy-pastes code, and repeats the upgrade procedure already
happening in a different test), I think the changelog checks should be
added to existing tests in DevtoolUpgradeTests class. At least these
tests:
- test_devtool_upgrade
- _test_devtool_upgrade_git_by_recipe
but ideally everything where upgrade operation runs and changelogs are
extracted.
Also, don't look for simple strings as a way to check the changelog
sanity. Instead, write a 'reference changelog' into meta-selftest, and
compare that with the extracted changelog in the workspace, similar to
how upgraded recipes are compared with reference data:
# Check recipe got changed as expected
with open(oldrecipefile + '.upgraded', 'r') as f:
desiredlines = f.readlines()
with open(newrecipefile, 'r') as f:
newlines = f.readlines()
self.assertEqual(desiredlines, newlines)
Such a comparison could probably be in a helper function to avoid
repeating code lines.
It's okay if some of the upgrades are unable to extract anything
useful into the changelog, then the reference data should simply stay
empty. If you can cover all of these, would be awesome:
meta-selftest/recipes-devtools/python/python3-guessing-game-crates.inc.upgraded
meta-selftest/recipes-devtools/python/python3-guessing-game_git.bb.upgraded
meta-selftest/recipes-test/devtool/devtool-upgrade-test1_1.5.3.bb.upgraded
meta-selftest/recipes-test/devtool/devtool-upgrade-test2_git.bb.upgraded
meta-selftest/recipes-test/devtool/devtool-upgrade-test3_1.5.3.bb.upgraded
meta-selftest/recipes-test/devtool/devtool-upgrade-test4_1.5.3.bb.upgraded
meta-selftest/recipes-test/devtool/devtool-upgrade-test5_git.bb.upgraded
Cheers,
Alex
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#236890):
https://lists.openembedded.org/g/openembedded-core/message/236890
Mute This Topic: https://lists.openembedded.org/mt/119271061/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-