summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py2
-rw-r--r--bitbake/lib/bb/fetch2/gitsm.py26
2 files changed, 20 insertions, 8 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 7b75d5d83a..224408de0f 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -1606,7 +1606,7 @@ class FetchMethod(object):
1606 if urlpath.find("/") != -1: 1606 if urlpath.find("/") != -1:
1607 destdir = urlpath.rsplit("/", 1)[0] + '/' 1607 destdir = urlpath.rsplit("/", 1)[0] + '/'
1608 bb.utils.mkdirhier("%s/%s" % (unpackdir, destdir)) 1608 bb.utils.mkdirhier("%s/%s" % (unpackdir, destdir))
1609 cmd = 'cp -fpPRH "%s" "%s"' % (file, destdir) 1609 cmd = 'cp --force --preserve=timestamps --no-dereference --recursive -H "%s" "%s"' % (file, destdir)
1610 else: 1610 else:
1611 urldata.unpack_tracer.unpack("archive-extract", unpackdir) 1611 urldata.unpack_tracer.unpack("archive-extract", unpackdir)
1612 1612
diff --git a/bitbake/lib/bb/fetch2/gitsm.py b/bitbake/lib/bb/fetch2/gitsm.py
index fab4b1164c..ef19053330 100644
--- a/bitbake/lib/bb/fetch2/gitsm.py
+++ b/bitbake/lib/bb/fetch2/gitsm.py
@@ -123,7 +123,7 @@ class GitSM(Git):
123 url += ";name=%s" % module 123 url += ";name=%s" % module
124 url += ";subpath=%s" % module 124 url += ";subpath=%s" % module
125 url += ";nobranch=1" 125 url += ";nobranch=1"
126 url += ";lfs=%s" % self._need_lfs(ud) 126 url += ";lfs=%s" % ("1" if self._need_lfs(ud) else "0")
127 # Note that adding "user=" here to give credentials to the 127 # Note that adding "user=" here to give credentials to the
128 # submodule is not supported. Since using SRC_URI to give git:// 128 # submodule is not supported. Since using SRC_URI to give git://
129 # URL a password is not supported, one have to use one of the 129 # URL a password is not supported, one have to use one of the
@@ -243,12 +243,24 @@ class GitSM(Git):
243 ret = self.process_submodules(ud, ud.destdir, unpack_submodules, d) 243 ret = self.process_submodules(ud, ud.destdir, unpack_submodules, d)
244 244
245 if not ud.bareclone and ret: 245 if not ud.bareclone and ret:
246 # All submodules should already be downloaded and configured in the tree. This simply 246 cmdprefix = ""
247 # sets up the configuration and checks out the files. The main project config should 247 # Avoid LFS smudging (replacing the LFS pointers with the actual content) when LFS shouldn't be used but git-lfs is installed.
248 # remain unmodified, and no download from the internet should occur. As such, lfs smudge 248 if not self._need_lfs(ud):
249 # should also be skipped as these files were already smudged in the fetch stage if lfs 249 cmdprefix = "GIT_LFS_SKIP_SMUDGE=1 "
250 # was enabled. 250 runfetchcmd("%s%s submodule update --recursive --no-fetch" % (cmdprefix, ud.basecmd), d, quiet=True, workdir=ud.destdir)
251 runfetchcmd("GIT_LFS_SKIP_SMUDGE=1 %s submodule update --recursive --no-fetch" % (ud.basecmd), d, quiet=True, workdir=ud.destdir) 251 def clean(self, ud, d):
252 def clean_submodule(ud, url, module, modpath, workdir, d):
253 url += ";bareclone=1;nobranch=1"
254 try:
255 newfetch = Fetch([url], d, cache=False)
256 newfetch.clean()
257 except Exception as e:
258 logger.warning('gitsm: submodule clean failed: %s %s' % (type(e).__name__, str(e)))
259
260 self.call_process_submodules(ud, d, True, clean_submodule)
261
262 # Clean top git dir
263 Git.clean(self, ud, d)
252 264
253 def implicit_urldata(self, ud, d): 265 def implicit_urldata(self, ud, d):
254 import shutil, subprocess, tempfile 266 import shutil, subprocess, tempfile