10

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".

stdcall
  • 27,613
  • 18
  • 81
  • 125
Ram Prasad
  • 129
  • 1
  • 1
  • 8

3 Answers3

16

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

David Bensoussan
  • 2,887
  • 2
  • 38
  • 55
  • 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 directory – Ram Prasad Jun 02 '16 at 07:32
  • @RamPrasad If you did not run bitbake clean on your recipe, do so. Switching a SRC_URI from "git://" to "gitsm://" requires that. – Jussi Kukkonen Jun 02 '16 at 14:12
  • @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 :( – Ram Prasad Jun 03 '16 at 14:41
  • 1
    URL doesn't work anymore. – parsley72 Jul 24 '23 at 04:44
8

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.

mr_georg
  • 3,635
  • 5
  • 35
  • 52
  • 1
    Any idea Why I get access error when trying your solution? ```Cloning into... git@gitlab.com: Permission denied (publickey,keyboard-interactive). fatal: Could not read from remote repository. ``` – Chris Feb 08 '21 at 00:00
  • 1
    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://? – Greg Feb 11 '22 at 11:08
1

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 -
}
duenkich
  • 11
  • 1