diff --git a/meta/classes-global/utils.bbclass b/meta/classes-global/utils.bbclass index c9cae8930f..530a490ea8 100644 --- a/meta/classes-global/utils.bbclass +++ b/meta/classes-global/utils.bbclass @@ -367,3 +367,13 @@ check_git_config() { git config --local user.name "${PATCH_GIT_USER_NAME}" fi } + +# Sets fixed git committer and author for reproducible commits +reproducible_git_committer_author() { + export GIT_COMMITTER_NAME="${PATCH_GIT_USER_NAME}" + export GIT_COMMITTER_EMAIL="${PATCH_GIT_USER_EMAIL}" + export GIT_COMMITTER_DATE="$(date -d @${SOURCE_DATE_EPOCH})" + export GIT_AUTHOR_NAME="${PATCH_GIT_USER_NAME}" + export GIT_AUTHOR_EMAIL="${PATCH_GIT_USER_EMAIL}" + export GIT_AUTHOR_DATE="$(date -d @${SOURCE_DATE_EPOCH})" +} diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass index 7d80e9aa52..697132c073 100644 --- a/meta/classes-recipe/kernel-yocto.bbclass +++ b/meta/classes-recipe/kernel-yocto.bbclass @@ -352,6 +352,9 @@ do_patch() { cd ${S} check_git_config + if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then + reproducible_git_committer_author + fi meta_dir=$(kgit --meta) (cd ${meta_dir}; ln -sf patch.queue series) if [ -f "${meta_dir}/series" ]; then @@ -434,6 +437,9 @@ do_kernel_checkout() { rm -f .gitignore git init check_git_config + if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then + reproducible_git_committer_author + fi git add . git commit -q -n -m "baseline commit: creating repo for ${PN}-${PV}" git clean -d -f