blob: 71df03bab34b0f3dbe0dfb088cc2f2b27f94ca36 [file] [log] [blame]
Patrick Williamsf1e5d692016-03-30 15:21:19 -05001# Class for signing package feeds
2#
3# Related configuration variables that will be used after this class is
4# iherited:
5# PACKAGE_FEED_PASSPHRASE_FILE
6# Path to a file containing the passphrase of the signing key.
7# PACKAGE_FEED_GPG_NAME
8# Name of the key to sign with. May be key id or key name.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05009# PACKAGE_FEED_GPG_BACKEND
10# Optional variable for specifying the backend to use for signing.
11# Currently the only available option is 'local', i.e. local signing
12# on the build host.
13# PACKAGE_FEED_GPG_SIGNATURE_TYPE
14# Optional variable for specifying the type of gpg signature, can be:
15# 1. Ascii armored (ASC), default if not set
16# 2. Binary (BIN)
17# This variable is only available for IPK feeds. It is ignored on
18# other packaging backends.
Patrick Williamsf1e5d692016-03-30 15:21:19 -050019# GPG_BIN
20# Optional variable for specifying the gpg binary/wrapper to use for
21# signing.
22# GPG_PATH
23# Optional variable for specifying the gnupg "home" directory:
24#
25inherit sanity
26
27PACKAGE_FEED_SIGN = '1'
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050028PACKAGE_FEED_GPG_BACKEND ?= 'local'
29PACKAGE_FEED_GPG_SIGNATURE_TYPE ?= 'ASC'
Patrick Williamsf1e5d692016-03-30 15:21:19 -050030
31python () {
32 # Check sanity of configuration
33 for var in ('PACKAGE_FEED_GPG_NAME', 'PACKAGE_FEED_GPG_PASSPHRASE_FILE'):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050034 if not d.getVar(var):
Patrick Williamsf1e5d692016-03-30 15:21:19 -050035 raise_sanity_error("You need to define %s in the config" % var, d)
36
Brad Bishop6e60e8b2018-02-01 10:27:11 -050037 sigtype = d.getVar("PACKAGE_FEED_GPG_SIGNATURE_TYPE")
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050038 if sigtype.upper() != "ASC" and sigtype.upper() != "BIN":
39 raise_sanity_error("Bad value for PACKAGE_FEED_GPG_SIGNATURE_TYPE (%s), use either ASC or BIN" % sigtype)
Patrick Williamsf1e5d692016-03-30 15:21:19 -050040}
41
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050042do_package_index[depends] += "signing-keys:do_deploy"
43do_rootfs[depends] += "signing-keys:do_populate_sysroot"