Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/2] devtool: fix finish for recipes using AUTOREV
@ 2026-07-13  6:04 Babanpreet Singh
  2026-07-13  6:04 ` [PATCH 1/2] devtool: standard: fix finish/update-recipe " Babanpreet Singh
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Babanpreet Singh @ 2026-07-13  6:04 UTC (permalink / raw)
  To: openembedded-core
  Cc: Randy MacLeod, Gyorgy Sarvari, Chris Laplante, Adrian Freihofer,
	Peter Kjellerstedt, Babanpreet Singh

devtool finish (and devtool update-recipe in srcrev mode) crashes with
"fatal: bad revision 'AUTOINC'" on any recipe with SRCREV = "${AUTOREV}",
e.g. one created with devtool add --autorev, because the unresolved
AUTOREV placeholder is passed to git format-patch as the base revision
for exporting patches.

Patch 1 uses the initial revision(s) recorded in the workspace bbappend
instead (as patch mode already does), and stops replacing the AUTOREV
with a pinned revision on finish. Patch 2 adds the oe-selftest case
Randy asked for in the bug; it fails with the exact reported error
before patch 1 and passes after.

While investigating I verified this is not a recent regression: the
same crash reproduces on wrynose, whinlatter, scarthgap and kirkstone,
so it most likely dates back to the introduction of --autorev.

Tested on oe-core master in a qemux86-64 build environment:
- devtool add --autorev + devtool finish: fails before, passes after,
  finished recipe keeps SRCREV = "${AUTOREV}"
- devtool add (pinned) + devtool finish: unchanged
- oe-selftest -r devtool.DevtoolAddTests.test_devtool_add_git_autorev_finish
  (new): PASSED
- oe-selftest -r devtool.DevtoolUpdateTests.test_devtool_update_recipe_git
  devtool.DevtoolUpdateTests.test_devtool_update_recipe_append_git: PASSED

[YOCTO #16354]

Babanpreet Singh (2):
  devtool: standard: fix finish/update-recipe for recipes using AUTOREV
  oeqa/selftest/devtool: add test for finishing a recipe using AUTOREV

 meta/lib/oeqa/selftest/cases/devtool.py | 32 +++++++++++++++++++++++++
 scripts/lib/devtool/standard.py         | 16 +++++++++++--
 2 files changed, 46 insertions(+), 2 deletions(-)

-- 
2.43.0



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] devtool: standard: fix finish/update-recipe for recipes using AUTOREV
  2026-07-13  6:04 [PATCH 0/2] devtool: fix finish for recipes using AUTOREV Babanpreet Singh
@ 2026-07-13  6:04 ` Babanpreet Singh
  2026-07-13  6:04 ` [PATCH 2/2] oeqa/selftest/devtool: add test for finishing a recipe " Babanpreet Singh
  2026-07-14  3:20 ` [PATCH v2 1/2] devtool: standard: fix finish/update-recipe for recipes " Babanpreet Singh
  2 siblings, 0 replies; 8+ messages in thread
From: Babanpreet Singh @ 2026-07-13  6:04 UTC (permalink / raw)
  To: openembedded-core
  Cc: Randy MacLeod, Gyorgy Sarvari, Chris Laplante, Adrian Freihofer,
	Peter Kjellerstedt, Babanpreet Singh

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 <skandigraun@gmail.com>
AI-Generated: Uses Claude (claude-sonnet-5)
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
---
 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



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] oeqa/selftest/devtool: add test for finishing a recipe using AUTOREV
  2026-07-13  6:04 [PATCH 0/2] devtool: fix finish for recipes using AUTOREV Babanpreet Singh
  2026-07-13  6:04 ` [PATCH 1/2] devtool: standard: fix finish/update-recipe " Babanpreet Singh
@ 2026-07-13  6:04 ` Babanpreet Singh
  2026-07-13 13:22   ` [OE-core] " Alexander Kanavin
  2026-07-14  3:20 ` [PATCH v2 1/2] devtool: standard: fix finish/update-recipe for recipes " Babanpreet Singh
  2 siblings, 1 reply; 8+ messages in thread
From: Babanpreet Singh @ 2026-07-13  6:04 UTC (permalink / raw)
  To: openembedded-core
  Cc: Randy MacLeod, Gyorgy Sarvari, Chris Laplante, Adrian Freihofer,
	Peter Kjellerstedt, Babanpreet Singh

Add a test checking that a recipe created with devtool add --autorev
can be finished into a layer, that the finished recipe still uses
SRCREV = "${AUTOREV}", and that no spurious patch files are generated.

Before the previous commit, devtool finish failed on such recipes with:

    fatal: bad revision 'AUTOINC'

Test requested by Randy MacLeod in the bug report.

[YOCTO #16354]

AI-Generated: Uses Claude (claude-sonnet-5)
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
---
 meta/lib/oeqa/selftest/cases/devtool.py | 32 +++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index b2cd13e9a5..a3c7c293c5 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -469,6 +469,38 @@ class DevtoolAddTests(DevtoolBase):
         checkvars['DEPENDS'] = set(['dbus'])
         self._test_recipe_contents(recipefile, checkvars, [])
 
+    def test_devtool_add_git_autorev_finish(self):
+        # Test that a recipe created by devtool add --autorev can be finished
+        # into a layer; this used to fail with "fatal: bad revision 'AUTOINC'"
+        # because the unresolved AUTOREV placeholder was used as the git
+        # revision to export patches from [YOCTO #16354]
+        pn = 'dbus-wait'
+        url = 'git://git.yoctoproject.org/dbus-wait;protocol=https;branch=master'
+        self.track_for_cleanup(self.workspacedir)
+        self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
+        result = runCmd("devtool add --autorev %s '%s'" % (pn, url))
+        recipefile = os.path.join(self.workspacedir, 'recipes', pn, '%s_git.bb' % pn)
+        self.assertExists(recipefile, 'Recipe not created by devtool add')
+        checkvars = {}
+        checkvars['SRCREV'] = '${AUTOREV}'
+        self._test_recipe_contents(recipefile, checkvars, [])
+        # Finish the recipe into a temporary layer
+        templayerdir = tempfile.mkdtemp(prefix='devtoolqa')
+        self.track_for_cleanup(templayerdir)
+        self._create_temp_layer(templayerdir, False, 'selftestautorev')
+        result = runCmd('devtool finish %s %s' % (pn, templayerdir))
+        result = runCmd('devtool status')
+        self.assertNotIn(pn, result.output, 'Recipe should have been reset by finish but wasn\'t')
+        newrecipefiles = glob.glob(os.path.join(templayerdir, 'recipes-*', pn, '%s_git.bb' % pn))
+        self.assertEqual(len(newrecipefiles), 1, 'Recipe not moved into destination layer by devtool finish')
+        # The recipe should still use a floating revision and no patch
+        # files should have been created
+        checkvars = {}
+        checkvars['SRCREV'] = '${AUTOREV}'
+        self._test_recipe_contents(newrecipefiles[0], checkvars, [])
+        patchfiles = glob.glob(os.path.join(templayerdir, 'recipes-*', pn, '*', '*.patch'))
+        self.assertEqual(patchfiles, [], 'Unexpected patch files generated by devtool finish')
+
     def test_devtool_add_git_style1(self):
         version = 'v3.1.0'
         pn = 'mbedtls'
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [OE-core] [PATCH 2/2] oeqa/selftest/devtool: add test for finishing a recipe using AUTOREV
  2026-07-13  6:04 ` [PATCH 2/2] oeqa/selftest/devtool: add test for finishing a recipe " Babanpreet Singh
@ 2026-07-13 13:22   ` Alexander Kanavin
  2026-07-14  2:32     ` Babanpreet Singh
  0 siblings, 1 reply; 8+ messages in thread
From: Alexander Kanavin @ 2026-07-13 13:22 UTC (permalink / raw)
  To: bbnpreetsingh
  Cc: openembedded-core, Randy MacLeod, Gyorgy Sarvari, Chris Laplante,
	Adrian Freihofer, Peter Kjellerstedt

On Mon, 13 Jul 2026 at 08:04, Baban via lists.openembedded.org
<bbnpreetsingh=gmail.com@lists.openembedded.org> wrote:
> AI-Generated: Uses Claude (claude-sonnet-5)
> +    def test_devtool_add_git_autorev_finish(self):
> +        # Test that a recipe created by devtool add --autorev can be finished
> +        # into a layer; this used to fail with "fatal: bad revision 'AUTOINC'"
> +        # because the unresolved AUTOREV placeholder was used as the git
> +        # revision to export patches from [YOCTO #16354]

There is no need to add a whole new test that largely copy-pastes
other tests. There is already test_devtool_add_fetch_git(), which adds
a recipe with AUTOREV, but then runs 'reset' instead of 'finish', so
that test should instead be adjusted.

Alex


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [OE-core] [PATCH 2/2] oeqa/selftest/devtool: add test for finishing a recipe using AUTOREV
  2026-07-13 13:22   ` [OE-core] " Alexander Kanavin
@ 2026-07-14  2:32     ` Babanpreet Singh
  0 siblings, 0 replies; 8+ messages in thread
From: Babanpreet Singh @ 2026-07-14  2:32 UTC (permalink / raw)
  To: alex.kanavin
  Cc: openembedded-core, randy.macleod, skandigraun, chris.laplante,
	adrian.freihofer, pkj

[-- Attachment #1: Type: text/plain, Size: 1406 bytes --]

On Mon, 13 Jul 2026, Alexander Kanavin <alex.kanavin@gmail.com> wrote:
> There is no need to add a whole new test that largely copy-pastes
> other tests. There is already test_devtool_add_fetch_git(), which adds
> a recipe with AUTOREV, but then runs 'reset' instead of 'finish', so
> that test should instead be adjusted.

Fair point - the add/check portion did duplicate what that test
already does. I'll send a v2 that drops the new test and instead
adjust test_devtool_add_fetch_git().

Thanks for the review,
Baban

On Mon, Jul 13, 2026 06:22 AM, Alexander Kanavin <alex.kanavin@gmail.com>
wrote:

> On Mon, 13 Jul 2026 at 08:04, Baban via lists.openembedded.org
> <bbnpreetsingh=gmail.com@lists.openembedded.org> wrote:
> > AI-Generated: Uses Claude (claude-sonnet-5)
> > +    def test_devtool_add_git_autorev_finish(self):
> > +        # Test that a recipe created by devtool add --autorev can be
> finished
> > +        # into a layer; this used to fail with "fatal: bad revision
> 'AUTOINC'"
> > +        # because the unresolved AUTOREV placeholder was used as the git
> > +        # revision to export patches from [YOCTO #16354]
>
> There is no need to add a whole new test that largely copy-pastes
> other tests. There is already test_devtool_add_fetch_git(), which adds
> a recipe with AUTOREV, but then runs 'reset' instead of 'finish', so
> that test should instead be adjusted.
>
> Alex
>

[-- Attachment #2: Type: text/html, Size: 2103 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/2] devtool: standard: fix finish/update-recipe for recipes using AUTOREV
  2026-07-13  6:04 [PATCH 0/2] devtool: fix finish for recipes using AUTOREV Babanpreet Singh
  2026-07-13  6:04 ` [PATCH 1/2] devtool: standard: fix finish/update-recipe " Babanpreet Singh
  2026-07-13  6:04 ` [PATCH 2/2] oeqa/selftest/devtool: add test for finishing a recipe " Babanpreet Singh
@ 2026-07-14  3:20 ` Babanpreet Singh
  2026-07-14  3:20   ` [PATCH v2 2/2] oeqa/selftest/devtool: exercise devtool finish on an AUTOREV recipe Babanpreet Singh
  2 siblings, 1 reply; 8+ messages in thread
From: Babanpreet Singh @ 2026-07-14  3:20 UTC (permalink / raw)
  To: openembedded-core
  Cc: Alexander Kanavin, Randy MacLeod, Gyorgy Sarvari, Chris Laplante,
	Adrian Freihofer, Peter Kjellerstedt, Babanpreet Singh

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 <skandigraun@gmail.com>
AI-Generated: Uses Claude (claude-sonnet-5)
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
---
changes in v2:
- unchanged, rebased onto current master
 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



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] oeqa/selftest/devtool: exercise devtool finish on an AUTOREV recipe
  2026-07-14  3:20 ` [PATCH v2 1/2] devtool: standard: fix finish/update-recipe for recipes " Babanpreet Singh
@ 2026-07-14  3:20   ` Babanpreet Singh
  2026-07-14 10:16     ` Alexander Kanavin
  0 siblings, 1 reply; 8+ messages in thread
From: Babanpreet Singh @ 2026-07-14  3:20 UTC (permalink / raw)
  To: openembedded-core
  Cc: Alexander Kanavin, Randy MacLeod, Gyorgy Sarvari, Chris Laplante,
	Adrian Freihofer, Peter Kjellerstedt, Babanpreet Singh

Adjust test_devtool_add_fetch_git() so that the recipe it creates with
SRCREV = "${AUTOREV}" is finished into a temporary layer instead of
just being reset: check that devtool finish succeeds (before the
previous commit srcrev mode failed with "fatal: bad revision
'AUTOINC'"), that the finished recipe still uses SRCREV = "${AUTOREV}",
and that no spurious patch files are generated. The reset it replaces
is covered by many other devtool tests.

srcrev mode is forced with --mode srcrev: update-mode guessing only
considers git:// URLs, so for this gitsm:// recipe auto mode would
select patch mode and never reach the code path being tested.

[YOCTO #16354]

Cc: Alexander Kanavin <alex.kanavin@gmail.com>
AI-Generated: Uses Claude (claude-sonnet-5)
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
---
changes in v2:
- extend the existing test_devtool_add_fetch_git() instead of
  adding a new test (Alexander Kanavin)
- force --mode srcrev in the test: update-mode guessing never
  selects srcrev for the gitsm:// URL used there (verified the
  adjusted test passes with the fix reverted if the mode is not
  forced, i.e. it would not catch the bug)
 meta/lib/oeqa/selftest/cases/devtool.py | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index b2cd13e9a5..51f9d6f8b7 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -613,8 +613,27 @@ class DevtoolAddTests(DevtoolBase):
         checkvars['SRC_URI'] = url_branch
         checkvars['SRCREV'] = '${AUTOREV}'
         self._test_recipe_contents(recipefile, checkvars, [])
+        # Finish into a temporary layer instead of resetting; srcrev mode
+        # used to fail with "fatal: bad revision 'AUTOINC'" because the
+        # unresolved AUTOREV placeholder was used as the git revision to
+        # export patches from [YOCTO #16354]. srcrev mode has to be forced
+        # because update-mode guessing never selects it for gitsm:// URLs.
+        templayerdir = tempfile.mkdtemp(prefix='devtoolqa')
+        self.track_for_cleanup(templayerdir)
+        self._create_temp_layer(templayerdir, False, 'selftestautorev')
+        result = runCmd('devtool finish --mode srcrev %s %s' % (testrecipe, templayerdir))
+        result = runCmd('devtool status')
+        self.assertNotIn(testrecipe, result.output, 'Recipe should have been removed from workspace by devtool finish')
+        newrecipefiles = glob.glob(os.path.join(templayerdir, 'recipes-*', testrecipe, '%s_git.bb' % testrecipe))
+        self.assertEqual(len(newrecipefiles), 1, 'Recipe not moved into destination layer by devtool finish')
+        # The finished recipe should still use a floating revision and no
+        # patch files should have been created
+        checkvars = {}
+        checkvars['SRCREV'] = '${AUTOREV}'
+        self._test_recipe_contents(newrecipefiles[0], checkvars, [])
+        patchfiles = glob.glob(os.path.join(templayerdir, 'recipes-*', testrecipe, '*', '*.patch'))
+        self.assertEqual(patchfiles, [], 'Unexpected patch files generated by devtool finish')
         # Try with revision and version specified
-        result = runCmd('devtool reset -n %s' % testrecipe)
         shutil.rmtree(srcdir)
         url_rev = '%s;rev=%s' % (url, checkrev)
         result = runCmd('devtool add %s %s -f "%s" -V 1.5' % (testrecipe, srcdir, url_rev))
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] oeqa/selftest/devtool: exercise devtool finish on an AUTOREV recipe
  2026-07-14  3:20   ` [PATCH v2 2/2] oeqa/selftest/devtool: exercise devtool finish on an AUTOREV recipe Babanpreet Singh
@ 2026-07-14 10:16     ` Alexander Kanavin
  0 siblings, 0 replies; 8+ messages in thread
From: Alexander Kanavin @ 2026-07-14 10:16 UTC (permalink / raw)
  To: Babanpreet Singh
  Cc: openembedded-core, Randy MacLeod, Gyorgy Sarvari, Chris Laplante,
	Adrian Freihofer, Peter Kjellerstedt

Thanks, I think this is good.

Alex

On Tue, 14 Jul 2026 at 05:20, Babanpreet Singh <bbnpreetsingh@gmail.com> wrote:
>
> Adjust test_devtool_add_fetch_git() so that the recipe it creates with
> SRCREV = "${AUTOREV}" is finished into a temporary layer instead of
> just being reset: check that devtool finish succeeds (before the
> previous commit srcrev mode failed with "fatal: bad revision
> 'AUTOINC'"), that the finished recipe still uses SRCREV = "${AUTOREV}",
> and that no spurious patch files are generated. The reset it replaces
> is covered by many other devtool tests.
>
> srcrev mode is forced with --mode srcrev: update-mode guessing only
> considers git:// URLs, so for this gitsm:// recipe auto mode would
> select patch mode and never reach the code path being tested.
>
> [YOCTO #16354]
>
> Cc: Alexander Kanavin <alex.kanavin@gmail.com>
> AI-Generated: Uses Claude (claude-sonnet-5)
> Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
> ---
> changes in v2:
> - extend the existing test_devtool_add_fetch_git() instead of
>   adding a new test (Alexander Kanavin)
> - force --mode srcrev in the test: update-mode guessing never
>   selects srcrev for the gitsm:// URL used there (verified the
>   adjusted test passes with the fix reverted if the mode is not
>   forced, i.e. it would not catch the bug)
>  meta/lib/oeqa/selftest/cases/devtool.py | 21 ++++++++++++++++++++-
>  1 file changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
> index b2cd13e9a5..51f9d6f8b7 100644
> --- a/meta/lib/oeqa/selftest/cases/devtool.py
> +++ b/meta/lib/oeqa/selftest/cases/devtool.py
> @@ -613,8 +613,27 @@ class DevtoolAddTests(DevtoolBase):
>          checkvars['SRC_URI'] = url_branch
>          checkvars['SRCREV'] = '${AUTOREV}'
>          self._test_recipe_contents(recipefile, checkvars, [])
> +        # Finish into a temporary layer instead of resetting; srcrev mode
> +        # used to fail with "fatal: bad revision 'AUTOINC'" because the
> +        # unresolved AUTOREV placeholder was used as the git revision to
> +        # export patches from [YOCTO #16354]. srcrev mode has to be forced
> +        # because update-mode guessing never selects it for gitsm:// URLs.
> +        templayerdir = tempfile.mkdtemp(prefix='devtoolqa')
> +        self.track_for_cleanup(templayerdir)
> +        self._create_temp_layer(templayerdir, False, 'selftestautorev')
> +        result = runCmd('devtool finish --mode srcrev %s %s' % (testrecipe, templayerdir))
> +        result = runCmd('devtool status')
> +        self.assertNotIn(testrecipe, result.output, 'Recipe should have been removed from workspace by devtool finish')
> +        newrecipefiles = glob.glob(os.path.join(templayerdir, 'recipes-*', testrecipe, '%s_git.bb' % testrecipe))
> +        self.assertEqual(len(newrecipefiles), 1, 'Recipe not moved into destination layer by devtool finish')
> +        # The finished recipe should still use a floating revision and no
> +        # patch files should have been created
> +        checkvars = {}
> +        checkvars['SRCREV'] = '${AUTOREV}'
> +        self._test_recipe_contents(newrecipefiles[0], checkvars, [])
> +        patchfiles = glob.glob(os.path.join(templayerdir, 'recipes-*', testrecipe, '*', '*.patch'))
> +        self.assertEqual(patchfiles, [], 'Unexpected patch files generated by devtool finish')
>          # Try with revision and version specified
> -        result = runCmd('devtool reset -n %s' % testrecipe)
>          shutil.rmtree(srcdir)
>          url_rev = '%s;rev=%s' % (url, checkrev)
>          result = runCmd('devtool add %s %s -f "%s" -V 1.5' % (testrecipe, srcdir, url_rev))
> --
> 2.43.0
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-07-14 10:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13  6:04 [PATCH 0/2] devtool: fix finish for recipes using AUTOREV Babanpreet Singh
2026-07-13  6:04 ` [PATCH 1/2] devtool: standard: fix finish/update-recipe " Babanpreet Singh
2026-07-13  6:04 ` [PATCH 2/2] oeqa/selftest/devtool: add test for finishing a recipe " Babanpreet Singh
2026-07-13 13:22   ` [OE-core] " Alexander Kanavin
2026-07-14  2:32     ` Babanpreet Singh
2026-07-14  3:20 ` [PATCH v2 1/2] devtool: standard: fix finish/update-recipe for recipes " Babanpreet Singh
2026-07-14  3:20   ` [PATCH v2 2/2] oeqa/selftest/devtool: exercise devtool finish on an AUTOREV recipe Babanpreet Singh
2026-07-14 10:16     ` Alexander Kanavin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox