Skip to contentSkip to conversation

gitsm: tolerate git-lfs in submodules

PATCH Superseded [email protected] 2 participants 2 messages Aug 19, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitsm: tolerate git-lfs in submodules

From: Randolph Sapp <[email protected]>

Explicitly pass down the lfs parameter from the source repo URI to submodules. Add smudge skip to final checkout phase to make sure we don't access the network here. Everything should have been fetched and setup from the lfs logic in the git fetcher at this point.

---
 lib/bb/fetch2/gitsm.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
lib/bb/fetch2/gitsm.py +7 -4
index 47225b97..a87361cc 100644
@@ -123,6 +123,7 @@ class GitSM(Git):
             url += ";name=%s" % module
             url += ";subpath=%s" % module
             url += ";nobranch=1"
+            url += ";lfs=%s" % self._need_lfs(ud)
             # Note that adding "user=" here to give credentials to the
             # submodule is not supported. Since using SRC_URI to give git://
             # URL a password is not supported, one have to use one of the
@@ -242,10 +243,12 @@ class GitSM(Git):
         ret = self.process_submodules(ud, ud.destdir, unpack_submodules, d)
 
         if not ud.bareclone and ret:
-            # All submodules should already be downloaded and configured in the tree.  This simply sets
-            # up the configuration and checks out the files.  The main project config should remain
-            # unmodified, and no download from the internet should occur.
-            runfetchcmd("%s submodule update --recursive --no-fetch" % (ud.basecmd), d, quiet=True, workdir=ud.destdir)
+            # All submodules should already be downloaded and configured in the tree.  This simply
+            # sets up the configuration and checks out the files.  The main project config should
+            # remain unmodified, and no download from the internet should occur. As such, lfs smudge
+            # should also be skipped as these files were already smudged in the fetch stage if lfs
+            # was enabled.
+            runfetchcmd("GIT_LFS_SKIP_SMUDGE=1 %s submodule update --recursive --no-fetch" % (ud.basecmd), d, quiet=True, workdir=ud.destdir)
 
     def implicit_urldata(self, ud, d):
         import shutil, subprocess, tempfile
Signature · 1 line
2.41.0
#1 lore raw

Please add [YOCTO #14938] tag as this might help with that ticket.

Quoted 66 lines · Randolph Sapp via lists.openembedded.org

From: Randolph Sapp <[email protected]>

Explicitly pass down the lfs parameter from the source repo URI to submodules. Add smudge skip to final checkout phase to make sure we don't access the network here. Everything should have been fetched and setup from the lfs logic in the git fetcher at this point.

---
 lib/bb/fetch2/gitsm.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
lib/bb/fetch2/gitsm.py +1 -0
index 47225b97..a87361cc 100644
@@ -123,6 +123,7 @@ class GitSM(Git):
             url += ";name=%s" % module
             url += ";subpath=%s" % module
             url += ";nobranch=1"
+            url += ";lfs=%s" % self._need_lfs(ud)
             # Note that adding "user=" here to give credentials to the
             # submodule is not supported. Since using SRC_URI to give

git://
# URL a password is not supported, one have to use one of the

lib/bb/fetch2/gitsm.py +0 -1
@@ -242,10 +243,12 @@ class GitSM(Git):
         ret = self.process_submodules(ud, ud.destdir, unpack_submodules,
 d)
 
         if not ud.bareclone and ret:
-            # All submodules should already be downloaded and configured

in the tree. This simply sets
- # up the configuration and checks out the files. The main
project config should remain

lib/bb/fetch2/gitsm.py +0 -2
-            # unmodified, and no download from the internet should occur.
-            runfetchcmd("%s submodule update --recursive --no-fetch" %

(ud.basecmd), d, quiet=True, workdir=ud.destdir)
+ # All submodules should already be downloaded and configured
in the tree. This simply
+ # sets up the configuration and checks out the files. The
main project config should
+ # remain unmodified, and no download from the internet should
occur. As such, lfs smudge
+ # should also be skipped as these files were already smudged
in the fetch stage if lfs

lib/bb/fetch2/gitsm.py +2 -2
+            # was enabled.
+            runfetchcmd("GIT_LFS_SKIP_SMUDGE=1 %s submodule update
--recursive --no-fetch" % (ud.basecmd), d, quiet=True, workdir=ud.destdir)
 
     def implicit_urldata(self, ud, d):
         import shutil, subprocess, tempfile
--

2.41.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#14953):
https://lists.openembedded.org/g/bitbake-devel/message/14953
Mute This Topic: https://lists.openembedded.org/mt/100831879/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-