[oe-commits] [openembedded-core] 24/27: systemd: ensure reproducible builds by clearly exposing the time epoch support

git at git.openembedded.org git at git.openembedded.org
Fri Sep 6 13:59:01 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 29afbd4f02354de7103ee3a88f4ce5336b95b88a
Author: Ross Burton <ross.burton at intel.com>
AuthorDate: Thu Sep 5 23:49:59 2019 +0100

    systemd: ensure reproducible builds by clearly exposing the time epoch support
    
    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 at 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 6bbe388..2c101cb 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 \
     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"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list