[bitbake-devel,RFC] fetch2/git.py: update way to check contains lfs

Submitted by changqing.li@windriver.com on April 9, 2020, 9:48 a.m. | Patch ID: 171818

Details

Message ID 1586425698-355751-1-git-send-email-changqing.li@windriver.com
State New
Headers show

Commit Message

changqing.li@windriver.com April 9, 2020, 9:48 a.m.
From: Changqing Li <changqing.li@windriver.com>

Fix below do_unpack failure since "_contains_lfs" check
result is wrong:
Fetcher failure: Repository ... has LFS content, install git-lfs on host
to download (or set lfs=0 to ignore it)

Take recipe freeradius as example:
current freeradius is version 3.0.20, and branch is v3.0.x.
and it don't contains lfs. but since we checked HEAD, which is
point to master by default, _contains_lfs will think it contains lfs
since the master contains lfs, and meantime, we don't have
git-lfs on host, so unpack will failed.

Fixed by check on the configured branch.

Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 bitbake/lib/bb/fetch2/git.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 5b3793a..3c5e200 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -563,8 +563,8 @@  class Git(FetchMethod):
         """
         Check if the repository has 'lfs' (large file) content
         """
-        cmd = "%s grep lfs HEAD:.gitattributes | wc -l" % (
-                ud.basecmd)
+        cmd = "%s grep lfs origin/%s:.gitattributes | wc -l" % (
+                ud.basecmd, ud.branches[ud.names[0]])
         try:
             output = runfetchcmd(cmd, d, quiet=True, workdir=wd)
             if int(output) > 0: