On Thu, Oct 14, 2021 at 8:10 AM Richard Purdie <richard.pur...@linuxfoundation.org> wrote: > > 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.
It wasn't clear to me from reading the patch. What is the way that someone would now get the current timestamp into a kernel build, if that's the behaviour that they want ? Bruce > > Signed-off-by: Richard Purdie <richard.pur...@linuxfoundation.org> > --- > meta/classes/image-prelink.bbclass | 13 ++----- > meta/classes/image.bbclass | 14 +++---- > meta/classes/kernel.bbclass | 54 +++++++++++++-------------- > meta/conf/bitbake.conf | 1 - > meta/lib/oe/sstatesig.py | 2 +- > meta/recipes-core/busybox/busybox.inc | 10 ++--- > 6 files changed, 41 insertions(+), 53 deletions(-) > > diff --git a/meta/classes/image-prelink.bbclass > b/meta/classes/image-prelink.bbclass > index 0da094a5518..8158eeaf4ca 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 c2f32320278..2fa69a40d10 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/classes/kernel.bbclass b/meta/classes/kernel.bbclass > index 4acec1877e0..3dd9b4446db 100644 > --- a/meta/classes/kernel.bbclass > +++ b/meta/classes/kernel.bbclass > @@ -324,21 +324,20 @@ addtask bundle_initramfs after do_install before > do_deploy > > kernel_do_compile() { > unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE > - if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then > - # kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH > may not > - # be set.... > - if [ "${SOURCE_DATE_EPOCH}" = "" -o "${SOURCE_DATE_EPOCH}" = > "0" ]; then > - # The source directory is not necessarily a git > repository, so we > - # specify the git-dir to ensure that git does not > query a > - # repository in any parent directory. > - SOURCE_DATE_EPOCH=`git --git-dir="${S}/.git" log -1 > --pretty=%ct 2>/dev/null || echo "${REPRODUCIBLE_TIMESTAMP_ROOTFS}"` > - fi > - > - ts=`LC_ALL=C date -d @$SOURCE_DATE_EPOCH` > - export KBUILD_BUILD_TIMESTAMP="$ts" > - export KCONFIG_NOTIMESTAMP=1 > - bbnote "KBUILD_BUILD_TIMESTAMP: $ts" > + # kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not > + # be set.... > + if [ "${SOURCE_DATE_EPOCH}" = "" -o "${SOURCE_DATE_EPOCH}" = "0" ]; > then > + # The source directory is not necessarily a git repository, > so we > + # specify the git-dir to ensure that git does not query a > + # repository in any parent directory. > + SOURCE_DATE_EPOCH=`git --git-dir="${S}/.git" log -1 > --pretty=%ct 2>/dev/null || echo "${REPRODUCIBLE_TIMESTAMP_ROOTFS}"` > fi > + > + ts=`LC_ALL=C date -d @$SOURCE_DATE_EPOCH` > + export KBUILD_BUILD_TIMESTAMP="$ts" > + export KCONFIG_NOTIMESTAMP=1 > + bbnote "KBUILD_BUILD_TIMESTAMP: $ts" > + > # The $use_alternate_initrd is only set from > # do_bundle_initramfs() This variable is specifically for the > # case where we are making a second pass at the kernel > @@ -364,21 +363,20 @@ kernel_do_compile() { > > do_compile_kernelmodules() { > unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE > - if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then > - # kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH > may not > - # be set.... > - if [ "${SOURCE_DATE_EPOCH}" = "" -o "${SOURCE_DATE_EPOCH}" = > "0" ]; then > - # The source directory is not necessarily a git > repository, so we > - # specify the git-dir to ensure that git does not > query a > - # repository in any parent directory. > - SOURCE_DATE_EPOCH=`git --git-dir="${S}/.git" log -1 > --pretty=%ct 2>/dev/null || echo "${REPRODUCIBLE_TIMESTAMP_ROOTFS}"` > - fi > - > - ts=`LC_ALL=C date -d @$SOURCE_DATE_EPOCH` > - export KBUILD_BUILD_TIMESTAMP="$ts" > - export KCONFIG_NOTIMESTAMP=1 > - bbnote "KBUILD_BUILD_TIMESTAMP: $ts" > + # kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not > + # be set.... > + if [ "${SOURCE_DATE_EPOCH}" = "" -o "${SOURCE_DATE_EPOCH}" = "0" ]; > then > + # The source directory is not necessarily a git repository, > so we > + # specify the git-dir to ensure that git does not query a > + # repository in any parent directory. > + SOURCE_DATE_EPOCH=`git --git-dir="${S}/.git" log -1 > --pretty=%ct 2>/dev/null || echo "${REPRODUCIBLE_TIMESTAMP_ROOTFS}"` > fi > + > + ts=`LC_ALL=C date -d @$SOURCE_DATE_EPOCH` > + export KBUILD_BUILD_TIMESTAMP="$ts" > + export KCONFIG_NOTIMESTAMP=1 > + bbnote "KBUILD_BUILD_TIMESTAMP: $ts" > + > if (grep -q -i -e '^CONFIG_MODULES=y$' ${B}/.config); then > oe_runmake -C ${B} ${PARALLEL_MAKE} modules CC="${KERNEL_CC}" > LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} > > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf > index 1db9b3fc051..790f2f7a8c4 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 c2e3e2f4f58..038404e377a 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 808c3dc7009..622325aabb3 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.32.0 > > > > -- - Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#156948): https://lists.openembedded.org/g/openembedded-core/message/156948 Mute This Topic: https://lists.openembedded.org/mt/86310659/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-