From: Babanpreet Singh <bbnpreetsingh@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Richard Purdie <richard.purdie@linuxfoundation.org>,
Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>,
Alexander Kanavin <alex.kanavin@gmail.com>,
Chris Laplante <chris.laplante@agilent.com>,
Peter Kjellerstedt <pkj@axis.com>,
Adrian Freihofer <adrian.freihofer@siemens.com>,
Babanpreet Singh <bbnpreetsingh@gmail.com>
Subject: [PATCH v2 2/2] oeqa/selftest/devtool: cover srcrev update mode guessing for gitsm://
Date: Thu, 23 Jul 2026 23:30:43 +0000 [thread overview]
Message-ID: <20260723233043.7-2-bbnpreetsingh@gmail.com> (raw)
In-Reply-To: <20260723233043.7-1-bbnpreetsingh@gmail.com>
Add test_devtool_update_recipe_gitsm: devtool modify the
git-submodule-test recipe, move the source tree to the parent of the
pinned revision (an upstream commit, no local changes) while staying on
the devtool branch, sync the submodules to it with 'git submodule
update', run 'devtool update-recipe' in the default auto mode, and
assert the recipe's SRCREV is updated to the checked-out revision.
Without the preceding fix the mode guesser cannot see gitsm:// URIs,
falls into patch mode, reports "No patches or files need updating" and
leaves the recipe untouched, and this test fails with:
AssertionError: Missing file changes: [(' M', '.*/git-submodule-test.bb$')]
The 'git submodule update' step matters: the pinned revision of
git-submodule-test happens to bump a gitlink, so after checking out its
parent the submodule no longer matches the revision the parent records,
and the guesser deliberately stays in patch mode for such trees.
The other direction of the guess — local commits inside a submodule
must keep patch mode, because they leave the parent HEAD on the
upstream branch while a srcrev update would silently drop them — is
already covered by the vulkan-samples based test_devtool_git_submodules,
which is what caught exactly that regression in v1 of this series on
the autobuilder, so no test is added for it.
No existing test exercises the auto->srcrev guess for any URI scheme:
the auto-mode arm of test_devtool_update_recipe_git covers the
local-commits->patch direction only.
AI-Generated: Uses Claude (claude-sonnet-5)
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
---
v1 -> v2:
- Run 'git submodule update --recursive' after moving the source tree:
the pinned git-submodule-test revision bumps a gitlink, so without it
the tree now legitimately stays in patch mode under the v2 guesser
- No new test for the submodule-local-commit direction: it is already
covered by test_devtool_git_submodules, which caught the v1
regression on the autobuilder and passes with this series
meta/lib/oeqa/selftest/cases/devtool.py | 38 +++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index a10eb0c784..b138a5ef6f 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -1378,6 +1378,44 @@ class DevtoolUpdateTests(DevtoolBase):
('??', '%s/0002-Add-a-new-file.patch' % relpatchpath)]
self._check_repo_status(os.path.dirname(recipefile), expected_status)
+ def test_devtool_update_recipe_gitsm(self):
+ # Check that auto mode guesses srcrev update mode for a gitsm:// recipe
+ # when HEAD is on the upstream branch, same as it does for git://
+ testrecipe = 'git-submodule-test'
+ bb_vars = get_bb_vars(['FILE', 'SRC_URI', 'SRCREV'], testrecipe)
+ recipefile = bb_vars['FILE']
+ src_uri = bb_vars['SRC_URI']
+ self.assertIn('gitsm://', src_uri, 'This test expects the %s recipe to be a gitsm recipe' % testrecipe)
+ self._check_repo_status(os.path.dirname(recipefile), [])
+ # First, modify a recipe
+ tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+ self.track_for_cleanup(tempdir)
+ self.track_for_cleanup(self.workspacedir)
+ self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
+ result = runCmd('devtool modify %s -x %s' % (testrecipe, tempdir))
+ # Check git repo
+ self._check_src_repo(tempdir)
+ # Move the source tree to the parent of the pinned revision, staying
+ # on the devtool branch: a revision reachable from the upstream branch
+ # with no local commits, i.e. the "check out another upstream revision
+ # to move the recipe" workflow the srcrev guess exists to detect
+ result = runCmd('git rev-parse HEAD~1', cwd=tempdir)
+ prevrev = result.output.strip()
+ runCmd('git reset --hard %s' % prevrev, cwd=tempdir)
+ # Sync the submodules to the newly checked out revision: with any
+ # submodule checkout not matching the revision the parent records,
+ # there is potential submodule content to export and the guesser
+ # legitimately stays in patch mode
+ runCmd('git submodule update --recursive', cwd=tempdir)
+ self.add_command_to_tearDown('cd %s; git checkout %s' % (os.path.dirname(recipefile), os.path.basename(recipefile)))
+ result = runCmd('devtool update-recipe %s' % testrecipe)
+ expected_status = [(' M', '.*/%s$' % os.path.basename(recipefile))]
+ self._check_repo_status(os.path.dirname(recipefile), expected_status)
+ result = runCmd('git diff %s' % os.path.basename(recipefile), cwd=os.path.dirname(recipefile))
+ addlines = ['SRCREV = "%s"' % prevrev]
+ removelines = ['SRCREV = "%s"' % bb_vars['SRCREV']]
+ self._check_diff(result.output, addlines, removelines)
+
def test_devtool_update_recipe_append(self):
# Check preconditions
testrecipe = 'minicom'
--
2.43.0
prev parent reply other threads:[~2026-07-23 23:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 6:02 [PATCH 1/2] devtool: standard: guess srcrev update mode for gitsm:// recipes too Babanpreet Singh
2026-07-23 6:02 ` [PATCH 2/2] oeqa/selftest/devtool: cover srcrev update mode guessing for gitsm:// Babanpreet Singh
2026-07-23 13:27 ` [OE-core] [PATCH 1/2] devtool: standard: guess srcrev update mode for gitsm:// recipes too Richard Purdie
2026-07-23 15:07 ` Mathieu Dubois-Briand
2026-07-23 23:52 ` Babanpreet Singh
2026-07-23 23:30 ` [PATCH v2 " Babanpreet Singh
2026-07-23 23:30 ` Babanpreet Singh [this message]
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=20260723233043.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=mathieu.dubois-briand@bootlin.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=pkj@axis.com \
--cc=richard.purdie@linuxfoundation.org \
/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