]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
kbuild: rpm-pkg: introduce a simple changelog section for kernel.spec
authorRafael Aquini <aquini@redhat.com>
Tue, 16 Jul 2024 12:25:05 +0000 (08:25 -0400)
committerMasahiro Yamada <masahiroy@kernel.org>
Sat, 20 Jul 2024 07:33:44 +0000 (16:33 +0900)
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>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/package/mkspec

index 77d25dda37e35f575b780bb1002238b699fb4803..ead54d67a024150fcdc96e178e9aa658994f4afd 100755 (executable)
@@ -30,3 +30,26 @@ cat<<EOF
 EOF
 
 cat "${srctree}/scripts/package/kernel.spec"
+
+# collect the user's name and email address 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)}
+       builduser=${KBUILD_BUILD_USER:-$(id -nu)}
+       email="${builduser}@${buildhost}"
+fi
+
+cat << EOF
+
+%changelog
+* $(LC_ALL=C; date +'%a %b %d %Y') ${name} <${email}>
+- Custom built Linux kernel.
+EOF