Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Babanpreet Singh <bbnpreetsingh@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Alexander Kanavin <alex.kanavin@gmail.com>,
	Randy MacLeod <randy.macleod@windriver.com>,
	Gyorgy Sarvari <skandigraun@gmail.com>,
	Chris Laplante <chris.laplante@agilent.com>,
	Adrian Freihofer <adrian.freihofer@siemens.com>,
	Peter Kjellerstedt <pkj@axis.com>,
	Babanpreet Singh <bbnpreetsingh@gmail.com>
Subject: [PATCH v2 2/2] oeqa/selftest/devtool: exercise devtool finish on an AUTOREV recipe
Date: Tue, 14 Jul 2026 03:20:29 +0000	[thread overview]
Message-ID: <20260714032029.7-2-bbnpreetsingh@gmail.com> (raw)
In-Reply-To: <20260714032029.7-1-bbnpreetsingh@gmail.com>

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



  reply	other threads:[~2026-07-14  3:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Babanpreet Singh [this message]
2026-07-14 10:16     ` [PATCH v2 2/2] oeqa/selftest/devtool: exercise devtool finish on an AUTOREV recipe Alexander Kanavin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260714032029.7-2-bbnpreetsingh@gmail.com \
    --to=bbnpreetsingh@gmail.com \
    --cc=adrian.freihofer@siemens.com \
    --cc=alex.kanavin@gmail.com \
    --cc=chris.laplante@agilent.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=pkj@axis.com \
    --cc=randy.macleod@windriver.com \
    --cc=skandigraun@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox