sign_package_feed.bbclass 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #
  2. # Copyright OpenEmbedded Contributors
  3. #
  4. # SPDX-License-Identifier: MIT
  5. #
  6. # Class for signing package feeds
  7. #
  8. # Related configuration variables that will be used after this class is
  9. # iherited:
  10. # PACKAGE_FEED_PASSPHRASE_FILE
  11. # Path to a file containing the passphrase of the signing key.
  12. # PACKAGE_FEED_GPG_NAME
  13. # Name of the key to sign with. May be key id or key name.
  14. # PACKAGE_FEED_GPG_BACKEND
  15. # Optional variable for specifying the backend to use for signing.
  16. # Currently the only available option is 'local', i.e. local signing
  17. # on the build host.
  18. # PACKAGE_FEED_GPG_SIGNATURE_TYPE
  19. # Optional variable for specifying the type of gpg signature, can be:
  20. # 1. Ascii armored (ASC), default if not set
  21. # 2. Binary (BIN)
  22. # This variable is only available for IPK feeds. It is ignored on
  23. # other packaging backends.
  24. # GPG_BIN
  25. # Optional variable for specifying the gpg binary/wrapper to use for
  26. # signing.
  27. # GPG_PATH
  28. # Optional variable for specifying the gnupg "home" directory:
  29. #
  30. inherit sanity
  31. PACKAGE_FEED_SIGN = '1'
  32. PACKAGE_FEED_GPG_BACKEND ?= 'local'
  33. PACKAGE_FEED_GPG_SIGNATURE_TYPE ?= 'ASC'
  34. PACKAGEINDEXDEPS += "gnupg-native:do_populate_sysroot"
  35. # Make feed signing key to be present in rootfs
  36. FEATURE_PACKAGES_package-management:append = " signing-keys-packagefeed"
  37. python () {
  38. # Check sanity of configuration
  39. for var in ('PACKAGE_FEED_GPG_NAME', 'PACKAGE_FEED_GPG_PASSPHRASE_FILE'):
  40. if not d.getVar(var):
  41. raise_sanity_error("You need to define %s in the config" % var, d)
  42. sigtype = d.getVar("PACKAGE_FEED_GPG_SIGNATURE_TYPE")
  43. if sigtype.upper() != "ASC" and sigtype.upper() != "BIN":
  44. raise_sanity_error("Bad value for PACKAGE_FEED_GPG_SIGNATURE_TYPE (%s), use either ASC or BIN" % sigtype)
  45. }
  46. do_package_index[depends] += "signing-keys:do_deploy"
  47. do_rootfs[depends] += "signing-keys:do_populate_sysroot gnupg-native:do_populate_sysroot"