Thanks!

I've merged this to the kernel tools, and the SRCREV bump will
be in my next kernel pull request.

Bruce

In message: [linux-yocto] [yocto-kernel-tools][PATCH] kgit-s2q: fix commit SHA 
reproducibility with raw diffs
on 22/11/2025 Hubert Wiśniewski via lists.yoctoproject.org wrote:

> In case of git-am failure, kgit-s2q tries to read the date from the
> patch. Unfortunately, if the patch does not have a date (e.g. raw diff),
> no date is set and git uses the current system time.
> 
> This patch makes kgit-s2q use SOURCE_DATE_EPOCH as the last resort or emit
> a warning if it's not available. Additionally, GIT_COMMITTER_DATE is set
> to GIT_AUTHOR_DATE if requested with --commit-sha option (same behavior as
> with git-am).
> 
> Signed-off-by: Hubert Wiśniewski <[email protected]>
> ---
>  tools/kgit-s2q | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/kgit-s2q b/tools/kgit-s2q
> index c63c17a..41d5942 100755
> --- a/tools/kgit-s2q
> +++ b/tools/kgit-s2q
> @@ -661,8 +661,18 @@ do
>               fi
>       done
>       GIT_AUTHOR_DATE=$(sed -ne 's/Date: //p' "$tmp_info")
> +     if [ -z "$GIT_AUTHOR_DATE" ] && [ -n "$SOURCE_DATE_EPOCH" ]; then
> +             GIT_AUTHOR_DATE="$SOURCE_DATE_EPOCH +0000"
> +     fi
> +     if [ -z "$GIT_AUTHOR_DATE" ]; then
> +             echo "[WARNING]: Could not determine author date, the current 
> date will be used."
> +             echo "           This may hurt kernel revision reproducibility."
> +     fi
> +     if [ "$commit_sha_type" == "author" ]; then
> +             GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
> +     fi
>       SUBJECT=$(sed -ne 's/Subject: //p' "$tmp_info")
> -     export GIT_AUTHOR_DATE SUBJECT
> +     export GIT_AUTHOR_DATE GIT_COMMITTER_DATE SUBJECT
>       if [ -z "$SUBJECT" ] ; then
>               SUBJECT=$(echo $patch_name | sed -e 's/.patch$//')
>       fi
> @@ -727,6 +737,7 @@ do
>               GIT_AUTHOR_NAME=""
>               GIT_AUTHOR_EMAIL=""
>               GIT_AUTHOR_DATE=""
> +             GIT_COMMITTER_DATE=""
>               SUBJECT=""
>       fi
>  done
> -- 
> 2.39.5

> 
> 
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#16027): 
https://lists.yoctoproject.org/g/linux-yocto/message/16027
Mute This Topic: https://lists.yoctoproject.org/mt/116423625/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

  • [linux-yocto] [yocto-ker... Hubert Wiśniewski via lists . yoctoproject . org
    • Re: [linux-yocto] [... Bruce Ashfield via lists.yoctoproject.org

Reply via email to