All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jate Sujjavanich" <jatedev@gmail.com>
To: Ross Burton <ross@burtonini.com>
Cc: Richard Purdie <richard.purdie@linuxfoundation.org>,
	 OE-core <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH 4/6] reproducible_build: clamp the rootfs tarball mtime to the epoch
Date: Tue, 1 Dec 2020 18:25:48 -0500	[thread overview]
Message-ID: <CAPphmgY8+DXwRQdKKznk=6-V9ctc-aykDBv1fQWGeBPNbRxDng@mail.gmail.com> (raw)
In-Reply-To: <CAAnfSTv=GdCS6Ybup5Y77sHiG1DZ7ev+sgbgeutCrPb7=GL8bQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1761 bytes --]

I have started using the following code to set the mtimes of files written
after the build timestamp. It assumes that SOURCE_DATE_EPOCH of packages
are never in the future.

# Set to empty to allow custom function below to run
REPRODUCIBLE_TIMESTAMP_ROOTFS ?= ""

# Use DATETIME of build as SOURCE_DATE_EPOCH for image
export SOURCE_DATE_EPOCH = "${@int( time.mktime( time.strptime('${DATETIME}',
'%Y%m%d%H%M%S') ) ) }"

reproducible_final_image_task () {
if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then
if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
# Use commit time of tuxzilla root in usual Syntux build
REPRODUCIBLE_TIMESTAMP_ROOTFS=`git -C "${COREBASE}/../" log -1 --pretty=%ct
2>/dev/null`
if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
REPRODUCIBLE_TIMESTAMP_ROOTFS=`stat -c%Y ${@bb.utils.which(d.getVar("BBPATH"),
"conf/bitbake.conf")}`
fi
fi
# Set mtime of all files to a reproducible value
bbnote "reproducible_final_image_task: mtime set to
$REPRODUCIBLE_TIMESTAMP_ROOTFS"
# Files with mtime after build stamp should be part of rootfs creation
DAYS_SINCE_BUILD=`python3 -c "import time; print((time.time() -
${SOURCE_DATE_EPOCH}) / 86400)"`
find ${IMAGE_ROOTFS} -mtime -$DAYS_SINCE_BUILD -exec touch -h --date=@
$REPRODUCIBLE_TIMESTAMP_ROOTFS {} \;
fi
}


On Tue, Dec 1, 2020 at 12:16 PM Ross Burton <ross@burtonini.com> wrote:

> On Tue, 1 Dec 2020 at 15:45, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > I'm not convinced this is correct as it could mess up the timestamps of
> > stamps set in other recipes?
> >
> > It's also tar specific and should really be across all image types?
>
> Yes, it most likely should be done at rootfs time instead.
>
> Ross
>
> 
>
>

[-- Attachment #2: Type: text/html, Size: 6717 bytes --]

  reply	other threads:[~2020-12-01 23:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 15:23 [PATCH 1/6] ldconfig-native: don't write auxiliary cache Ross Burton
2020-12-01 15:23 ` [PATCH 2/6] image_types: remove obsolete tar comment Ross Burton
2020-12-01 15:23 ` [PATCH 3/6] image_types: sort tarball file listings Ross Burton
2020-12-01 15:23 ` [PATCH 4/6] reproducible_build: clamp the rootfs tarball mtime to the epoch Ross Burton
2020-12-01 15:45   ` [OE-core] " Richard Purdie
2020-12-01 17:16     ` Ross Burton
2020-12-01 23:25       ` Jate Sujjavanich [this message]
2020-12-01 15:23 ` [PATCH 5/6] package_manager/ipk: neaten OPKGLIBDIR logic Ross Burton
2020-12-01 15:23 ` [PATCH 6/6] package_manager/ipk: improve remove_packaging_data Ross Burton

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='CAPphmgY8+DXwRQdKKznk=6-V9ctc-aykDBv1fQWGeBPNbRxDng@mail.gmail.com' \
    --to=jatedev@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    --cc=ross@burtonini.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.