Skip to contentSkip to conversation

fetch2/git.py: update way to check contains lfs

RFC PATCH New Changqing Li 1 participant 1 message Apr 9, 2020

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 fetch2/git.py: update way to check contains lfs

From: Changqing Li <[email protected]>

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.

---
 bitbake/lib/bb/fetch2/git.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
bitbake/lib/bb/fetch2/git.py +2 -2
index 5b3793a..3c5e200 100644
@@ -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:
Signature · 1 line
2.7.4