Re: [PATCH v2 2/2] kbuild: rpm-pkg: introduce a simple changelog section for kernel.spec

From: Masahiro Yamada
Date: Fri Jul 05 2024 - 23:41:17 EST


On Fri, Jul 5, 2024 at 4:36 AM Rafael Aquini <aquini@xxxxxxxxxx> wrote:
>
> Fix the following rpmbuild warning:
>
> $ make srcrpm-pkg
> ...
> RPM build warnings:
> source_date_epoch_from_changelog set but %changelog is missing
>
> Signed-off-by: Rafael Aquini <aquini@xxxxxxxxxx>
> ---
> v2: move the changelog stub generator to mkspec (masahiroy)
>
> scripts/package/mkspec | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/scripts/package/mkspec b/scripts/package/mkspec
> index ce201bfa8377..6abbfef700fd 100755
> --- a/scripts/package/mkspec
> +++ b/scripts/package/mkspec
> @@ -28,3 +28,25 @@ cat<<EOF
> EOF
>
> cat "${srctree}/scripts/package/kernel.spec"
> +
> +# collect the user's name and email addr for the changelog entry


"addr" -> "address"






> +if [ "$(command -v git)" ]; then
> + name=$(git config user.name) || true
> + email=$(git config user.email) || true
> +fi
> +
> +if [ ! "${name:+set}" ]; then
> + name=${KBUILD_BUILD_USER:-$(id -nu)}
> +fi
> +
> +if [ ! "${email:+set}" ]; then
> + buildhost=${KBUILD_BUILD_HOST:-$(hostname -f 2>/dev/null || hostname)}
> + email="${name}@${buildhost}"



This is not what I suggested.



My intention was to avoid spaces in the email address.


Consider this scenario:

- `git config user.name` returns "Foo Bar".

- There is no configuration for `git config user.email`


The email will be set to "Foo Bar@some-hostname".




I am not sure if a space is allowed in an email address,
but I have never seen such an address.









> +fi
> +
> +cat << EOF
> +
> +%changelog
> +* $(LC_ALL=C; date +'%a %b %d %Y') ${name} <${email}> - ${KERNELRELEASE}
> +- Custom built Linux kernel.
> +EOF
> --
> 2.45.1
>

--
Best Regards
Masahiro Yamada