Re: Pull a single file using git lfs


Quentin Schulz
 

Hi Andy,

On Wed, Dec 18, 2019 at 10:46:17AM +0000, Andy Pont wrote:
Hello,

I have a private git repo on our GitLab server that contains a bunch of
source files that came as part of a commercial product and the final binary
executable is also stored there using “git lfs”.

I’m trying to figure out how to create a bitbake recipe so that in the
do_fetch() stage it just pulls the single binary file. I think the file can
be got using “git lfs checkout path/to/file” but I’m not sure how to make it
connect to the repo and not do a regular “git pull”.
I unfortunately don't have experience with git lfs.

I'm thinking about the subpath argument to SRC_URI git fetcher.

https://www.yoctoproject.org/docs/current/bitbake-user-manual/bitbake-user-manual.html#git-fetcher

""subpath": Limits the checkout to a specific subpath of the tree. By
default, the whole tree is checked out."

So maybe by giving the path to the file you'll be able to get it without
the whole repo. Provided you're able to get those files with git pull
and not git lfs.

The other thing could be to use a do_fetch_append() with the call to git
lfs in there. I think the git used in that task will be the host one, so
you should then have support for git lfs provided you installed it on
the build machine.

Hopefully I'm not answering with complete non-sense, and giving you some
hints on what to test a bit more :)

Good luck,
Quentin

Join yocto@lists.yoctoproject.org to automatically receive all group messages.