summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/git.py
diff options
context:
space:
mode:
authorPhilip Lorenz <philip.lorenz@bmw.de>2025-04-29 10:11:21 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-05-08 11:37:32 +0100
commit9962d198c82d64a1562844f66ba67aba590fa7e4 (patch)
tree26e2398d3e02a9e3d52e1221436738d467c9e834 /bitbake/lib/bb/fetch2/git.py
parent74945e467895d6dd444f7ccf8d2a41eac63604ae (diff)
downloadpoky-9962d198c82d64a1562844f66ba67aba590fa7e4.tar.gz
bitbake: fetch2: Use git-lfs fetch to download objects
Its not clear which exact git-lfs versions failed to work with bare repositories, however git-lfs 2.13.2 which is shipped by Debian 10 (i.e. the oldest supported distribution by scarthgap) shows no issue when fetching into a bare repository. Switch to git-lfs fetch which in turn eliminates issues seen when using the gitsm fetcher with submodules utilizing lfs. In these scenarios, fetching of LFS objects did not actually happen as the gitsm fetcher parametrizes the to be fetched repositories with `bareclone=1` which in turn means that the target revision was never checked out (and therefore no LFS objects were fetched). (Bitbake rev: 501d3317df5780a5b0e3c2562b26ed276c1dbe90) Signed-off-by: Philip Lorenz <philip.lorenz@bmw.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/git.py')
-rw-r--r--bitbake/lib/bb/fetch2/git.py25
1 files changed, 1 insertions, 24 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 9b2ad455c9..11cda2007d 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -482,30 +482,7 @@ class Git(FetchMethod):
482 raise bb.fetch2.FetchError("Unable to find revision %s even from upstream" % missing_rev) 482 raise bb.fetch2.FetchError("Unable to find revision %s even from upstream" % missing_rev)
483 483
484 if self.lfs_need_update(ud, d): 484 if self.lfs_need_update(ud, d):
485 # Unpack temporary working copy, use it to run 'git checkout' to force pre-fetching 485 self.lfs_fetch(ud, d, ud.clonedir, ud.revision)
486 # of all LFS blobs needed at the srcrev.
487 #
488 # It would be nice to just do this inline here by running 'git-lfs fetch'
489 # on the bare clonedir, but that operation requires a working copy on some
490 # releases of Git LFS.
491 with tempfile.TemporaryDirectory(dir=d.getVar('DL_DIR')) as tmpdir:
492 # Do the checkout. This implicitly involves a Git LFS fetch.
493 Git.unpack(self, ud, tmpdir, d)
494
495 # Scoop up a copy of any stuff that Git LFS downloaded. Merge them into
496 # the bare clonedir.
497 #
498 # As this procedure is invoked repeatedly on incremental fetches as
499 # a recipe's SRCREV is bumped throughout its lifetime, this will
500 # result in a gradual accumulation of LFS blobs in <ud.clonedir>/lfs
501 # corresponding to all the blobs reachable from the different revs
502 # fetched across time.
503 #
504 # Only do this if the unpack resulted in a .git/lfs directory being
505 # created; this only happens if at least one blob needed to be
506 # downloaded.
507 if os.path.exists(os.path.join(ud.destdir, ".git", "lfs")):
508 runfetchcmd("tar -cf - lfs | tar -xf - -C %s" % ud.clonedir, d, workdir="%s/.git" % ud.destdir)
509 486
510 def lfs_fetch(self, ud, d, clonedir, revision, fetchall=False, progresshandler=None): 487 def lfs_fetch(self, ud, d, clonedir, revision, fetchall=False, progresshandler=None):
511 """Helper method for fetching Git LFS data""" 488 """Helper method for fetching Git LFS data"""