summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2024-10-26 02:39:52 -0700
committerSteve Sakoman <steve@sakoman.com>2024-11-02 06:12:00 -0700
commit80bb376273a9f680405d7efeff9fd9118d312b39 (patch)
treed23c416f0a6085854a58eb538ea0b0ec739b334e /bitbake/lib
parentd0073c82ad54f5b362895b9f623dd124030e4433 (diff)
downloadpoky-80bb376273a9f680405d7efeff9fd9118d312b39.tar.gz
bitbake: gitsm: Remove downloads/tmpdir when failed
The tmpdir such as downloads/tmplp3cnemv won't be removed without this fix. (Bitbake rev: 6894f68204130713d3651fceacadc7f8061174a8) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 2ba8d3214759142afc11f0a88d80eb30a8bcde3a) Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'bitbake/lib')
-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