Skip to contentSkip to conversation

Two fixes about cleaning up temp dir

PATCH New Chen Qi 1 participant 3 messages Jul 19, 2019

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

cover Two fixes about cleaning up temp dir

*** BLURB HERE ***
The following changes since commit ecf098877522508875ccff8c56cd7fee0fa3762a:

distro/include: Add poky-distro-alt-test-config.inc (2019-07-19 08:46:04 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib ChenQi/temp-clean
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/temp-clean

Chen Qi (2):
runtime_test.py: use track_for_cleanup for temp dir
devtool: remove temp dir in upgrade

 meta/lib/oeqa/selftest/cases/runtime_test.py | 4 +---
 scripts/lib/devtool/upgrade.py               | 1 +
 2 files changed, 2 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/2 runtime_test.py: use track_for_cleanup for temp dir

Use track_for_cleanup for temp dir to avoid such temp dir being not cleaned up when something goes wrong, e.g., building image failure.

---
 meta/lib/oeqa/selftest/cases/runtime_test.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
meta/lib/oeqa/selftest/cases/runtime_test.py +1 -3
index d817b75..20969d2 100644
@@ -153,6 +153,7 @@ class TestImage(OESelftestTestCase):
 
         # Enable package feed signing
         self.gpg_home = tempfile.mkdtemp(prefix="oeqa-feed-sign-")
+        self.track_for_cleanup(self.gpg_home)
         signing_key_dir = os.path.join(self.testlayer_path, 'files', 'signing')
         runCmd('gpg --batch --homedir %s --import %s' % (self.gpg_home, os.path.join(signing_key_dir, 'key.secret')), native_sysroot=get_bb_var("RECIPE_SYSROOT_NATIVE", "gnupg-native"))
         features += 'INHERIT += "sign_package_feed"\n'
@@ -165,9 +166,6 @@ class TestImage(OESelftestTestCase):
         bitbake('core-image-full-cmdline socat')
         bitbake('-c testimage core-image-full-cmdline')
 
-        # remove the oeqa-feed-sign temporal directory
-        shutil.rmtree(self.gpg_home, ignore_errors=True)
-
     def test_testimage_virgl_gtk(self):
         """
         Summary: Check host-assisted accelerate OpenGL functionality in qemu with gtk frontend
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH 2/2 devtool: remove temp dir in upgrade

In reply to Chen Qi

For now, the temp dir is left in system, although the temporary source directory has been cleaned up. So we clean it up too.

---
 scripts/lib/devtool/upgrade.py | 1 +
 1 file changed, 1 insertion(+)
scripts/lib/devtool/upgrade.py +1 -0
index 706f91c..18c5b66 100644
@@ -281,6 +281,7 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, srcbranch, branch, kee
             logger.info('Preserving temporary directory %s' % tmpsrctree)
         else:
             shutil.rmtree(tmpsrctree)
+            shutil.rmtree(tmpdir)
 
     return (rev, md5, sha256, srcbranch, srcsubdir_rel)
 
Signature · 1 line
1.9.1