Reputation: 1
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]?
Upvotes: 0
Views: 434
Reputation: 858
You could use the externalsrc
class for this:
inherit externalsrc
EXTERNALSRC = "${TOPDIR}/../repos/lib-repo"
This essentially removes do_fetch
and do_unpack
tasks for the recipe, since the source is expected to already be available at that path. Since do_fetch
is 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 gitver
class (from meta-openembedded) to do this. It runs git describe
on the recipe's source (${S}
) directory - which is set by externalsrc
in this case, and sets the results into Bitbake variables:
inherit gitver
# To use output from git describe --tags
PV := "${GITVER}"
# To use output from git rev-parse --short HEAD
PV := "${GITSHA}"
You could implement your own class if those gitver
variables don't provide the version format you're after.
Note that :=
is used to ensure that the gitver
functions are only called once during parsing.
Upvotes: 0