summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorNaveen Saini <naveen.kumar.saini@intel.com>2019-05-13 21:40:28 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-05-15 21:52:57 +0100
commit6e3a4d7926296380da23536c29af35d5702e02fb (patch)
tree4efbb9706e4b86e42272862269f73e251290e100 /bitbake
parenteab2d05025d530091c533acd5003a1558376ae0e (diff)
downloadpoky-6e3a4d7926296380da23536c29af35d5702e02fb.tar.gz
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: 7107c1953b4c949b81491295e03736beb085b055) Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/git.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 8185bf4db0..c69d25c914 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -503,6 +503,17 @@ class Git(FetchMethod):
503 503
504 repourl = self._get_repo_url(ud) 504 repourl = self._get_repo_url(ud)
505 runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, repourl), d, workdir=destdir) 505 runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, repourl), d, workdir=destdir)
506
507 if self._contains_lfs(ud, d, destdir):
508 path = d.getVar('PATH')
509 if path:
510 gitlfstool = bb.utils.which(path, "git-lfs", executable=True)
511 if not gitlfstool:
512 raise bb.fetch2.FetchError("Repository %s has lfs content, install git-lfs plugin on host to download" % (repourl))
513 else:
514 bb.note("Could not find 'PATH'")
515
516
506 if not ud.nocheckout: 517 if not ud.nocheckout:
507 if subdir != "": 518 if subdir != "":
508 runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.revisions[ud.names[0]], readpathspec), d, 519 runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.revisions[ud.names[0]], readpathspec), d,
@@ -553,6 +564,20 @@ class Git(FetchMethod):
553 raise bb.fetch2.FetchError("The command '%s' gave output with more then 1 line unexpectedly, output: '%s'" % (cmd, output)) 564 raise bb.fetch2.FetchError("The command '%s' gave output with more then 1 line unexpectedly, output: '%s'" % (cmd, output))
554 return output.split()[0] != "0" 565 return output.split()[0] != "0"
555 566
567 def _contains_lfs(self, ud, d, wd):
568 """
569 Check if the repository has 'lfs' (large file) content
570 """
571 cmd = "%s grep lfs HEAD:.gitattributes | wc -l" % (
572 ud.basecmd)
573 try:
574 output = runfetchcmd(cmd, d, quiet=True, workdir=wd)
575 if int(output) > 0:
576 return True
577 except (bb.fetch2.FetchError,ValueError):
578 pass
579 return False
580
556 def _get_repo_url(self, ud): 581 def _get_repo_url(self, ud):
557 """ 582 """
558 Return the repository URL 583 Return the repository URL