Hello,

I'm seeking advice around using Yocto in a mono-repository, 
specifically how to include my own C/C++ applications that have their 
source code stored elsewhere in the same repository (and specifically
not under the recipe's files/ directory, or anywhere in the layer structure).

For example, my project might be structured like this:

  myproject/   (root of repository)
      - src/myapp1  (C++ app with Makefile)
      - src/myapp2  (C app with CMakeLists.txt)
      - yocto/layers/meta-local/myapps/
          - myapp1.bb
          - myapp2.bb

The core of the matter is that the applications' source is not in a 
separate repository, so bitbake's fetcher needs to look locally, rather 
than remote. Having bitbake download the same repository again via git 
seems inefficient, and it's also potentially a huge download.

I've looked at using EXTERNALSRC but it disables devtool, which I really 
need to use. When set to an absolute path (based on TOPDIR), it also 
does weird things with the paths in the build directory, resulting in a 
directory tree that depends on the user's environment (the path to their
home directory, the path to where they checked out the mono-repo, etc).
It is also considered "hacky" and not for production use according to 
some sources. I don't think I can use this.

I've also looked at setting FILESEXTRAPATHS to an absolute directory 
based on TOPDIR, and this actually works, but the Yocto docs seem to 
implicitly discourage this, as my recipe is in a .bb file:

| Best practices dictate that you accomplish this by using FILESEXTRAPATHS from 
within a .bbappend file

What would go wrong if I did set this in a .bb file?

Another option is to have the external system that invokes bitbake (in 
my case, a GitLab-CI pipeline script) make sure that a fresh tarball is 
created from the original source and put into the files/ directory at 
build time. Although this will work, and it seems clunky, if it's the 
best option then I'll use it. Not sure yet how to handle tarball
checksums in this case though.

Is anyone using Yocto in a monorepo? If so, what approach would you
recommend for the mono-repo project structure?

Note: my applications' source files are outside of the Yocto layer tree
because they are independent of Yocto and can be built with other
toolchains - that's why I haven't put them under the files/ directory.

-- David.
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#58787): https://lists.yoctoproject.org/g/yocto/message/58787
Mute This Topic: https://lists.yoctoproject.org/mt/95654029/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to