Skip to contentSkip to conversation

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

RFC PATCH Changqing Li 1 participant 1 message Apr 9, 2020 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 26 lines · Changqing Li

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 +0 -0
index 5b3793a..3c5e200 100644

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 570

Quoted 10 lines
bitbake/lib/bb/fetch2/git.py +2 -2
@@ -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:

This can fix mismatch caused by branch,  but I think maybe there still

maybe mismatch caused by different version, like version 3.0.20 / 3.0.21.

what is your opinion about this?

Quoted 2 lines