summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2024-10-26 02:39:52 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-10-28 14:08:33 +0000
commit8d9c02ccfcb2d026a0ed45d288265f8dacfffaee (patch)
tree444ce5002a65c49451d895fc71ef5a17cdf096ce
parent04c1ee924b8aac29f6baa787e7245fd6abe3a9fb (diff)
downloadpoky-8d9c02ccfcb2d026a0ed45d288265f8dacfffaee.tar.gz
bitbake: gitsm: Remove downloads/tmpdir when failed
The tmpdir such as downloads/tmplp3cnemv won't be removed without this fix. (Bitbake rev: 2ba8d3214759142afc11f0a88d80eb30a8bcde3a) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/fetch2/gitsm.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/bitbake/lib/bb/fetch2/gitsm.py b/bitbake/lib/bb/fetch2/gitsm.py
index 17aac6357c..fab4b1164c 100644
--- a/bitbake/lib/bb/fetch2/gitsm.py
+++ b/bitbake/lib/bb/fetch2/gitsm.py
@@ -152,9 +152,11 @@ class GitSM(Git):
152 # unpacked temporarily so that we can examine the .gitmodules file 152 # unpacked temporarily so that we can examine the .gitmodules file
153 if ud.shallow and os.path.exists(ud.fullshallow) and extra_check: 153 if ud.shallow and os.path.exists(ud.fullshallow) and extra_check:
154 tmpdir = tempfile.mkdtemp(dir=d.getVar("DL_DIR")) 154 tmpdir = tempfile.mkdtemp(dir=d.getVar("DL_DIR"))
155 runfetchcmd("tar -xzf %s" % ud.fullshallow, d, workdir=tmpdir) 155 try:
156 self.process_submodules(ud, tmpdir, subfunc, d) 156 runfetchcmd("tar -xzf %s" % ud.fullshallow, d, workdir=tmpdir)
157 shutil.rmtree(tmpdir) 157 self.process_submodules(ud, tmpdir, subfunc, d)
158 finally:
159 shutil.rmtree(tmpdir)
158 else: 160 else:
159 self.process_submodules(ud, ud.clonedir, subfunc, d) 161 self.process_submodules(ud, ud.clonedir, subfunc, d)
160 162