@@ -1216,3 +1216,9 @@ dependency to `do_rootfs_postprocess` shall now be changed to run after `do_root
To easily select rootfs features from a local conf that should only apply to the image
recipe, we provide the `IMAGE_ROOTFS_FEATURES`.
+
+### Replace isar-exclude-docs with rootfs feature exclude-docs
+
+The `isar-exclude-docs` package provided mechanisms to remove documentation from
+the rootfs. This has been replaced by the `exclude-docs` rootfs feature. The
+`isar-exclude-docs` package should no longer be used.
@@ -152,7 +152,7 @@ CONF_VERSION = "1"
#
# The default list of extra packages to be installed.
-IMAGE_INSTALL = "hello-isar example-raw example-module-${KERNEL_NAME} enable-fsck isar-exclude-docs samefile hello isar-disable-apt-cache cowsay example-prebuilt"
+IMAGE_INSTALL = "hello-isar example-raw example-module-${KERNEL_NAME} enable-fsck samefile hello isar-disable-apt-cache cowsay example-prebuilt"
#
# Container and WSL machines don't need example module and enable-fsck.
@@ -164,6 +164,10 @@ IMAGE_INSTALL:remove:wsl = "example-module-${KERNEL_NAME} enable-fsck"
IMAGE_INSTALL:remove:qemuamd64-sb = "example-module-${KERNEL_NAME}"
IMAGE_INSTALL:append:qemuamd64-sb = " example-module-signed-${KERNEL_NAME}"
+#
+# Exclude documentation files from the image
+IMAGE_ROOTFS_FEATURES += "exclude-docs"
+
#
# Uncomment this to disable cross-compilation support
#ISAR_CROSS_COMPILE ?= "0"
@@ -41,6 +41,7 @@ ROOTFS_BASE_DISTRO ?= "${BASE_DISTRO}"
# 'populate-systemd-preset' - enable systemd units according to systemd presets
# 'clean-apt-credentials' - remove apt auth credentials written by ISAR_APT_CREDS
# 'clean-dpkg-config' - remove ISAR-specific dpkg configuration files from the rootfs
+# 'exclude-docs' - exclude most documentation files from the rootfs
# convenience variable to enable all features needed for a reproducible rootfs build
ROOTFS_FEATURES_REPRODUCIBLE = " \
@@ -312,6 +313,37 @@ rootfs_configure_apt() {
EOSUDO
}
+rootfs_exclude_docs_drop() {
+ if [ -d '${ROOTFSDIR}/usr/share/man' ]; then
+ find '${ROOTFSDIR}/usr/share/man/' -mindepth 1 ! -type d -delete
+ find '${ROOTFSDIR}/usr/share/man/' -depth -mindepth 1 -type d -empty -delete
+ fi
+ if [ -d '${ROOTFSDIR}/usr/share/doc' ]; then
+ find '${ROOTFSDIR}/usr/share/doc/' -mindepth 1 ! -type d ! -name "copyright" ! -name "changelog.*" -delete
+ find '${ROOTFSDIR}/usr/share/doc/' -depth -mindepth 1 -type d -empty -delete
+ fi
+}
+
+ROOTFS_CONFIGURE_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'exclude-docs', 'rootfs_configure_exclude_docs_filter', '', d)}"
+rootfs_configure_exclude_docs_filter() {
+ run_privileged_heredoc <<'EOSUDO'
+ set -e
+ mkdir -p '${ROOTFSDIR}/etc/dpkg/dpkg.cfg.d'
+ cat > '${ROOTFSDIR}/etc/dpkg/dpkg.cfg.d/55isar-exclude-docs' << 'EOF'
+path-exclude=/usr/share/man/*
+path-exclude=/usr/share/doc/*
+path-include=/usr/share/doc/*/copyright
+path-include=/usr/share/doc/*/changelog.*
+EOF
+
+EOSUDO
+ # drop docs from bootstrap
+ run_privileged_heredoc <<'EOSUDO'
+ set -e
+ ${rootfs_exclude_docs_drop}
+EOSUDO
+}
+
ROOTFS_CONFIGURE_COMMAND += "rootfs_disable_initrd_generation"
rootfs_disable_initrd_generation[weight] = "1"
rootfs_disable_initrd_generation() {
@@ -583,6 +615,14 @@ rootfs_postprocess_clean_dpkg_config() {
run_privileged find "${ROOTFSDIR}/etc/dpkg/dpkg.cfg.d" -type f -name '*isar*.cfg' -delete
}
+ROOTFS_POSTPROCESS_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'exclude-docs', 'rootfs_postprocess_exclude_docs', '', d)}"
+rootfs_postprocess_exclude_docs() {
+ run_privileged_heredoc <<'EOSUDO'
+ set -e
+ ${rootfs_exclude_docs_drop}
+EOSUDO
+}
+
ROOTFS_POSTPROCESS_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'clean-pycache', 'rootfs_postprocess_clean_pycache', '', d)}"
rootfs_postprocess_clean_pycache() {
run_privileged find ${ROOTFSDIR}/usr -type f -name '*.pyc' -delete -print
@@ -14,3 +14,7 @@ do_install[cleandirs] += "${D}/etc/dpkg/dpkg.cfg.d/"
do_install() {
install -v -m 644 "${WORKDIR}/${BPN}" "${D}/etc/dpkg/dpkg.cfg.d/99${BPN}"
}
+
+do_prepare_build() {
+ bbwarn "This package is deprecated. Use the corresponding exclude-docs rootfs feature instead."
+}
We previously used a package to control if the docs should be included in a rootfs or not. This has the drawback, that the expensive cleanup of the existing docs needs to happen from a postinst script, which is emulated on non native builds. Also, what is removed when depends on the install order of the packages. We change this by making the logic a rootfs feature, which - when enabled - sets a dpkg config prior to the installation of packages. By that, the docs are not extracted into the rootfs and only a cheap cleanup of the docs we got from bootstrapping is needed. This also cleanly aligns with other rootfs features we provide. Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com> --- RECIPE-API-CHANGELOG.md | 6 +++ meta-isar/conf/local.conf.sample | 6 ++- meta/classes-recipe/rootfs.bbclass | 40 +++++++++++++++++++ .../isar-exclude-docs_0.2.3.bb | 4 ++ 4 files changed, 55 insertions(+), 1 deletion(-)