summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/signing.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/selftest/signing.py')
-rw-r--r--meta/lib/oeqa/selftest/signing.py32
1 files changed, 10 insertions, 22 deletions
diff --git a/meta/lib/oeqa/selftest/signing.py b/meta/lib/oeqa/selftest/signing.py
index 1babca07df..beafd63794 100644
--- a/meta/lib/oeqa/selftest/signing.py
+++ b/meta/lib/oeqa/selftest/signing.py
@@ -12,30 +12,18 @@ from oeqa.utils.ftools import write_file
12class Signing(oeSelfTest): 12class Signing(oeSelfTest):
13 13
14 gpg_dir = "" 14 gpg_dir = ""
15 pub_key_name = 'key.pub' 15 pub_key_path = ""
16 secret_key_name = 'key.secret' 16 secret_key_path = ""
17 17
18 @classmethod 18 @classmethod
19 def setUpClass(cls): 19 def setUpClass(cls):
20 # Import the gpg keys 20 cls.gpg_home_dir = tempfile.TemporaryDirectory(prefix="oeqa-signing-")
21 cls.gpg_dir = cls.gpg_home_dir.name
21 22
22 cls.gpg_dir = os.path.join(cls.testlayer_path, 'files/signing/') 23 cls.pub_key_path = os.path.join(cls.testlayer_path, 'files', 'signing', "key.pub")
24 cls.secret_key_path = os.path.join(cls.testlayer_path, 'files', 'signing', "key.secret")
23 25
24 # key.secret key.pub are located in gpg_dir 26 runCmd('gpg --homedir %s --import %s %s' % (cls.gpg_dir, cls.pub_key_path, cls.secret_key_path))
25 pub_key_location = cls.gpg_dir + cls.pub_key_name
26 secret_key_location = cls.gpg_dir + cls.secret_key_name
27 runCmd('gpg --homedir %s --import %s %s' % (cls.gpg_dir, pub_key_location, secret_key_location))
28
29 @classmethod
30 def tearDownClass(cls):
31 # Delete the files generated by 'gpg --import'
32
33 gpg_files = glob.glob(cls.gpg_dir + '*.gpg*')
34 random_seed_file = cls.gpg_dir + 'random_seed'
35 gpg_files.append(random_seed_file)
36
37 for gpg_file in gpg_files:
38 runCmd('rm -f ' + gpg_file)
39 27
40 @testcase(1362) 28 @testcase(1362)
41 def test_signing_packages(self): 29 def test_signing_packages(self):
@@ -57,7 +45,7 @@ class Signing(oeSelfTest):
57 feature = 'INHERIT += "sign_rpm"\n' 45 feature = 'INHERIT += "sign_rpm"\n'
58 feature += 'RPM_GPG_PASSPHRASE = "test123"\n' 46 feature += 'RPM_GPG_PASSPHRASE = "test123"\n'
59 feature += 'RPM_GPG_NAME = "testuser"\n' 47 feature += 'RPM_GPG_NAME = "testuser"\n'
60 feature += 'RPM_GPG_PUBKEY = "%s%s"\n' % (self.gpg_dir, self.pub_key_name) 48 feature += 'RPM_GPG_PUBKEY = "%s"\n' % self.pub_key_path
61 feature += 'GPG_PATH = "%s"\n' % self.gpg_dir 49 feature += 'GPG_PATH = "%s"\n' % self.gpg_dir
62 50
63 self.write_config(feature) 51 self.write_config(feature)
@@ -81,8 +69,8 @@ class Signing(oeSelfTest):
81 # Use a temporary rpmdb 69 # Use a temporary rpmdb
82 rpmdb = tempfile.mkdtemp(prefix='oeqa-rpmdb') 70 rpmdb = tempfile.mkdtemp(prefix='oeqa-rpmdb')
83 71
84 runCmd('%s/rpm --define "_dbpath %s" --import %s%s' % 72 runCmd('%s/rpm --define "_dbpath %s" --import %s' %
85 (staging_bindir_native, rpmdb, self.gpg_dir, self.pub_key_name)) 73 (staging_bindir_native, rpmdb, self.pub_key_path))
86 74
87 ret = runCmd('%s/rpm --define "_dbpath %s" --checksig %s' % 75 ret = runCmd('%s/rpm --define "_dbpath %s" --checksig %s' %
88 (staging_bindir_native, rpmdb, pkg_deploy)) 76 (staging_bindir_native, rpmdb, pkg_deploy))