How to clone a git repo with its submodules recursively in Yocto
Asked Answered
A

3

11

Is there any other way to clone all the dependent folders in a Bitbake recipe file (similar to using recursive tag)? I'm currently doing it as below:

SRC_URI="git://[uri_a];...;name=a \
     git://[uri_b];...;destsuffix=git/a/b;name=b \
     git://[uri_c];...;destsuffix=git/a/b/c;name=c"

where "b" & "c" are sub modules of "a".

Alto answered 1/6, 2016 at 13:20 Comment(0)
E
19

You have

gitsm:// 

You use it the same way that

git://

For more information, you can read about it here: https://docs.yoctoproject.org/bitbake/1.46/bitbake-user-manual/bitbake-user-manual-fetching.html#git-submodule-fetcher-gitsm

Esemplastic answered 1/6, 2016 at 15:25 Comment(4)
Thanks David. But I face the following error after replacing the working SRC_URI="git://" with "gitsm://" and bitbaking the module : ERROR: Function failed: Fetcher failure: Fetch command failed with exit code 1, output: cp: cannot stat '/home/ram/yocto/build/downloads/git2/github.com.Azure.azure-iot-sdks.git/modules': No such file or directoryAlto
@RamPrasad If you did not run bitbake clean on your recipe, do so. Switching a SRC_URI from "git://" to "gitsm://" requires that.Weighbridge
@jku I read about that in the document and ran "bitbake -c clean recipe" before bitbaking the recipe. forgot to mention that in the comment :(Alto
URL doesn't work anymore.Ottar
I
10

After trying gitsm without success, I manually prepended the fetching of the submodules to the configure step:

do_configure_prepend() {
  cd ${WORKDIR}/git
  git submodule update --init --recursive
}

Note: the same restrictions as gitsm apply, i.e.:

The Git Submodules fetcher is not a complete fetcher implementation. The fetcher has known issues where it does not use the normal source mirroring infrastructure properly. Further, the submodule sources it fetches are not visible to the licensing and source archiving infrastructures.

Implacable answered 25/11, 2019 at 10:26 Comment(2)
Any idea Why I get access error when trying your solution? Cloning into... [email protected]: Permission denied (publickey,keyboard-interactive). fatal: Could not read from remote repository. Arcadian
This is expected - in fact it is why gitsm:// exists. During source fetching yocto makes more of the environment available allowing access to your ssh-agent. During "build" steps the environment is very much locked down. gitsm:// is supposed to be the solution - and was working for us until recently - what issue do you have with gitsm://?Sakti
P
2

Following the description above (from mr_georg) worked in most cases but failed on a recipe for a qt5 application. With the below modification, the recipe worked:

do_configure_prepend() {
  cd ${WORKDIR}/git
  git submodule update --init --recursive
  cd -
}
Preferable answered 5/12, 2021 at 8:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.