diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2015-10-15 14:35:20 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-10-24 12:17:13 +0100 |
commit | 6ea062dffce3df59cc4ba88edd181dc1dac759f9 (patch) | |
tree | 3a09b0b5c7eb5a2535c6d0ee28f32d1857c04571 | |
parent | 3abdd2bf886e4b3bc7dd957c77a7745498386161 (diff) | |
download | openembedded-core-6ea062dffce3df59cc4ba88edd181dc1dac759f9.tar.gz openembedded-core-6ea062dffce3df59cc4ba88edd181dc1dac759f9.tar.bz2 openembedded-core-6ea062dffce3df59cc4ba88edd181dc1dac759f9.zip |
sign_rpm.bbclass: make RPM_GPG_NAME a mandatory setting
Simplifies the configuration. Makes way for the removal of
RPM_GPG_PUBKEY setting and possible future implementation of a separate
signing server support. Also, moves the configuration sanity checking
into a separate function.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r-- | meta/classes/sign_rpm.bbclass | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/meta/classes/sign_rpm.bbclass b/meta/classes/sign_rpm.bbclass index 39f877a23c..4da17633a7 100644 --- a/meta/classes/sign_rpm.bbclass +++ b/meta/classes/sign_rpm.bbclass @@ -4,8 +4,7 @@ # RPM_GPG_PASSPHRASE_FILE # Path to a file containing the passphrase of the signing key. # RPM_GPG_NAME -# Name of the key to sign with. Alternatively you can define -# %_gpg_name macro in your ~/.oerpmmacros file. +# Name of the key to sign with. May be key id or key name. # RPM_GPG_PUBKEY # Path to a file containing the public key (in "armor" format) # corresponding the signing key. @@ -20,9 +19,11 @@ inherit sanity RPM_SIGN_PACKAGES='1' -_check_gpg_name () { - macrodef=`rpm -E '%_gpg_name'` - [ "$macrodef" == "%_gpg_name" ] && return 1 || return 0 +python () { + # Check configuration + for var in ('RPM_GPG_NAME', 'RPM_GPG_PASSPHRASE_FILE'): + if not d.getVar(var, True): + raise_sanity_error("You need to define %s in the config" % var, d) } @@ -31,16 +32,7 @@ def rpmsign_wrapper(d, files, passphrase, gpg_name=None): # Find the correct rpm binary rpm_bin_path = d.getVar('STAGING_BINDIR_NATIVE', True) + '/rpm' - cmd = rpm_bin_path + " --addsign " - if gpg_name: - cmd += "--define '%%_gpg_name %s' " % gpg_name - else: - try: - bb.build.exec_func('_check_gpg_name', d) - except bb.build.FuncFailed: - raise_sanity_error("You need to define RPM_GPG_NAME in bitbake " - "config or the %_gpg_name RPM macro defined " - "(e.g. in ~/.oerpmmacros", d) + cmd = rpm_bin_path + " --addsign --define '_gpg_name %s' " % gpg_name if d.getVar('GPG_BIN', True): cmd += "--define '%%__gpg %s' " % d.getVar('GPG_BIN', True) if d.getVar('GPG_PATH', True): @@ -66,12 +58,8 @@ def rpmsign_wrapper(d, files, passphrase, gpg_name=None): python sign_rpm () { import glob - rpm_gpg_pass_file = (d.getVar("RPM_GPG_PASSPHRASE_FILE", True) or "") - if rpm_gpg_pass_file: - with open(rpm_gpg_pass_file) as fobj: - rpm_gpg_passphrase = fobj.readlines()[0].rstrip('\n') - else: - raise_sanity_error("You need to define RPM_GPG_PASSPHRASE_FILE in the config", d) + with open(d.getVar("RPM_GPG_PASSPHRASE_FILE", True)) as fobj: + rpm_gpg_passphrase = fobj.readlines()[0].rstrip('\n') rpm_gpg_name = (d.getVar("RPM_GPG_NAME", True) or "") |