mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
bitbake: bitbake: fetch2/git: git-lfs check
Build will fail if repository has lfs contents in absense of git-lfs tool on host. Build will pass if repository may or may not contains lfs content if host has git-lfs installed. [YOCTO #13198] (Bitbake rev: 3f2c2eb2f59707828bdcdd6414db837da8dc3b0e) Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
6b74b69b23
commit
e7c2bc67b5
|
@ -503,6 +503,17 @@ class Git(FetchMethod):
|
||||||
|
|
||||||
repourl = self._get_repo_url(ud)
|
repourl = self._get_repo_url(ud)
|
||||||
runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, repourl), d, workdir=destdir)
|
runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, repourl), d, workdir=destdir)
|
||||||
|
|
||||||
|
if self._contains_lfs(ud, d, destdir):
|
||||||
|
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 plugin on host to download" % (repourl))
|
||||||
|
else:
|
||||||
|
bb.note("Could not find 'PATH'")
|
||||||
|
|
||||||
|
|
||||||
if not ud.nocheckout:
|
if not ud.nocheckout:
|
||||||
if subdir != "":
|
if subdir != "":
|
||||||
runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.revisions[ud.names[0]], readpathspec), d,
|
runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.revisions[ud.names[0]], readpathspec), d,
|
||||||
|
@ -553,6 +564,20 @@ class Git(FetchMethod):
|
||||||
raise bb.fetch2.FetchError("The command '%s' gave output with more then 1 line unexpectedly, output: '%s'" % (cmd, output))
|
raise bb.fetch2.FetchError("The command '%s' gave output with more then 1 line unexpectedly, output: '%s'" % (cmd, output))
|
||||||
return output.split()[0] != "0"
|
return output.split()[0] != "0"
|
||||||
|
|
||||||
|
def _contains_lfs(self, ud, d, wd):
|
||||||
|
"""
|
||||||
|
Check if the repository has 'lfs' (large file) content
|
||||||
|
"""
|
||||||
|
cmd = "%s grep lfs HEAD:.gitattributes | wc -l" % (
|
||||||
|
ud.basecmd)
|
||||||
|
try:
|
||||||
|
output = runfetchcmd(cmd, d, quiet=True, workdir=wd)
|
||||||
|
if int(output) > 0:
|
||||||
|
return True
|
||||||
|
except (bb.fetch2.FetchError,ValueError):
|
||||||
|
pass
|
||||||
|
return False
|
||||||
|
|
||||||
def _get_repo_url(self, ud):
|
def _get_repo_url(self, ud):
|
||||||
"""
|
"""
|
||||||
Return the repository URL
|
Return the repository URL
|
||||||
|
|
Loading…
Reference in New Issue
Block a user