@@ -1228,3 +1228,10 @@ kept for legal reasons).
Changes in next
---------------
+
+### New rootfs feature distro-apt-sources
+
+The `distro-apt-sources` rootfs feature replaces the apt sources list used
+during the build (which includes `DISTRO_APT_PREMIRRORS` or snapshot
+rewrites) with the unmodified one from `DISTRO_APT_SOURCES`. It is enabled
+by default for images and the SDK.
@@ -102,6 +102,7 @@ ROOTFS_FEATURES += "\
generate-sbom \
clean-apt-credentials \
clean-dpkg-config \
+ distro-apt-sources \
${IMAGE_ROOTFS_FEATURES} \
"
ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${@isar_multiarch_packages('IMAGE_INSTALL', d)}"
@@ -43,6 +43,7 @@ ROOTFS_BASE_DISTRO ?= "${BASE_DISTRO}"
# '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
+# 'distro-apt-sources' - replace the build-time apt sources (incl. premirrors) with the unmodified DISTRO_APT_SOURCES
# convenience variable to enable all features needed for a reproducible rootfs build
ROOTFS_FEATURES_REPRODUCIBLE = " \
@@ -626,6 +627,20 @@ 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', 'distro-apt-sources', 'rootfs_postprocess_distro_apt_sources', '', d)}"
+rootfs_postprocess_distro_apt_sources() {
+ # The bootstrap list carries DISTRO_APT_PREMIRRORS rewrites (or base-apt),
+ # ship the unmodified DISTRO_APT_SOURCES stored by the bootstrap instead.
+ run_privileged_heredoc <<'EOSUDO'
+ set -e
+ if [ -e "${ROOTFSDIR}/etc/apt/sources-list" ]; then
+ rm -f "${ROOTFSDIR}/etc/apt/sources.list.d/0000bootstrap.list"
+ mv "${ROOTFSDIR}/etc/apt/sources-list" \
+ "${ROOTFSDIR}/etc/apt/sources.list.d/0000bootstrap.list"
+ fi
+EOSUDO
+}
+
ROOTFS_POSTPROCESS_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'exclude-docs', 'rootfs_postprocess_exclude_docs', '', d)}"
rootfs_postprocess_exclude_docs() {
run_privileged_heredoc <<'EOSUDO'
@@ -49,7 +49,7 @@ ROOTFS_ARCH:class-sdk = "${HOST_ARCH}"
ROOTFS_DISTRO:class-sdk = "${@get_rootfs_distro(d)}"
ROOTFS_PACKAGES:class-sdk = "sdk-files ${SDK_TOOLCHAIN} ${SDK_PREINSTALL} ${@isar_multiarch_packages('SDK_INSTALL', d)}"
ROOTFS_VARDEPS:class-sdk = "SDK_INSTALL SDK_INCLUDE_ISAR_APT"
-ROOTFS_FEATURES:append:class-sdk = " clean-apt-lists clean-apt-credentials generate-manifest export-dpkg-status generate-sbom"
+ROOTFS_FEATURES:append:class-sdk = " clean-apt-lists clean-apt-credentials distro-apt-sources generate-manifest export-dpkg-status generate-sbom"
ROOTFS_MANIFEST_DEPLOY_DIR:class-sdk = "${DEPLOY_DIR_SDKCHROOT}"
ROOTFS_DPKGSTATUS_DEPLOY_DIR:class-sdk = "${DEPLOY_DIR_SDKCHROOT}"
Since mmdebstrap became the default bootstrap provider, the apt sources list used during the build ends up in the final rootfs. It contains the DISTRO_APT_PREMIRRORS (or snapshot) rewrites, contradicting the user manual which states that premirrors are only used for the build. Add the rootfs feature distro-apt-sources that installs the unmodified list stored by the bootstrap in place of the build-time one and enable it for images and the SDK. Custom lists from an image SRC_URI still take precedence as they are installed afterwards in do_rootfs_finalize. Fixes: 1e33b12acfc9 ("image: Account for differences with mmdebstrap") Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com> --- RECIPE-API-CHANGELOG.md | 7 +++++++ meta/classes-recipe/image.bbclass | 1 + meta/classes-recipe/rootfs.bbclass | 15 +++++++++++++++ meta/classes-recipe/sdk.bbclass | 2 +- 4 files changed, 24 insertions(+), 1 deletion(-)