From d15fb02c7ee7da50e322d74bc6a545234e20c7f3 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 14 Oct 2021 12:58:40 +0100 Subject: [PATCH] reproducible: Drop BUILD_REPRODUCIBLE_BINARIES variable We want things to be reproduicble and the variable doesn't really change much any more. Drop the remaining uses and make those code paths always active. Signed-off-by: Richard Purdie --- meta/classes/image-prelink.bbclass | 13 ++++--------- meta/classes/image.bbclass | 14 ++++++-------- meta/conf/bitbake.conf | 1 - meta/lib/oe/sstatesig.py | 2 +- meta/recipes-core/busybox/busybox.inc | 10 ++++------ 5 files changed, 15 insertions(+), 25 deletions(-) diff --git a/meta/classes/image-prelink.bbclass b/meta/classes/image-prelink.bbclass index 0da094a551..8158eeaf4c 100644 --- a/meta/classes/image-prelink.bbclass +++ b/meta/classes/image-prelink.bbclass @@ -46,17 +46,12 @@ prelink_image () { dynamic_loader=${@get_linuxloader(d)} # prelink! - if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then - bbnote " prelink: BUILD_REPRODUCIBLE_BINARIES..." - if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then - export PRELINK_TIMESTAMP=`git log -1 --pretty=%ct ` - else - export PRELINK_TIMESTAMP=$REPRODUCIBLE_TIMESTAMP_ROOTFS - fi - ${STAGING_SBINDIR_NATIVE}/prelink --root ${IMAGE_ROOTFS} -am -N -c ${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader + if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then + export PRELINK_TIMESTAMP=`git log -1 --pretty=%ct ` else - ${STAGING_SBINDIR_NATIVE}/prelink --root ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader + export PRELINK_TIMESTAMP=$REPRODUCIBLE_TIMESTAMP_ROOTFS fi + ${STAGING_SBINDIR_NATIVE}/prelink --root ${IMAGE_ROOTFS} -am -N -c ${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader # Remove the prelink.conf if we had to add it. if [ "$dummy_prelink_conf" = "true" ]; then diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index c2f3232027..2fa69a40d1 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -651,17 +651,15 @@ ROOTFS_PREPROCESS_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge' POPULATE_SDK_PRE_TARGET_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_symlinks_sdk; ', '',d)}" reproducible_final_image_task () { - if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then + if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then + REPRODUCIBLE_TIMESTAMP_ROOTFS=`git -C "${COREBASE}" log -1 --pretty=%ct 2>/dev/null` || true if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then - REPRODUCIBLE_TIMESTAMP_ROOTFS=`git -C "${COREBASE}" log -1 --pretty=%ct 2>/dev/null` || true - if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then - REPRODUCIBLE_TIMESTAMP_ROOTFS=`stat -c%Y ${@bb.utils.which(d.getVar("BBPATH"), "conf/bitbake.conf")}` - fi + REPRODUCIBLE_TIMESTAMP_ROOTFS=`stat -c%Y ${@bb.utils.which(d.getVar("BBPATH"), "conf/bitbake.conf")}` fi - # Set mtime of all files to a reproducible value - bbnote "reproducible_final_image_task: mtime set to $REPRODUCIBLE_TIMESTAMP_ROOTFS" - find ${IMAGE_ROOTFS} -print0 | xargs -0 touch -h --date=@$REPRODUCIBLE_TIMESTAMP_ROOTFS fi + # Set mtime of all files to a reproducible value + bbnote "reproducible_final_image_task: mtime set to $REPRODUCIBLE_TIMESTAMP_ROOTFS" + find ${IMAGE_ROOTFS} -print0 | xargs -0 touch -h --date=@$REPRODUCIBLE_TIMESTAMP_ROOTFS } systemd_preset_all () { diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index 1db9b3fc05..790f2f7a8c 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf @@ -636,7 +636,6 @@ SDE_DIR = "${WORKDIR}/source-date-epoch" SDE_FILE = "${SDE_DIR}/__source_date_epoch.txt" SDE_DEPLOYDIR = "${WORKDIR}/deploy-source-date-epoch" -BUILD_REPRODUCIBLE_BINARIES = "1" export PYTHONHASHSEED = "0" export PERL_HASH_SEED = "0" export SOURCE_DATE_EPOCH ?= "${@get_source_date_epoch_value(d)}" diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py index c2e3e2f4f5..038404e377 100644 --- a/meta/lib/oe/sstatesig.py +++ b/meta/lib/oe/sstatesig.py @@ -489,7 +489,7 @@ def OEOuthashBasic(path, sigfile, task, d): include_timestamps = False include_root = True if task == "package": - include_timestamps = d.getVar('BUILD_REPRODUCIBLE_BINARIES') == '1' + include_timestamps = True include_root = False extra_content = d.getVar('HASHEQUIV_HASH_VERSION') diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc index 808c3dc700..622325aabb 100644 --- a/meta/recipes-core/busybox/busybox.inc +++ b/meta/recipes-core/busybox/busybox.inc @@ -110,9 +110,8 @@ python () { } do_prepare_config () { - if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then - export KCONFIG_NOTIMESTAMP=1 - fi + export KCONFIG_NOTIMESTAMP=1 + sed -e '/CONFIG_STATIC/d' \ < ${WORKDIR}/defconfig > ${S}/.config echo "# CONFIG_STATIC is not set" >> .config @@ -143,9 +142,8 @@ do_configure () { do_compile() { unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS - if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then - export KCONFIG_NOTIMESTAMP=1 - fi + export KCONFIG_NOTIMESTAMP=1 + if [ "${BUSYBOX_SPLIT_SUID}" = "1" -a x`grep "CONFIG_FEATURE_INDIVIDUAL=y" .config` = x ]; then # split the .config into two parts, and make two busybox binaries if [ -e .config.orig ]; then -- 2.40.1