diff options
author | Juro Bystricky <juro.bystricky@intel.com> | 2017-08-09 10:48:27 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-08-16 00:03:15 +0100 |
commit | 22463d22561504b56b522dc243c743d7e3c87c5a (patch) | |
tree | cd63e67e95b03b9e355b31dcf573031885457eea /meta/classes/image.bbclass | |
parent | 55e9485735ae8393b410f30973c785236dc402d2 (diff) | |
download | poky-22463d22561504b56b522dc243c743d7e3c87c5a.tar.gz |
image.bbclass: support binary reproducibility
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]
(From OE-Core rev: df8df5f907736c3e5b7f15ea11898a1d49726ca5)
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/image.bbclass')
-rw-r--r-- | meta/classes/image.bbclass | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 7949b465a3..35624870f7 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass | |||
@@ -117,7 +117,7 @@ def rootfs_variables(d): | |||
117 | 'IMAGE_ROOTFS_MAXSIZE','IMAGE_NAME','IMAGE_LINK_NAME','IMAGE_MANIFEST','DEPLOY_DIR_IMAGE','IMAGE_FSTYPES','IMAGE_INSTALL_COMPLEMENTARY','IMAGE_LINGUAS', | 117 | 'IMAGE_ROOTFS_MAXSIZE','IMAGE_NAME','IMAGE_LINK_NAME','IMAGE_MANIFEST','DEPLOY_DIR_IMAGE','IMAGE_FSTYPES','IMAGE_INSTALL_COMPLEMENTARY','IMAGE_LINGUAS', |
118 | 'MULTILIBRE_ALLOW_REP','MULTILIB_TEMP_ROOTFS','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS', | 118 | 'MULTILIBRE_ALLOW_REP','MULTILIB_TEMP_ROOTFS','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS', |
119 | 'PACKAGE_ARCHS','PACKAGE_CLASSES','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','OVERRIDES','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI','INTERCEPT_DIR','USE_DEVFS', | 119 | 'PACKAGE_ARCHS','PACKAGE_CLASSES','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','OVERRIDES','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI','INTERCEPT_DIR','USE_DEVFS', |
120 | 'CONVERSIONTYPES', 'IMAGE_GEN_DEBUGFS', 'ROOTFS_RO_UNNEEDED', 'IMGDEPLOYDIR', 'PACKAGE_EXCLUDE_COMPLEMENTARY'] | 120 | 'CONVERSIONTYPES', 'IMAGE_GEN_DEBUGFS', 'ROOTFS_RO_UNNEEDED', 'IMGDEPLOYDIR', 'PACKAGE_EXCLUDE_COMPLEMENTARY', 'REPRODUCIBLE_TIMESTAMP_ROOTFS'] |
121 | variables.extend(rootfs_command_variables(d)) | 121 | variables.extend(rootfs_command_variables(d)) |
122 | variables.extend(variable_depends(d)) | 122 | variables.extend(variable_depends(d)) |
123 | return " ".join(variables) | 123 | return " ".join(variables) |
@@ -254,6 +254,7 @@ fakeroot python do_rootfs () { | |||
254 | progress_reporter.next_stage() | 254 | progress_reporter.next_stage() |
255 | 255 | ||
256 | # generate rootfs | 256 | # generate rootfs |
257 | d.setVarFlag('REPRODUCIBLE_TIMESTAMP_ROOTFS', 'export', '1') | ||
257 | create_rootfs(d, progress_reporter=progress_reporter, logcatcher=logcatcher) | 258 | create_rootfs(d, progress_reporter=progress_reporter, logcatcher=logcatcher) |
258 | 259 | ||
259 | progress_reporter.finish() | 260 | progress_reporter.finish() |
@@ -266,6 +267,7 @@ addtask rootfs after do_prepare_recipe_sysroot | |||
266 | fakeroot python do_image () { | 267 | fakeroot python do_image () { |
267 | from oe.utils import execute_pre_post_process | 268 | from oe.utils import execute_pre_post_process |
268 | 269 | ||
270 | d.setVarFlag('REPRODUCIBLE_TIMESTAMP_ROOTFS', 'export', '1') | ||
269 | pre_process_cmds = d.getVar("IMAGE_PREPROCESS_COMMAND") | 271 | pre_process_cmds = d.getVar("IMAGE_PREPROCESS_COMMAND") |
270 | 272 | ||
271 | execute_pre_post_process(d, pre_process_cmds) | 273 | execute_pre_post_process(d, pre_process_cmds) |
@@ -651,3 +653,15 @@ create_merged_usr_symlinks_sdk() { | |||
651 | 653 | ||
652 | ROOTFS_PREPROCESS_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_symlinks_rootfs; ', '',d)}" | 654 | ROOTFS_PREPROCESS_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_symlinks_rootfs; ', '',d)}" |
653 | POPULATE_SDK_PRE_TARGET_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_symlinks_sdk; ', '',d)}" | 655 | POPULATE_SDK_PRE_TARGET_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_symlinks_sdk; ', '',d)}" |
656 | |||
657 | reproducible_final_image_task () { | ||
658 | if [ "$BUILD_REPRODUCIBLE_BINARIES" = "1" ]; then | ||
659 | if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then | ||
660 | REPRODUCIBLE_TIMESTAMP_ROOTFS=`git log -1 --pretty=%ct` | ||
661 | fi | ||
662 | # Set mtime of all files to a reproducible value | ||
663 | bbnote "reproducible_final_image_task: mtime set to $REPRODUCIBLE_TIMESTAMP_ROOTFS" | ||
664 | find ${IMAGE_ROOTFS} -exec touch -h --date=@$REPRODUCIBLE_TIMESTAMP_ROOTFS {} \; | ||
665 | fi | ||
666 | } | ||
667 | IMAGE_PREPROCESS_COMMAND_append = " reproducible_final_image_task; " | ||