From: <Mikko.Rapeli@bmw.de>
To: <ross.burton@intel.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] systemd: ensure reproducible builds by clearly exposing the time epoch support
Date: Fri, 6 Sep 2019 08:02:44 +0000 [thread overview]
Message-ID: <20190906080244.GQ3040@hiutale> (raw)
In-Reply-To: <20190905230706.31765-1-ross.burton@intel.com>
On Fri, Sep 06, 2019 at 12:07:06AM +0100, Ross Burton wrote:
> systemd has the ability to check the time on boot and if it's earlier than an
> epoch determined at build time, set the time to that epoch. This is useful for
> systems where the system time is January 1st 1970 (because the unix timestamp
> was 0 at boot) as then at least the time is reset to something approximating the
> right year at least.
>
> By default systemd uses the mtime of the NEWS file, which is static for tarballs
> and corresponds to the time the release was made, but for git checkouts this is
> simply the time do_unpack() was executed. Thus, rebuilding systemd will cause
> this embedded timestamp to change.
>
> Remove the PACKAGECONFIG time-epoch which has the logic reversed: enabling
> time-epoch will set the epoch to the unix timestamp 0). Replace with
> set-time-epoch with the following semantics:
>
> - When disabled, the time epoch is set to 0 (1st January 1970), so there is no
> time manipulation on boot.
>
> - When enabled, if reproducible builds are configured by setting
> SOURCE_DATE_EPOCH then that timestamp is used for the time epoch. If
> reproducible builds are not configured then the timestamp of NEWS (thus the
> build time) is used.
>
> The set-time-epoch flag is enabled by default.
>
> [ YOCTO #13473 ]
>
> Signed-off-by: Ross Burton <ross.burton@intel.com>
> ---
> meta/recipes-core/systemd/systemd_242.bb | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-core/systemd/systemd_242.bb b/meta/recipes-core/systemd/systemd_242.bb
> index 6bbe388b1f9..2c101cbbb4a 100644
> --- a/meta/recipes-core/systemd/systemd_242.bb
> +++ b/meta/recipes-core/systemd/systemd_242.bb
> @@ -83,6 +83,7 @@ PACKAGECONFIG ??= " \
> quotacheck \
> randomseed \
> resolved \
> + set-time-epoch \
Could this be enabled automatically when local.conf has INHERIT += "reproducible_build" ?
-Mikko
> smack \
> sysusers \
> timedated \
> @@ -166,7 +167,12 @@ PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp"
> PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,initscripts-sushell"
> PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false"
> PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false"
> -PACKAGECONFIG[time-epoch] = "-Dtime-epoch=0,,"
> +# When enabled use reproducble build timestamp if set as time epoch,
> +# or build time if not. When disabled, time epoch is unset.
> +def build_epoch(d):
> + epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1"
> + return '-Dtime-epoch=%d' % int(epoch)
> +PACKAGECONFIG[set-time-epoch] = "${@build_epoch(d)},-Dtime-epoch=0"
> PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false"
> PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false"
> PACKAGECONFIG[usrmerge] = "-Dsplit-usr=false,-Dsplit-usr=true"
> --
> 2.20.1
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
next prev parent reply other threads:[~2019-09-06 8:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-05 23:07 [PATCH] systemd: ensure reproducible builds by clearly exposing the time epoch support Ross Burton
2019-09-06 8:02 ` Mikko.Rapeli [this message]
2019-09-06 9:03 ` Ross Burton
2019-09-06 9:43 ` Mikko.Rapeli
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=20190906080244.GQ3040@hiutale \
--to=mikko.rapeli@bmw.de \
--cc=openembedded-core@lists.openembedded.org \
--cc=ross.burton@intel.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