For a recipe with SRCREV = "${AUTOREV}" (e.g. created by devtool add
--autorev), devtool finish and devtool update-recipe in srcrev mode
crash:
INFO: Updating SRCREV in recipe minit_git.bb
...
oe.patch.CmdError: Command Error: 'git format-patch --no-signature
--no-numbered AUTOINC -o /tmp/oepatchxu0ig0v0 -- .' exited with 128
Output: stderr: fatal: bad revision 'AUTOINC'
_update_recipe_srcrev() uses the recipe's SRCREV as the base revision
for exporting patches from the source tree, but for AUTOREV recipes
getVar('SRCREV') expands to the literal placeholder "AUTOINC", which is
not a valid git revision. Use the initial revision(s) recorded in the
workspace bbappend instead, as patch mode already does via
_get_patchset_revs().
Do not replace SRCREV with the current source tree HEAD for such
recipes either: pinning the revision on finish would silently drop the
floating revision the user explicitly asked for.
This is not a recent regression: the same crash reproduces at least as
far back as kirkstone, so it most likely dates back to the introduction
of devtool add --autorev.
[YOCTO #16354]
Reported-by: Gyorgy Sarvari <[email protected]>
AI-Generated: Uses Claude (claude-sonnet-5)
Signed-off-by: Babanpreet Singh <[email protected]>
---
scripts/lib/devtool/standard.py | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 2a3a62d081..386e628d88 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -1530,7 +1530,18 @@ def _update_recipe_srcrev(recipename, workspace,
srctree, rd, appendlayerdir, wi
old_srcrev = rd.getVar('SRCREV') or ''
if old_srcrev == "INVALID":
raise DevtoolError('Update mode srcrev is only valid for recipe
fetched from an SCM repository')
- old_srcrev = {'.': old_srcrev}
+ autorev = old_srcrev == 'AUTOINC'
+ if autorev:
+ # SRCREV is set to "${AUTOREV}" so there is no fixed revision to
+ # use as the base for exporting patches; use the initial revision(s)
+ # recorded when the source tree was set up, as patch mode does
+ append = workspace[recipename]['bbappend']
+ old_srcrev, _, _, _ = _get_patchset_revs(srctree, append)
+ if not old_srcrev:
+ raise DevtoolError('Unable to find the initial revision of the '
+ 'source tree for %s in the workspace' %
recipename)
+ else:
+ old_srcrev = {'.': old_srcrev}
# Get HEAD revision
try:
@@ -1545,7 +1556,8 @@ def _update_recipe_srcrev(recipename, workspace, srctree,
rd, appendlayerdir, wi
destpath = None
remove_files = []
patchfields = {}
- patchfields['SRCREV'] = srcrev
+ if not autorev:
+ patchfields['SRCREV'] = srcrev
orig_src_uri = rd.getVar('SRC_URI', False) or ''
srcuri = orig_src_uri.split()
tempdir = tempfile.mkdtemp(prefix='devtool')
--
2.43.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#240826):
https://lists.openembedded.org/g/openembedded-core/message/240826
Mute This Topic: https://lists.openembedded.org/mt/120245025/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-