openembedded-core.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
From: Bruce Ashfield <bruce.ashfield@gmail.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH 7/7] reproducible: Drop BUILD_REPRODUCIBLE_BINARIES variable
Date: Thu, 14 Oct 2021 08:28:53 -0400	[thread overview]
Message-ID: <CADkTA4MccXdOvzaEoHOX-wVj-iFsLRb7OsDpO+myowr3f0gT=w@mail.gmail.com> (raw)
In-Reply-To: <20211014121025.2913401-7-richard.purdie@linuxfoundation.org>

On Thu, Oct 14, 2021 at 8:10 AM Richard Purdie
<richard.purdie@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.purdie@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
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#156943): https://lists.openembedded.org/g/openembedded-core/message/156943
> Mute This Topic: https://lists.openembedded.org/mt/86310659/1050810
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [bruce.ashfield@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


  reply	other threads:[~2021-10-14 12:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-14 12:10 [PATCH 1/7] reproducible_build: Drop now unneeded compiler warning Richard Purdie
2021-10-14 12:10 ` [PATCH 2/7] reproducible_build: Drop obsolete sstate workaround Richard Purdie
2021-10-14 12:10 ` [PATCH 3/7] reproducible: Move class function code into library Richard Purdie
2021-10-14 12:10 ` [PATCH 4/7] reproducible: Move variable definitions to bitbake.conf Richard Purdie
2021-10-14 12:10 ` [PATCH 5/7] reproducible: Merge code into base.bbclass Richard Purdie
2021-10-14 12:10 ` [PATCH 6/7] python: Update now reproducibile builds are the default Richard Purdie
2021-10-14 12:10 ` [PATCH 7/7] reproducible: Drop BUILD_REPRODUCIBLE_BINARIES variable Richard Purdie
2021-10-14 12:28   ` Bruce Ashfield [this message]
2021-10-14 12:31     ` [OE-core] " Richard Purdie
2021-10-14 12:38       ` Bruce Ashfield
2021-10-14 13:45         ` Alexandre Belloni
2021-10-14 13:46           ` Bruce Ashfield
2021-10-14 15:26             ` Richard Purdie
2021-10-14 16:36 ` [OE-core] [PATCH 1/7] reproducible_build: Drop now unneeded compiler warning Khem Raj
2021-10-14 21:48   ` Richard Purdie
2021-10-14 23:22     ` Khem Raj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADkTA4MccXdOvzaEoHOX-wVj-iFsLRb7OsDpO+myowr3f0gT=w@mail.gmail.com' \
    --to=bruce.ashfield@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).