summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/git.py
diff options
context:
space:
mode:
authorPavel Zhukov <pavel@zhukoff.net>2022-05-25 16:42:45 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-06-08 21:53:15 +0100
commit53ed421226228f60a89a1868819b6c3ed6d45026 (patch)
tree2aac345989677ac78e1414f99a6d15ee132c5995 /bitbake/lib/bb/fetch2/git.py
parent6c43f2369d9777b8de61944f6f3882b74343c7ad (diff)
downloadpoky-53ed421226228f60a89a1868819b6c3ed6d45026.tar.gz
bitbake: fetch2: Honour BB_FETCH_PREMIRRORONLY option
This should fix [Yocto 13353] and related to [Yocto 13233] as well. Previously if git repo mirror has been updated in between of two builds fetcher of the second build didn't try updated mirror but switched to git clone from upstream instead. This is problem for offline builds. Fix this to raise MirrorException if BB_FETCH_PREMIRRORONLY has been specified by the mirror doesn't contain SRC_REV. [YOCTO #13353] [YOCTO #13233] (Bitbake rev: b47ecab3e3aad5c5c376ec023aa82a51aa0f3b86) Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/git.py')
-rw-r--r--bitbake/lib/bb/fetch2/git.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 23f8c0da8f..07b3d9a7ff 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -353,10 +353,15 @@ class Git(FetchMethod):
353 if ud.shallow and os.path.exists(ud.fullshallow) and self.need_update(ud, d): 353 if ud.shallow and os.path.exists(ud.fullshallow) and self.need_update(ud, d):
354 ud.localpath = ud.fullshallow 354 ud.localpath = ud.fullshallow
355 return 355 return
356 elif os.path.exists(ud.fullmirror) and not os.path.exists(ud.clonedir): 356 elif os.path.exists(ud.fullmirror) and self.need_update(ud, d):
357 bb.utils.mkdirhier(ud.clonedir) 357 if not os.path.exists(ud.clonedir):
358 runfetchcmd("tar -xzf %s" % ud.fullmirror, d, workdir=ud.clonedir) 358 bb.utils.mkdirhier(ud.clonedir)
359 359 runfetchcmd("tar -xzf %s" % ud.fullmirror, d, workdir=ud.clonedir)
360 else:
361 tmpdir = tempfile.mkdtemp(dir=d.getVar('DL_DIR'))
362 runfetchcmd("tar -xzf %s" % ud.fullmirror, d, workdir=tmpdir)
363 fetch_cmd = "LANG=C %s fetch -f --progress %s " % (ud.basecmd, shlex.quote(tmpdir))
364 runfetchcmd(fetch_cmd, d, workdir=ud.clonedir)
360 repourl = self._get_repo_url(ud) 365 repourl = self._get_repo_url(ud)
361 366
362 # If the repo still doesn't exist, fallback to cloning it 367 # If the repo still doesn't exist, fallback to cloning it