Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 1 | # 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 Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 9 | # 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 Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 19 | # 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 | # |
| 25 | inherit sanity |
| 26 | |
| 27 | PACKAGE_FEED_SIGN = '1' |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 28 | PACKAGE_FEED_GPG_BACKEND ?= 'local' |
| 29 | PACKAGE_FEED_GPG_SIGNATURE_TYPE ?= 'ASC' |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 30 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 31 | # Make feed signing key to be present in rootfs |
| 32 | FEATURE_PACKAGES_package-management_append = " signing-keys-packagefeed" |
| 33 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 34 | python () { |
| 35 | # Check sanity of configuration |
| 36 | for var in ('PACKAGE_FEED_GPG_NAME', 'PACKAGE_FEED_GPG_PASSPHRASE_FILE'): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 37 | if not d.getVar(var): |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 38 | raise_sanity_error("You need to define %s in the config" % var, d) |
| 39 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 40 | sigtype = d.getVar("PACKAGE_FEED_GPG_SIGNATURE_TYPE") |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 41 | if sigtype.upper() != "ASC" and sigtype.upper() != "BIN": |
| 42 | raise_sanity_error("Bad value for PACKAGE_FEED_GPG_SIGNATURE_TYPE (%s), use either ASC or BIN" % sigtype) |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 43 | } |
| 44 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 45 | do_package_index[depends] += "signing-keys:do_deploy" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 46 | do_rootfs[depends] += "signing-keys:do_populate_sysroot gnupg-native:do_populate_sysroot" |