]> code.ossystems Code Review - openembedded-core.git/commitdiff
oe/gpg_sign: add verify() method
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Wed, 10 Feb 2016 14:15:55 +0000 (16:15 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 18 Feb 2016 22:55:11 +0000 (22:55 +0000)
A new method for verifying detached signatures.

[YOCTO #9006]

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/gpg_sign.py

index 821787ec7ec3414a6942cfbf16b2ba2f5f1ec044..a4f310e536bf3f17e6849e50557b52dd01027f2f 100644 (file)
@@ -65,6 +65,16 @@ class LocalSigner(object):
             raise bb.build.FuncFailed("Failed to create signature for '%s': %s" %
                                       (input_file, output))
 
+    def verify(self, sig_file):
+        """Verify signature"""
+        cmd = self.gpg_bin + " --verify "
+        if self.gpg_path:
+            cmd += "--homedir %s " % self.gpg_path
+        cmd += sig_file
+        status, _ = oe.utils.getstatusoutput(cmd)
+        ret = False if status else True
+        return ret
+
 
 def get_signer(d, backend, keyid, passphrase_file):
     """Get signer object for the specified backend"""