0

I'm trying to write a recipe to include files from a private repository to my rootfs. Until now I cloned the repository to a local folder and used the following recipe to copy them to the rootfs

SUMMARY = "my test data"
DESCRIPTION = "test data"
LICENSE = "CLOSED"

MY_FILES = "${THISDIR}/data/*"
MY_DESTINATION = "/home/root/testdata"

do_install(){
        install -d ${D}${MY_DESTINATION}
        cp -r ${MY_FILES} ${D}${MY_DESTINATION}
}

FILES_${PN} += "${MY_DESTINATION}"

Can anyone tell me what I need to change in my recipe that it will clone the repo by itself and copy the files to the rootfs? The files are mainly python scripts and some data, so no need for compilation or something.

Thanks in advance, chill

current recipe:

SUMMARY = "my test data"
DESCRIPTION = "test data"
LICENSE = "CLOSED"

#repo address
SRC_URI = "git://......;protocol=https;branch=develop;"
#SHA of desired commit
SRCREV = "....." 
S = "${WORKDIR}/git"

MY_DESTINATION = "/home/root/testdata"

inherit allarch

do_install(){
        install -d ${D}${MY_DESTINATION}
        cp -r ${S} ${D}${MY_DESTINATION}
}

FILES_${PN} += "${MY_DESTINATION}"
chillking
  • 311
  • 1
  • 9
  • 1
    Use `SRC_URI` variable to point to the the git repo – Oleksandr Kravchuk Apr 12 '21 at 14:10
  • so I define `SRC_URI="git://..."` and use `${SRC_URI}` instead of `${MY_FILES}`? – chillking Apr 12 '21 at 15:06
  • 1
    yes, pretty much; don't forget about `SRCREV` as well. – Oleksandr Kravchuk Apr 12 '21 at 15:26
  • 1
    Not `${SRC_URI}`, `${S}`. BTW, you need to set `${S}` to `${WORKDIR}/git` even though in your case, it should matter much (but then you need to use `${WORKDIR}/git` instead of `${S}`. – qschulz Apr 12 '21 at 18:15
  • I edited the first post with my current recipe. I'm not sure about the SRCREV = "${AUTOREV}" and I guess I have problems with my credentials as bitbake says "Username/Password Authentication Failed". – chillking Apr 13 '21 at 13:33
  • Okay, got it, I changed the SRCREV to an actual commit. The main problem was with `SRC_URI` and to the define the protocol. Thanks @OleksandrKravchuk and @qschulz – chillking Apr 13 '21 at 13:57
  • For the credential problem I followed https://stackoverflow.com/a/14528360/14997346 , if someone else needs this. – chillking Apr 13 '21 at 13:59
  • What files did you have in git repo? I'm in try to copy folder from repo with couple files and sub-fodlers containg and no luck till now ? – Topper Feb 01 '22 at 13:54
  • There are files and folders in my repo, everything is copied to the rootfs. – chillking Feb 01 '22 at 14:55

0 Answers0