Message ID | 20250311210939.4090-1-chris.larson@siemens.com |
---|---|
Headers | show |
Series | Add 'customization' package support | expand |
On Tue, 2025-03-11 at 14:09 -0700, chris.larson via isar-users wrote: > From: Christopher Larson <chris.larson@siemens.com> > > A number of downstream layers have customization dpkg-raw recipes > making use of > template variables to support build-time settings: add the > infrastructure to > Isar to help uniformization of such recipes. Settings are often > specific to a > DISTRO, MACHINE or IMAGE: provide a mechanism to decorate (prefix or > suffix) > packages being constructed and pulled into the image. This helps use > of > customization packages in multiconfig builds but also with the > deployment of > binary package feeds for projects supporting multiple variants. > > To create a customization package, a recipe must inherit the > `dpkg-customization` bbclass. By default, images will inherit the > `image-customizations` class, which will install the package for any > customizations listed in `CUSTOMIZATIONS`. > > To add variables to the customization package names, beyond the > default DISTRO > and MACHINE, add them to `CUSTOMIZATION_VARS` as variable references > (`${DISTRO}`, `${MACHINE}`). By default, these variables are appended > to the > package name, but if they should be prefixed, add them to > `CUSTOMIZATION_VARS_PREFIXED`. By default, the `DISTRO` and `MACHINE` > variables > are used, and the `DISTRO` is prefixed, while the `MACHINE` is > suffixed. > > To enable support for per-image changes, and per-image customization > packages, > add the image name to `CUSTOMIZATION_FOR_IMAGES`. In the > customization package > recipe, the `IMAGE` variable will be set to the image name, and the > package name > will be decorated with the image name. The `IMAGE` will also be added > to the > `OVERRIDES`, allowing for variable definitions like this in the > customization > recipe: > > HOSTNAME:isar-image-ci = "isar-ci" > > When `CUSTOMIZATION_FOR_IMAGES` is defined, `${IMAGE}` will be > implicitly added > to `CUSTOMIZATION_VARS`, and the package will be decorated with the > image name. > > An example `hostname` customization recipe/package is provided, as is > an > initial unit test to verify the functionality of this customization. > > Christopher Larson (3): > classes: add 'customization' package support > hostname-customization: add initial customization package > testsuite: add 'customizations' test > > meta/classes/customization-base.bbclass | 21 +++++++++++ > meta/classes/dpkg-customization.bbclass | 37 > +++++++++++++++++++ > meta/classes/image-customizations.bbclass | 30 +++++++++++++++ > meta/classes/image.bbclass | 1 + > .../customizations/hostname-customization.bb | 11 ++++++ > .../hostname-customization/postinst.tmpl | 5 +++ > testsuite/cibuilder.py | 9 +++++ > testsuite/citest.py | 21 +++++++++++ > 8 files changed, 135 insertions(+) > create mode 100644 meta/classes/customization-base.bbclass > create mode 100644 meta/classes/dpkg-customization.bbclass > create mode 100644 meta/classes/image-customizations.bbclass > create mode 100644 meta/recipes-support/customizations/hostname- > customization.bb > create mode 100644 meta/recipes-support/customizations/hostname- > customization/postinst.tmpl > > -- > 2.47.2 Applied to next, thanks.
From: Christopher Larson <chris.larson@siemens.com> A number of downstream layers have customization dpkg-raw recipes making use of template variables to support build-time settings: add the infrastructure to Isar to help uniformization of such recipes. Settings are often specific to a DISTRO, MACHINE or IMAGE: provide a mechanism to decorate (prefix or suffix) packages being constructed and pulled into the image. This helps use of customization packages in multiconfig builds but also with the deployment of binary package feeds for projects supporting multiple variants. To create a customization package, a recipe must inherit the `dpkg-customization` bbclass. By default, images will inherit the `image-customizations` class, which will install the package for any customizations listed in `CUSTOMIZATIONS`. To add variables to the customization package names, beyond the default DISTRO and MACHINE, add them to `CUSTOMIZATION_VARS` as variable references (`${DISTRO}`, `${MACHINE}`). By default, these variables are appended to the package name, but if they should be prefixed, add them to `CUSTOMIZATION_VARS_PREFIXED`. By default, the `DISTRO` and `MACHINE` variables are used, and the `DISTRO` is prefixed, while the `MACHINE` is suffixed. To enable support for per-image changes, and per-image customization packages, add the image name to `CUSTOMIZATION_FOR_IMAGES`. In the customization package recipe, the `IMAGE` variable will be set to the image name, and the package name will be decorated with the image name. The `IMAGE` will also be added to the `OVERRIDES`, allowing for variable definitions like this in the customization recipe: HOSTNAME:isar-image-ci = "isar-ci" When `CUSTOMIZATION_FOR_IMAGES` is defined, `${IMAGE}` will be implicitly added to `CUSTOMIZATION_VARS`, and the package will be decorated with the image name. An example `hostname` customization recipe/package is provided, as is an initial unit test to verify the functionality of this customization. Christopher Larson (3): classes: add 'customization' package support hostname-customization: add initial customization package testsuite: add 'customizations' test meta/classes/customization-base.bbclass | 21 +++++++++++ meta/classes/dpkg-customization.bbclass | 37 +++++++++++++++++++ meta/classes/image-customizations.bbclass | 30 +++++++++++++++ meta/classes/image.bbclass | 1 + .../customizations/hostname-customization.bb | 11 ++++++ .../hostname-customization/postinst.tmpl | 5 +++ testsuite/cibuilder.py | 9 +++++ testsuite/citest.py | 21 +++++++++++ 8 files changed, 135 insertions(+) create mode 100644 meta/classes/customization-base.bbclass create mode 100644 meta/classes/dpkg-customization.bbclass create mode 100644 meta/classes/image-customizations.bbclass create mode 100644 meta/recipes-support/customizations/hostname-customization.bb create mode 100644 meta/recipes-support/customizations/hostname-customization/postinst.tmpl