Bug 15943 - devtool upgrade fails for recipe that contains a git submodule
Summary: devtool upgrade fails for recipe that contains a git submodule
Status: CLOSED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: Scripts and Tools (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium normal
Target Milestone: 5.3
Assignee: Tobias Pistora
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2025-07-25 08:47 UTC by Tobias Pistora
Modified: 2025-12-03 08:22 UTC (History)
2 users (show)

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


Attachments
My bugfix based on yocto-5.0.8 (1.84 KB, application/mbox)
2025-07-25 08:47 UTC, Tobias Pistora
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Pistora 2025-07-25 08:47:05 UTC
Created attachment 5127 [details]
My bugfix based on yocto-5.0.8

The devtool upgrade command fails while it goes through a git submodule directory. It happens when devtool executes 'git rev-list devtool-base..<submodule commit hash>'. The debug log shows that 'git rev-list' is called from parent directory but with the commit hash of the submodule which does not exist there ("amqp-proxy" is the parent git repo and "contracts" the submodule):

-- snipped --
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy> git fetch
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy> git checkout 35b87c6723cf5afbee0cf02c7447eb8c833185af
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy> git tag -f devtool-base-new
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy> git submodule update --recursive
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy> git submodule foreach 'git tag -f devtool-base-new'
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy> git submodule --quiet foreach 'echo $sm_path'
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy> git branch -r --contains 35b87c6723cf5afbee0cf02c7447eb8c833185af
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy> git rev-parse HEAD
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy/contracts> git rev-parse HEAD
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy> git checkout devtool-patched -b devtool
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy> git branch --list devtool-override-*
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy> git rev-list devtool-base..35b87c6723cf5afbee0cf02c7447eb8c833185af
INFO: Rebasing devtool onto 35b87c6723cf5afbee0cf02c7447eb8c833185af
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy> git checkout devtool
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy> git rebase 35b87c6723cf5afbee0cf02c7447eb8c833185af
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy> git rev-list devtool-base..35b87c6723cf5afbee0cf02c7447eb8c833185af
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy> git checkout devtool
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy/contracts> git checkout devtool-patched -b devtool
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy/contracts> git branch --list devtool-override-*
DEBUG: Running command <build_path>/workspace/sources/amqp-proxy> git rev-list devtool-base..90727cda36bab25fb106fc100e5a6177467f5456
ERROR: Execution of 'git rev-list devtool-base..90727cda36bab25fb106fc100e5a6177467f5456' failed with exit code 128:
fatal: Invalid revision range devtool-base..90727cda36bab25fb106fc100e5a6177467f5456
-- snipped end --

The full command that was executed for this output is 'command: devtool -d upgrade amqp-proxy'. The related recipe uses "gitsm://" for fetching the code.

After inspecting the related code in 'poky/scripts/lib/devtool/upgrade.py' I have found a working fix for me. See attached patch, based on yocto 5.0.8. Hope this helps.

Conclusion: Is seems that the path argument is missing when running the 'git rev-list' calls from submodule directories.
However, because I have found the same (unfixed) code in master branch and have not found a bug report for this issue yet (the affected code was add around a year ago), I am not sure if the implementation is intended and I am somehow terribly wrong with what I am doing...
Comment 1 Richard Purdie 2025-07-31 14:40:23 UTC
"oe-selftest -r devtool" has a lot of selftests for devtool. Would you be able to write a test case which covers this scenario? If so, at a quick glance, I think your patch seems reasonable and you could send that for review too?
Comment 2 Tobias Pistora 2025-08-01 08:30:36 UTC
(In reply to Richard Purdie from comment #1)
> "oe-selftest -r devtool" has a lot of selftests for devtool. Would you be
> able to write a test case which covers this scenario?
I think so... After a quick glance inside the test code I got an idea where to look next^^. However, it may take a while but I will get used to it.

> If so, at a quick
> glance, I think your patch seems reasonable and you could send that for
> review too?
Sure, I will do that.
Comment 3 Tobias Pistora 2025-12-03 08:17:03 UTC
Fixed in 4c7b0007327d592b8f5d1f50ebb0325dc483bd87 (https://git.yoctoproject.org/poky/commit/?id=4c7b0007327d592b8f5d1f50ebb0325dc483bd87)
Comment 4 Tobias Pistora 2025-12-03 08:20:51 UTC
The requested test case can be found in 	921faf324658371193b1f0847ebc1912d7fef25d (https://git.yoctoproject.org/poky/commit/?id=921faf324658371193b1f0847ebc1912d7fef25d)
Comment 5 Tobias Pistora 2025-12-03 08:22:07 UTC
fixed