[oe-commits] [openembedded-core] 23/25: selftest/cases/signing: ignore removal errors when cleaning temporary gpg directory

git at git.openembedded.org git at git.openembedded.org
Mon Sep 11 22:52:48 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 3f58ac1012f1c8a5c67d8eccedfc6995cf3521a8
Author: Leonardo Sandoval <leonardo.sandoval.gonzalez at linux.intel.com>
AuthorDate: Thu Sep 7 15:52:54 2017 -0500

    selftest/cases/signing: ignore removal errors when cleaning temporary gpg directory
    
    The high-level method tempfile.TemporaryDirectory give us no way to
    ignore erros on removal thus use tempfile.mkdtemp instead. Ignoring possible issues
    on removal is neccesary because it contains gpg sockets that are automatically removed
    by the system once the process terminates, otherwise the following log is observed:
    
      ..
      ..
      File "/usr/lib/python3.5/shutil.py", line 436, in _rmtree_safe_fd
        os.unlink(name, dir_fd=topfd)
      FileNotFoundError: [Errno 2] No such file or directory: 'S.gpg-agent.browser'
    
    [YOCTO #11821]
    
    Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oeqa/selftest/cases/signing.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/signing.py b/meta/lib/oeqa/selftest/cases/signing.py
index edb5f65..b3d1a82 100644
--- a/meta/lib/oeqa/selftest/cases/signing.py
+++ b/meta/lib/oeqa/selftest/cases/signing.py
@@ -22,14 +22,17 @@ class Signing(OESelftestTestCase):
         if not shutil.which("gpg"):
             raise AssertionError("This test needs GnuPG")
 
-        cls.gpg_home_dir = tempfile.TemporaryDirectory(prefix="oeqa-signing-")
-        cls.gpg_dir = cls.gpg_home_dir.name
+        cls.gpg_dir = tempfile.mkdtemp(prefix="oeqa-signing-")
 
         cls.pub_key_path = os.path.join(cls.testlayer_path, 'files', 'signing', "key.pub")
         cls.secret_key_path = os.path.join(cls.testlayer_path, 'files', 'signing', "key.secret")
 
         runCmd('gpg --batch --homedir %s --import %s %s' % (cls.gpg_dir, cls.pub_key_path, cls.secret_key_path))
 
+    @classmethod
+    def tearDownClass(cls):
+        shutil.rmtree(cls.gpg_dir, ignore_errors=True)
+
     @OETestID(1362)
     def test_signing_packages(self):
         """

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list