[OE-core] [PATCH v2 6/6] image.bbclass: support binary reproducibility
Juro Bystricky
juro.bystricky at intel.com
Mon May 1 20:59:04 UTC 2017
Added a new task "reproducible_final_image_task".
If binary reproducibility is desired ($BUILD_REPRODUCIBLE_BINARIES" = "1"),
then recursivley modify mtimes of all files to a reproducible vale.
The value is obtained via REPRODUCIBLE_TIMESTAMP_ROOTFS.
This task is executed as the very last step in image creation, once all
the files in the image have been finalized.
[YOCTO#11176]
Signed-off-by: Juro Bystricky <juro.bystricky at intel.com>
---
meta/classes/image.bbclass | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 405fd73..c311de5 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -617,3 +617,15 @@ do_bundle_initramfs () {
:
}
addtask bundle_initramfs after do_image_complete
+
+reproducible_final_image_task () {
+ if [ "$BUILD_REPRODUCIBLE_BINARIES" = "1" ]; then
+ if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
+ REPRODUCIBLE_TIMESTAMP_ROOTFS=`git log -1 --pretty=%ct`
+ fi
+ # Set mtime of all files to a reproducible value
+ bbnote "reproducible_final_image_task: mtime set to $REPRODUCIBLE_TIMESTAMP_ROOTFS"
+ find ${IMAGE_ROOTFS} -exec touch -h --date=@$REPRODUCIBLE_TIMESTAMP_ROOTFS {} \;
+ fi
+}
+IMAGE_PREPROCESS_COMMAND_append = " reproducible_final_image_task; "
--
2.7.4
More information about the Openembedded-core
mailing list