aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes/image.bbclass
diff options
context:
space:
mode:
authorJuro Bystricky <juro.bystricky@intel.com>2017-08-09 10:48:27 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-16 00:01:44 +0100
commitdf8df5f907736c3e5b7f15ea11898a1d49726ca5 (patch)
treedb3f000e4d875b3b7ec28c54cada03b0363de414 /meta/classes/image.bbclass
parent012a70da7ae0617740cd0cf807d01c3cd912c823 (diff)
downloadopenembedded-core-contrib-df8df5f907736c3e5b7f15ea11898a1d49726ca5.tar.gz
openembedded-core-contrib-df8df5f907736c3e5b7f15ea11898a1d49726ca5.tar.bz2
openembedded-core-contrib-df8df5f907736c3e5b7f15ea11898a1d49726ca5.zip
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] 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.bbclass16
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):
'IMAGE_ROOTFS_MAXSIZE','IMAGE_NAME','IMAGE_LINK_NAME','IMAGE_MANIFEST','DEPLOY_DIR_IMAGE','IMAGE_FSTYPES','IMAGE_INSTALL_COMPLEMENTARY','IMAGE_LINGUAS',
'MULTILIBRE_ALLOW_REP','MULTILIB_TEMP_ROOTFS','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS',
'PACKAGE_ARCHS','PACKAGE_CLASSES','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','OVERRIDES','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI','INTERCEPT_DIR','USE_DEVFS',
- 'CONVERSIONTYPES', 'IMAGE_GEN_DEBUGFS', 'ROOTFS_RO_UNNEEDED', 'IMGDEPLOYDIR', 'PACKAGE_EXCLUDE_COMPLEMENTARY']
+ 'CONVERSIONTYPES', 'IMAGE_GEN_DEBUGFS', 'ROOTFS_RO_UNNEEDED', 'IMGDEPLOYDIR', 'PACKAGE_EXCLUDE_COMPLEMENTARY', 'REPRODUCIBLE_TIMESTAMP_ROOTFS']
variables.extend(rootfs_command_variables(d))
variables.extend(variable_depends(d))
return " ".join(variables)
@@ -254,6 +254,7 @@ fakeroot python do_rootfs () {
progress_reporter.next_stage()
# generate rootfs
+ d.setVarFlag('REPRODUCIBLE_TIMESTAMP_ROOTFS', 'export', '1')
create_rootfs(d, progress_reporter=progress_reporter, logcatcher=logcatcher)
progress_reporter.finish()
@@ -266,6 +267,7 @@ addtask rootfs after do_prepare_recipe_sysroot
fakeroot python do_image () {
from oe.utils import execute_pre_post_process
+ d.setVarFlag('REPRODUCIBLE_TIMESTAMP_ROOTFS', 'export', '1')
pre_process_cmds = d.getVar("IMAGE_PREPROCESS_COMMAND")
execute_pre_post_process(d, pre_process_cmds)
@@ -651,3 +653,15 @@ create_merged_usr_symlinks_sdk() {
ROOTFS_PREPROCESS_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_symlinks_rootfs; ', '',d)}"
POPULATE_SDK_PRE_TARGET_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_symlinks_sdk; ', '',d)}"
+
+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; "