Bug 16354 - devtool: adding recipe with autorev fails
Summary: devtool: adding recipe with autorev fails
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium normal
Target Milestone: 6.1
Assignee: Babanpreet Singh
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2026-07-09 08:38 UTC by Gyorgy Sarvari
Modified: 2026-07-26 12:17 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gyorgy Sarvari 2026-07-09 08:38:59 UTC
In case a new recipe is created with devtool from a git repository using AUTOREV, finishing the recipe fails.

Reproduction (any repository should work for the reproduction, this one is just an example):

devtool add --autorev minit git://git@github.com/OldManYellsAtCloud/minit.git\;protocol=https\;branch=master
devtool finish minit ../openembedded-core/meta

Result:
the first command succeeds, the recipe is created in the workspace. But finishing the recipe fails with the following error:

```
INFO: Updating SRCREV in recipe minit_git.bb
Traceback (most recent call last):
  File "/yocto/init-sandbox/openembedded-core/scripts/devtool", line 352, in <module>
    ret = main()
  File "/yocto/init-sandbox/openembedded-core/scripts/devtool", line 338, in main
    ret = args.func(args, config, basepath, workspace)
  File "/yocto/init-sandbox/openembedded-core/scripts/lib/devtool/standard.py", line 2183, in finish
    updated, appendfile, removed = _update_recipe(args.recipename, workspace, rd, args.mode, appendlayerdir, wildcard_version=True, no_remove=False, no_report_remove=removing_original, initial_rev=args.initial_rev, dry_run_outdir=dry_run_outdir, no_overrides=args.no_overrides, force_patch_refresh=args.force_patch_refresh)
                                   ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/yocto/init-sandbox/openembedded-core/scripts/lib/devtool/standard.py", line 1878, in _update_recipe
    updated, appendf, removed = _update_recipe_srcrev(recipename, workspace, srctree, crd, appendlayerdir, wildcard_version, no_remove, no_report_remove, dry_run_outdir)
                                ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/yocto/init-sandbox/openembedded-core/scripts/lib/devtool/standard.py", line 1562, in _update_recipe_srcrev
    upd_p, new_p, del_p = _export_patches(srctree, rd, old_srcrev,
                          ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
                                          patches_dir)
                                          ^^^^^^^^^^^^
  File "/yocto/init-sandbox/openembedded-core/scripts/lib/devtool/standard.py", line 1329, in _export_patches
    new_patches = GitApplyTree.extractPatches(srctree, start_revs, destdir, patch_pathspec)
  File "/yocto/init-sandbox/openembedded-core/meta/lib/oe/patch.py", line 528, in extractPatches
    out = runcmd(["sh", "-c", " ".join(shellcmd)], os.path.join(tree, name))
  File "/yocto/init-sandbox/openembedded-core/meta/lib/oe/patch.py", line 49, in runcmd
    raise CmdError(cmd, exitstatus >> 8, "stdout: %s\nstderr: %s" % (stdout, stderr))
oe.patch.CmdError: Command Error: 'sh -c 'git format-patch --no-signature --no-numbered AUTOINC -o /tmp/oepatchxu0ig0v0 -- .'' exited with 0  Output:
stdout: 
stderr: fatal: bad revision 'AUTOINC'

```


If the revision is specified explicitly in the "devtool add" command, then "devtool finish" also succeeds.
Comment 1 Randy MacLeod 2026-07-09 15:00:59 UTC
Good catch. Clearly a regression.
There should also be another test added.
Comment 2 Babanpreet Singh 2026-07-15 15:12:53 UTC
I recently submitted a patch regarding this.
Comment 3 Babanpreet Singh 2026-07-26 06:30:36 UTC
ae7be93cfd devtool: standard: fix finish/update-recipe for recipes using AUTOREV
b05a903407 oeqa/selftest/devtool: exercise devtool finish on an AUTOREV recipe

Series (v2): https://lore.kernel.org/openembedded-core/20260714032029.7-1-bbnpreetsingh@gmail.com/
Patchwork: 92391 and 92392, both accepted.

The second commit is the extra test Randy asked for: it runs devtool
finish on an AUTOREV recipe and checks that SRCREV is written out as a
real revision instead of the literal AUTOINC.

I do not appear to have permission to change the bug fields here. Could
someone with editbugs move this to RESOLVED/FIXED.