How to setup an Yocto recipe to build from a local git source?
Asked Answered
N

2

23

Hej

I am playing a bit around with Yocto, a Raspberry Pi and some code I have written. I want to build by Yocto an image including the program I have written. I like to know how to setup the fetcher to fetch from a local git repo.

My setup is simple. The code is in the directory:

/home/user/git/myTest

I linked the directory into the directory which contains the recipe of my Yocto meta-layer. The directory is:

/home/user/poky/meta-test/myApp/myTest

Because it is a local git repo, it contains the ".git" folder.

/home/user/git/myTest/.git

Inside the directory there are many files:

/home/user/git/myTest/CMakeLists.txt
/home/user/git/myTest/src/main.cpp
/home/user/git/myTest/src/...

I like to know how to setup my recipe to use the git fetcher:

SUMMARY = "test"
SECTION = "app"
LICENSE = "CLOSED"

inherit cmake

SRCREV = "${AUTOREV}"

SRC_URI = "git://.git"

S = "${WORKDIR}/git"

I did check the Yocto/Bitbake documentation. But I did not find an example suited to do it. Any ideas?

Northwestward answered 28/3, 2018 at 13:28 Comment(0)
V
35

GIT Fetcher in bitbake supports different protocols but with rather peculiar and non-standard syntax. In your case it should be something like

SRC_URI = "git:///home/user/git/myTest/;protocol=file"
Void answered 28/3, 2018 at 13:43 Comment(3)
This non-standard syntax had me really confused when trying SRC_URI = "file:///home/user/git/myTest/;protocol=file".Darice
But I guess it makes sense now after reading 4.3.6. Other Fetchers in the documentation. Thanks!Darice
All other programs (npm or pip for example) use different syntax like git+https://gitlab.com/… so they can easily switch both "fetcher" (VCS) and the protocol. That's why I complain about peculiar and non-standard syntax.Void
T
-4

Like below, you can access from local,

SRC_URI = "git:///home/path.git; file:defconfig"

It will access the respective local file.

Toadfish answered 20/11, 2018 at 11:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.