public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Felix Moessbauer <felix.moessbauer@siemens.com>
To: isar-users@googlegroups.com
Cc: Felix Moessbauer <felix.moessbauer@siemens.com>,
	"Roberto A . Foglietta" <roberto.foglietta@gmail.com>
Subject: [PATCH 4/4] warn only once in case file timestamps are updated
Date: Wed, 25 Jan 2023 14:46:32 +0000	[thread overview]
Message-ID: <20230125144632.2099908-4-felix.moessbauer@siemens.com> (raw)
In-Reply-To: <20230125144632.2099908-1-felix.moessbauer@siemens.com>

When creating a reproducible image, file timestamps of too-new files are
updated in a postprocess step. This includes potentially many files.

Previously, a bitbake warning was filed per single file, which
overflooded the terminal. The new implementation simply prints a summary
and gives a hint where the full list can be found.

Suggested-by: Roberto A. Foglietta <roberto.foglietta@gmail.com>
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes/image.bbclass | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index e59767e7..eb546084 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -447,11 +447,14 @@ EOSUDO
     # Set same time-stamps to the newly generated file/folders in the
     # rootfs image for the purpose of reproducible builds.
     if [ -n "${SOURCE_DATE_EPOCH}" ]; then
-        sudo find ${ROOTFSDIR} -newermt \
-            "$(date -d@${SOURCE_DATE_EPOCH} '+%Y-%m-%d %H:%M:%S')" \
-            -printf "%y %p\n" \
-            -exec touch '{}' -h -d@${SOURCE_DATE_EPOCH} ';' > ${DEPLOY_DIR_IMAGE}/files.modified_timestamps && \
-            bbwarn "$(grep ^f ${DEPLOY_DIR_IMAGE}/files.modified_timestamps) \nModified above file timestamps to build image reproducibly"
+        fn="${DEPLOY_DIR_IMAGE}/files.modified_timestamps"
+        if sudo find ${ROOTFSDIR} -newermt "$(date -d@${SOURCE_DATE_EPOCH} '+%Y-%m-%d %H:%M:%S')" \
+            -printf "%y %p\n" -exec touch '{}' -h -d@${SOURCE_DATE_EPOCH} ';' | egrep ^f >"$fn"; then
+            if [ -e "$fn" ]; then
+                bbwarn "modified timestamp (${SOURCE_DATE_EPOCH}) of $(cat "$fn" | wc -l) files for image reproducibly." \
+                       "List of files modified can be found in: .${DEPLOY_DIR_IMAGE}/files.modified_timestamps"
+            fi
+        fi
     fi
 
 }
-- 
2.34.1


  parent reply	other threads:[~2023-01-25 14:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25 14:46 [PATCH 1/4] set SOURCE_DATE_EPOCH in wic environment Felix Moessbauer
2023-01-25 14:46 ` [PATCH 2/4] remove apt cache dirs from final rootfs Felix Moessbauer
2023-01-25 14:46 ` [PATCH 3/4] clean /tmp in rootfs postprocess Felix Moessbauer
2023-01-25 14:46 ` Felix Moessbauer [this message]
2023-02-01  6:21 ` [PATCH 1/4] set SOURCE_DATE_EPOCH in wic environment Uladzimir Bely

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=20230125144632.2099908-4-felix.moessbauer@siemens.com \
    --to=felix.moessbauer@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=roberto.foglietta@gmail.com \
    /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