diff options
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index 5fd63b4e33..2d1d2cabd5 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -495,14 +495,8 @@ class Git(FetchMethod): | |||
495 | runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, repourl), d, workdir=destdir) | 495 | runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, repourl), d, workdir=destdir) |
496 | 496 | ||
497 | if self._contains_lfs(ud, d, destdir): | 497 | if self._contains_lfs(ud, d, destdir): |
498 | if need_lfs: | 498 | if need_lfs and not self._find_git_lfs(d): |
499 | path = d.getVar('PATH') | 499 | raise bb.fetch2.FetchError("Repository %s has LFS content, install git-lfs on host to download (or set lfs=0 to ignore it)" % (repourl)) |
500 | if path: | ||
501 | gitlfstool = bb.utils.which(path, "git-lfs", executable=True) | ||
502 | if not gitlfstool: | ||
503 | raise bb.fetch2.FetchError("Repository %s has LFS content, install git-lfs on host to download (or set lfs=0 to ignore it)" % (repourl)) | ||
504 | else: | ||
505 | bb.note("Could not find 'PATH'") | ||
506 | else: | 500 | else: |
507 | bb.note("Repository %s has LFS content but it is not being fetched" % (repourl)) | 501 | bb.note("Repository %s has LFS content but it is not being fetched" % (repourl)) |
508 | 502 | ||
@@ -570,6 +564,13 @@ class Git(FetchMethod): | |||
570 | pass | 564 | pass |
571 | return False | 565 | return False |
572 | 566 | ||
567 | def _find_git_lfs(self, d): | ||
568 | """ | ||
569 | Return True if git-lfs can be found, False otherwise. | ||
570 | """ | ||
571 | import shutil | ||
572 | return shutil.which("git-lfs", path=d.getVar('PATH')) is not None | ||
573 | |||
573 | def _get_repo_url(self, ud): | 574 | def _get_repo_url(self, ud): |
574 | """ | 575 | """ |
575 | Return the repository URL | 576 | Return the repository URL |