mirror of
https://git.yoctoproject.org/poky
synced 2026-04-20 11:28:58 +00:00
bitbake: fetch2/git: refactor check for git-lfs command
Refactor the git-lfs checking: this means both clearer code in the download() function and allows unit testing to monkeypatch the functionality. (Bitbake rev: 33cf9172ded50a869f7201ba463ab9ecc69b8252) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
2c58079222
commit
560358e922
@@ -495,14 +495,8 @@ class Git(FetchMethod):
|
||||
runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, repourl), d, workdir=destdir)
|
||||
|
||||
if self._contains_lfs(ud, d, destdir):
|
||||
if need_lfs:
|
||||
path = d.getVar('PATH')
|
||||
if path:
|
||||
gitlfstool = bb.utils.which(path, "git-lfs", executable=True)
|
||||
if not gitlfstool:
|
||||
raise bb.fetch2.FetchError("Repository %s has LFS content, install git-lfs on host to download (or set lfs=0 to ignore it)" % (repourl))
|
||||
else:
|
||||
bb.note("Could not find 'PATH'")
|
||||
if need_lfs and not self._find_git_lfs(d):
|
||||
raise bb.fetch2.FetchError("Repository %s has LFS content, install git-lfs on host to download (or set lfs=0 to ignore it)" % (repourl))
|
||||
else:
|
||||
bb.note("Repository %s has LFS content but it is not being fetched" % (repourl))
|
||||
|
||||
@@ -570,6 +564,13 @@ class Git(FetchMethod):
|
||||
pass
|
||||
return False
|
||||
|
||||
def _find_git_lfs(self, d):
|
||||
"""
|
||||
Return True if git-lfs can be found, False otherwise.
|
||||
"""
|
||||
import shutil
|
||||
return shutil.which("git-lfs", path=d.getVar('PATH')) is not None
|
||||
|
||||
def _get_repo_url(self, ud):
|
||||
"""
|
||||
Return the repository URL
|
||||
|
||||
Reference in New Issue
Block a user