[bitbake-devel] [PATCH 2/3] fetch2: Gracefully handle corrupt download-cache tarballs
Stefan Klug
stefan.klug at baslerweb.com
Mon Mar 18 13:58:19 UTC 2019
If the fullmirror tarball is corrupt for whatever reason
(IMHO there are no checksums on the download cache)
a series of nasty events was triggered:
- tar left a partially extracted bare git repo there
- on the next yocto build, the corrupt bare repo is
found and bitbake starts to update that bare repo using git
- git fails to detect it as bare repo. Therefore
all following git commands ripple up the directory tree,
in our case modifying a top level git repo.
Signed-off-by: Stefan Klug <stefan.klug at baslerweb.com>
---
lib/bb/fetch2/git.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 1a8ebe3d..d5f9bbcd 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -334,8 +334,11 @@ class Git(FetchMethod):
ud.localpath = ud.fullshallow
return
elif os.path.exists(ud.fullmirror) and not os.path.exists(ud.clonedir):
- bb.utils.mkdirhier(ud.clonedir)
- runfetchcmd("tar -xzf %s" % ud.fullmirror, d, workdir=ud.clonedir)
+ try:
+ bb.utils.mkdirhier(ud.clonedir)
+ runfetchcmd("tar -xzf %s" % ud.fullmirror, d, workdir=ud.clonedir, cleanup=[ud.clonedir])
+ except:
+ logger.info("Extracting tarball of git repository failed, falling back to clone.")
repourl = self._get_repo_url(ud)
--
More information about the bitbake-devel
mailing list