[oe-commits] [openembedded-core] 02/03: selftest/cases/runtime_test: ignore removal errors when cleaning temporary gpg directory

git at git.openembedded.org git at git.openembedded.org
Mon Sep 25 22:05:36 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 cafbee0ae1ed1dd0a5cd6446d0814af505462f81
Author: Leonardo Sandoval <leonardo.sandoval.gonzalez at linux.intel.com>
AuthorDate: Mon Sep 25 14:02:46 2017 -0700

    selftest/cases/runtime_test: 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'
    
    This is the same fix as 7e3a7cd2426feac757def81850dc44156cd0f33e, but this applies
    to runtime (instead of signing).
    
    [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/runtime_test.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py
index 673b199..67b4fe8 100644
--- a/meta/lib/oeqa/selftest/cases/runtime_test.py
+++ b/meta/lib/oeqa/selftest/cases/runtime_test.py
@@ -147,19 +147,22 @@ class TestImage(OESelftestTestCase):
         features += 'PACKAGE_CLASSES = "package_rpm"\n'
 
         # Enable package feed signing
-        self.gpg_home = tempfile.TemporaryDirectory(prefix="oeqa-feed-sign-")
+        self.gpg_home = tempfile.mkdtemp(prefix="oeqa-feed-sign-")
         signing_key_dir = os.path.join(self.testlayer_path, 'files', 'signing')
-        runCmd('gpg --batch --homedir %s --import %s' % (self.gpg_home.name, os.path.join(signing_key_dir, 'key.secret')))
+        runCmd('gpg --batch --homedir %s --import %s' % (self.gpg_home, os.path.join(signing_key_dir, 'key.secret')))
         features += 'INHERIT += "sign_package_feed"\n'
         features += 'PACKAGE_FEED_GPG_NAME = "testuser"\n'
         features += 'PACKAGE_FEED_GPG_PASSPHRASE_FILE = "%s"\n' % os.path.join(signing_key_dir, 'key.passphrase')
-        features += 'GPG_PATH = "%s"\n' % self.gpg_home.name
+        features += 'GPG_PATH = "%s"\n' % self.gpg_home
         self.write_config(features)
 
         # Build core-image-sato and testimage
         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)
+
 class Postinst(OESelftestTestCase):
     @OETestID(1540)
     def test_verify_postinst(self):

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


More information about the Openembedded-commits mailing list