From: Markus Lehtonen <markus.lehtonen@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 3/3] package signing: do sanity checking in an event handler
Date: Fri, 5 Feb 2016 16:00:24 +0200 [thread overview]
Message-ID: <1454680824-26075-4-git-send-email-markus.lehtonen@linux.intel.com> (raw)
In-Reply-To: <1454680824-26075-1-git-send-email-markus.lehtonen@linux.intel.com>
This way, one does not get a ton of identical error messages. But, only
one error message before all the recipes are parsed.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
meta/classes/sign_package_feed.bbclass | 26 ++++++++++++++++----------
meta/classes/sign_rpm.bbclass | 26 ++++++++++++++++----------
2 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/meta/classes/sign_package_feed.bbclass b/meta/classes/sign_package_feed.bbclass
index 3f6ff2d..5170562 100644
--- a/meta/classes/sign_package_feed.bbclass
+++ b/meta/classes/sign_package_feed.bbclass
@@ -22,18 +22,24 @@ PACKAGE_FEED_SIGN = '1'
PACKAGE_FEED_GPG_BACKEND ?= 'local'
-python () {
+addhandler sign_package_feed_eventhandler
+sign_package_feed_eventhandler[eventmask] = "bb.event.SanityCheck"
+python sign_package_feed_eventhandler() {
# Check sanity of config
- from oe.gpg_sign import get_signer_class
- signer = get_signer_class(d.getVar('PACKAGE_FEED_GPG_BACKEND', True))
- err_msg = signer.check_sanity(d,
- d.getVar('PACKAGE_FEED_GPG_NAME', True),
- d.getVar('PACKAGE_FEED_GPG_PASSPHRASE_FILE', True))
- if err_msg:
- raise_sanity_error(err_msg %{'keyid': 'PACKAGE_FEED_GPG_NAME',
- 'passphrase_file': 'PACKAGE_FEED_GPG_PASSPHRASE_FILE'},
- d)
+ if bb.event.getName(e) == "SanityCheck":
+ from oe.gpg_sign import get_signer_class
+ d = e.data
+ signer = get_signer_class(d.getVar('PACKAGE_FEED_GPG_BACKEND', True))
+ err_msg = signer.check_sanity(d,
+ d.getVar('PACKAGE_FEED_GPG_NAME', True),
+ d.getVar('PACKAGE_FEED_GPG_PASSPHRASE_FILE', True))
+ if err_msg:
+ raise_sanity_error(err_msg %{'keyid': 'PACKAGE_FEED_GPG_NAME',
+ 'passphrase_file': 'PACKAGE_FEED_GPG_PASSPHRASE_FILE'},
+ d)
+}
+python () {
# Set expected location of the public key
d.setVar('PACKAGE_FEED_GPG_PUBKEY',
os.path.join(d.getVar('STAGING_ETCDIR_NATIVE', False),
diff --git a/meta/classes/sign_rpm.bbclass b/meta/classes/sign_rpm.bbclass
index 79dc517..47a8378 100644
--- a/meta/classes/sign_rpm.bbclass
+++ b/meta/classes/sign_rpm.bbclass
@@ -21,18 +21,24 @@ RPM_SIGN_PACKAGES='1'
RPM_GPG_BACKEND ?= 'local'
-python () {
+addhandler sign_rpm_eventhandler
+sign_rpm_eventhandler[eventmask] = "bb.event.SanityCheck"
+python sign_rpm_eventhandler() {
# Check sanity of config
- from oe.gpg_sign import get_signer_class
- signer = get_signer_class(d.getVar('RPM_GPG_BACKEND', True))
- err_msg = signer.check_sanity(d,
- d.getVar('RPM_GPG_NAME', True),
- d.getVar('RPM_GPG_PASSPHRASE_FILE', True))
- if err_msg:
- raise_sanity_error(err_msg %{'keyid': 'RPM_GPG_NAME',
- 'passphrase_file': 'RPM_GPG_PASSPHRASE_FILE'},
- d)
+ if bb.event.getName(e) == "SanityCheck":
+ from oe.gpg_sign import get_signer_class
+ d = e.data
+ signer = get_signer_class(d.getVar('RPM_GPG_BACKEND', True))
+ err_msg = signer.check_sanity(d,
+ d.getVar('RPM_GPG_NAME', True),
+ d.getVar('RPM_GPG_PASSPHRASE_FILE', True))
+ if err_msg:
+ raise_sanity_error(err_msg %{'keyid': 'RPM_GPG_NAME',
+ 'passphrase_file': 'RPM_GPG_PASSPHRASE_FILE'},
+ d)
+}
+python () {
# Set the expected location of the public key
d.setVar('RPM_GPG_PUBKEY', os.path.join(d.getVar('STAGING_ETCDIR_NATIVE', False),
'RPM-GPG-PUBKEY'))
--
2.6.2
prev parent reply other threads:[~2016-02-05 14:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-05 14:00 [PATCH 0/3] signing: enhance sanity checking Markus Lehtonen
2016-02-05 14:00 ` [PATCH 1/3] package signing: do actual sanity checking in the signer class Markus Lehtonen
2016-02-05 14:00 ` [PATCH 2/3] oe/gpg_sign: check for python-pexpect when using local signing Markus Lehtonen
2016-02-05 14:31 ` Burton, Ross
2016-02-08 10:52 ` Markus Lehtonen
2016-02-08 11:17 ` Ioan-Adrian Ratiu
2016-02-05 14:00 ` Markus Lehtonen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1454680824-26075-4-git-send-email-markus.lehtonen@linux.intel.com \
--to=markus.lehtonen@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.