2015-08-21 14:21:57 +00:00
|
|
|
# Class for generating signed RPM packages.
|
|
|
|
#
|
|
|
|
# Configuration variables used by this class:
|
|
|
|
# RPM_GPG_PASSPHRASE_FILE
|
|
|
|
# Path to a file containing the passphrase of the signing key.
|
|
|
|
# RPM_GPG_NAME
|
2015-10-15 11:35:20 +00:00
|
|
|
# Name of the key to sign with. May be key id or key name.
|
2016-01-25 12:21:34 +00:00
|
|
|
# RPM_GPG_BACKEND
|
|
|
|
# Optional variable for specifying the backend to use for signing.
|
|
|
|
# Currently the only available option is 'local', i.e. local signing
|
|
|
|
# on the build host.
|
2015-08-21 14:21:57 +00:00
|
|
|
# GPG_BIN
|
|
|
|
# Optional variable for specifying the gpg binary/wrapper to use for
|
|
|
|
# signing.
|
2015-10-14 13:46:39 +00:00
|
|
|
# GPG_PATH
|
|
|
|
# Optional variable for specifying the gnupg "home" directory:
|
2015-08-21 14:21:57 +00:00
|
|
|
#
|
|
|
|
inherit sanity
|
|
|
|
|
|
|
|
RPM_SIGN_PACKAGES='1'
|
2016-01-25 12:21:34 +00:00
|
|
|
RPM_GPG_BACKEND ?= 'local'
|
2015-08-21 14:21:57 +00:00
|
|
|
|
|
|
|
|
2015-10-15 11:35:20 +00:00
|
|
|
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)
|
2015-10-16 10:37:32 +00:00
|
|
|
|
|
|
|
# Set the expected location of the public key
|
2015-12-10 22:48:35 +00:00
|
|
|
d.setVar('RPM_GPG_PUBKEY', os.path.join(d.getVar('STAGING_ETCDIR_NATIVE', False),
|
2015-10-16 10:37:32 +00:00
|
|
|
'RPM-GPG-PUBKEY'))
|
2015-08-21 14:21:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
python sign_rpm () {
|
|
|
|
import glob
|
2016-01-25 12:21:34 +00:00
|
|
|
from oe.gpg_sign import get_signer
|
2015-08-21 14:21:57 +00:00
|
|
|
|
2016-01-25 12:21:34 +00:00
|
|
|
signer = get_signer(d,
|
|
|
|
d.getVar('RPM_GPG_BACKEND', True),
|
|
|
|
d.getVar('RPM_GPG_NAME', True),
|
|
|
|
d.getVar('RPM_GPG_PASSPHRASE_FILE', True))
|
2015-08-21 14:21:57 +00:00
|
|
|
rpms = glob.glob(d.getVar('RPM_PKGWRITEDIR', True) + '/*')
|
|
|
|
|
2016-01-25 12:21:34 +00:00
|
|
|
signer.sign_rpms(rpms)
|
2015-08-21 14:21:57 +00:00
|
|
|
}
|
2015-10-16 10:37:32 +00:00
|
|
|
|
|
|
|
do_package_index[depends] += "signing-keys:do_export_public_keys"
|
2016-01-11 16:13:17 +00:00
|
|
|
do_rootfs[depends] += "signing-keys:do_export_public_keys"
|