A BB recipe typically checkouts a (git) repo using the given hash. This requires committing and pushing source code changes to a repository which is used by the BB recipe.
To prevent continuously committing and pushing, AND updating the hash in the BB recipe, I want to make the related git repo a sub repo of the application yocto repo. This would allow using the BB recipe to use the local (edited) sources, though using the (current) git hash. When functioning the subrepo can be commited when dev finished, and a new build will use this new hash, and the main repo is committed to store the state/hash of the sub-repo.
Also the relations between the repos is now part, maintained and stored by git.
I tried using next in a BB recipe but this clone does not contain the local changes in the subrepo:
SRC_URI = "git://${TOPDIR}/../repos/lib-repo/;protocol=file"
How to setup up a BB recipe [SRC_URI] and getting the git-hash (of the latest commit on current branch) [SRCREV]?
You could use the
externalsrcclass for this:This essentially removes
do_fetchanddo_unpacktasks for the recipe, since the source is expected to already be available at that path. Sincedo_fetchis bypassed, the Git fetcher is not used and so all source changes (committed or local) will be included.If you'd like this recipe to still use the Git version of that external repository, you can use the
gitverclass (from meta-openembedded) to do this. It runsgit describeon the recipe's source (${S}) directory - which is set byexternalsrcin this case, and sets the results into Bitbake variables:You could implement your own class if those
gitvervariables don't provide the version format you're after.Note that
:=is used to ensure that thegitverfunctions are only called once during parsing.