Add configurable docs and locales
Merge Checklist
All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)
- [x] The toolchain has been rebuilt successfully (or no changes were made to it)
- [x] The toolchain/worker package manifests are up-to-date
- [x] Any updated packages successfully build (or no packages were changed)
- [x] Packages depending on static components modified in this PR (Golang,
*-staticsubpackages, etc.) have had theirReleasetag incremented. - [x] Package tests (%check section) have been verified with RUN_CHECK=y for existing SPEC files, or added to new SPEC files
- [x] All package sources are available
- [x] cgmanifest files are up-to-date and sorted (
./cgmanifest.json,./toolkit/scripts/toolchain/cgmanifest.json,.github/workflows/cgmanifest.json) - [x] LICENSE-MAP files are up-to-date (
./SPECS/LICENSES-AND-NOTICES/data/licenses.json,./SPECS/LICENSES-AND-NOTICES/LICENSES-MAP.md,./SPECS/LICENSES-AND-NOTICES/LICENSE-EXCEPTIONS.PHOTON) - [x] All source files have up-to-date hashes in the
*.signatures.jsonfiles - [x]
sudo make go-tidy-allandsudo make go-test-coveragepass - [x] Documentation has been updated to match any changes to the build system
- [ ] Ready to merge
Summary
We want to be able to disable documentation and locale files to minimize storage space. rpm offers two macros to help with this:
%_excludedocs 1: Disable any%docfile in a package%_install_langs en:es:fr: Only include locale files that start with one of the prefixes. By setting it toNONEthis matches no locales and effectively disables them.
These can be controlled by new settings in SystemConfig:
"DisableRpmDocs": true,
"DisableRpmLocales": true,
"OverrideRpmLocales": "en:fr:es"
DisableRpmLocales and OverrideRpmLocales are mutually exclusive.
For example, setting DisableRpmLocales will create /usr/lib/rpm/macros.d/macros.installercustomizations_customize_locales
# This macro file was dynamically generated by the Azure Linux Toolkit image generator
# based on the configuration used at image creation time.
# This stops locale files from being installed. %%_install_langs acts as a filter for locales
# which start with the provides strings. Setting it to an invalid value (ie 'NONE') will
# prevent any locale files from being installed.
# To enable locale files, remove this file, or comment out '%%_install_langs <LOCALE STRING>'
# Any packages which are already installed must be reinstalled for this change to take effect.
%_install_langs NONE
Change Log
- Add
DisableDocumentationDefines(),DisableLocaleDefines(),OverrideLocaleDefines()torpm.goto create these macros. - Add
customizationmacrospackage which can generate macro filesAddMacroFile()will create a new macro file inside the given root directory that contains each of the macros given.AddCustomizationMacros()sets the new flags defined inSystemConfigalong with some helpful comments.
Does this affect the toolchain?
NO
Test Methodology
- Local builds of core-efi.json
Need to wait on another PR first to fix a bunch of packages. Several packages include license files as %doc which should really be %license. We need to fix those before we ship images that disable documentation.
Need more testing for locales, will leave them enabled in configs for now.