[OE-core] [PATCH 4/4] rootfs-postcommands.bbclass: support binary reproducibility
Juro Bystricky
juro.bystricky at intel.com
Tue Apr 25 18:14:08 UTC 2017
Conditionally support binary reproducibility of rootfs images.
If BUILD_REPRODUCIBLE_BINARIES = 1 then:
1. set /etc/timestamp to a reproducible value
2. set /etc/version to a reproducible value
The value for /etc/version is modified in a designated catch-all
post-rootfs function "rootfs_reproducible". This function is expected
to provide additional functionality to improve the determinism based
on future needs
[YOCTO#11176]
Signed-off-by: Juro Bystricky <juro.bystricky at intel.com>
---
meta/classes/rootfs-postcommands.bbclass | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass
index 498174a..be1e8dd 100644
--- a/meta/classes/rootfs-postcommands.bbclass
+++ b/meta/classes/rootfs-postcommands.bbclass
@@ -28,6 +28,8 @@ ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "systemd"
ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile;'
+ROOTFS_POSTPROCESS_COMMAND += 'rootfs_reproducible;'
+
# Disable DNS lookups, the SSH_DISABLE_DNS_LOOKUP can be overridden to allow
# distros to choose not to take this change
SSH_DISABLE_DNS_LOOKUP ?= " ssh_disable_dns_lookup ; "
@@ -246,7 +248,12 @@ python write_image_manifest () {
# Can be use to create /etc/timestamp during image construction to give a reasonably
# sane default time setting
rootfs_update_timestamp () {
- date -u +%4Y%2m%2d%2H%2M%2S >${IMAGE_ROOTFS}/etc/timestamp
+ if [ "$BUILD_REPRODUCIBLE_BINARIES" = "1" ]; then
+ bbnote " rootfs_update_timestamp: BUILD_REPRODUCIBLE_BINARIES..."
+ git log -1 --pretty=%cd --date=format:%4Y%2m%2d%2H%2M%2S >${IMAGE_ROOTFS}/etc/timestamp
+ else
+ date -u +%4Y%2m%2d%2H%2M%2S >${IMAGE_ROOTFS}/etc/timestamp
+ fi
}
# Prevent X from being started
@@ -286,7 +293,6 @@ rootfs_sysroot_relativelinks () {
sysroot-relativelinks.py ${SDK_OUTPUT}/${SDKTARGETSYSROOT}
}
-
# Generated test data json file
python write_image_test_data() {
from oe.data import export2json
@@ -302,3 +308,11 @@ python write_image_test_data() {
os.remove(testdata_link)
os.symlink(os.path.basename(testdata), testdata_link)
}
+
+# Perform any additional adjustments needed to make rootf binary reproducible
+rootfs_reproducible () {
+ if [ "$BUILD_REPRODUCIBLE_BINARIES" = "1" ]; then
+ bbnote " rootfs_reproducible: set /etc/version..."
+ git log -1 --pretty=%cd --date=format:%4Y%2m%2d%2H%2M%2S >${IMAGE_ROOTFS}/etc/version
+ fi
+}
--
2.7.4
More information about the Openembedded-core
mailing list