Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | # |
| 2 | # Copyright OpenEmbedded Contributors |
| 3 | # |
| 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
| 6 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 7 | # Class for signing package feeds |
| 8 | # |
| 9 | # Related configuration variables that will be used after this class is |
| 10 | # iherited: |
| 11 | # PACKAGE_FEED_PASSPHRASE_FILE |
| 12 | # Path to a file containing the passphrase of the signing key. |
| 13 | # PACKAGE_FEED_GPG_NAME |
| 14 | # 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] | 15 | # PACKAGE_FEED_GPG_BACKEND |
| 16 | # Optional variable for specifying the backend to use for signing. |
| 17 | # Currently the only available option is 'local', i.e. local signing |
| 18 | # on the build host. |
| 19 | # PACKAGE_FEED_GPG_SIGNATURE_TYPE |
| 20 | # Optional variable for specifying the type of gpg signature, can be: |
| 21 | # 1. Ascii armored (ASC), default if not set |
| 22 | # 2. Binary (BIN) |
| 23 | # This variable is only available for IPK feeds. It is ignored on |
| 24 | # other packaging backends. |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 25 | # GPG_BIN |
| 26 | # Optional variable for specifying the gpg binary/wrapper to use for |
| 27 | # signing. |
| 28 | # GPG_PATH |
| 29 | # Optional variable for specifying the gnupg "home" directory: |
| 30 | # |
| 31 | inherit sanity |
| 32 | |
| 33 | PACKAGE_FEED_SIGN = '1' |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 34 | PACKAGE_FEED_GPG_BACKEND ?= 'local' |
| 35 | PACKAGE_FEED_GPG_SIGNATURE_TYPE ?= 'ASC' |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 36 | PACKAGEINDEXDEPS += "gnupg-native:do_populate_sysroot" |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 37 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 38 | # Make feed signing key to be present in rootfs |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 39 | FEATURE_PACKAGES_package-management:append = " signing-keys-packagefeed" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 40 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 41 | python () { |
| 42 | # Check sanity of configuration |
| 43 | for var in ('PACKAGE_FEED_GPG_NAME', 'PACKAGE_FEED_GPG_PASSPHRASE_FILE'): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 44 | if not d.getVar(var): |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 45 | raise_sanity_error("You need to define %s in the config" % var, d) |
| 46 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 47 | sigtype = d.getVar("PACKAGE_FEED_GPG_SIGNATURE_TYPE") |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 48 | if sigtype.upper() != "ASC" and sigtype.upper() != "BIN": |
| 49 | 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] | 50 | } |
| 51 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 52 | do_package_index[depends] += "signing-keys:do_deploy" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 53 | do_rootfs[depends] += "signing-keys:do_populate_sysroot gnupg-native:do_populate_sysroot" |