diff mbox series

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

Message ID 20240704193642.1929491-1-aquini@redhat.com (mailing list archive)
State New
Headers show
Series None | expand

Commit Message

Rafael Aquini July 4, 2024, 7:36 p.m. UTC
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@redhat.com>
---
v2: move the changelog stub generator to mkspec (masahiroy)

 scripts/package/mkspec | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Comments

Masahiro Yamada July 6, 2024, 3:40 a.m. UTC | #1
On Fri, Jul 5, 2024 at 4:36 AM Rafael Aquini <aquini@redhat.com> 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@redhat.com>
> ---
> 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
diff mbox series

Patch

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