2024-06-10 16:39:33

by Rafael Aquini

[permalink] [raw]
Subject: [PATCH] kbuild: rpm-pkg: fix rpmbuild warnings for kernel.spec

Newer revisions of rpmbuild are throwing warnings about the current
kernel.spec template having an unversioned kernel-headers in the
'Obsoletes:' field and not being able to source the epoch's date from
the spec's missing '%changelog' section:

$ make srcrpm-pkg
UPD include/config/kernel.release
GEN rpmbuild/SPECS/kernel.spec
UPD .tmp_HEAD
ARCHIVE linux.tar.gz
rpmbuild -bs rpmbuild/SPECS/kernel.spec --define='_topdir /mnt/nfs/work/kernel/linux/rpmbuild'
warning: line 34: It's not recommended to have unversioned Obsoletes: Obsoletes: kernel-headers
warning: source_date_epoch_from_changelog set but %changelog is missing
Wrote: /mnt/nfs/work/kernel/linux/rpmbuild/SRPMS/kernel-6.10.0_rc3-1.src.rpm

RPM build warnings:
line 34: It's not recommended to have unversioned Obsoletes: Obsoletes: kernel-headers
source_date_epoch_from_changelog set but %changelog is missing

This patch addresses both RPM build warnings.

Signed-off-by: Rafael Aquini <[email protected]>
---
scripts/package/kernel.spec | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
index e095eb1e290e..4d58b29c03ad 100644
--- a/scripts/package/kernel.spec
+++ b/scripts/package/kernel.spec
@@ -1,3 +1,5 @@
+%global source_date_epoch_from_changelog 0
+
# _arch is undefined if /usr/lib/rpm/platform/*/macros was not included.
%{!?_arch: %define _arch dummy}
%{!?make: %define make make}
@@ -27,7 +29,7 @@ The Linux Kernel, the operating system core itself
%package headers
Summary: Header files for the Linux kernel for use by glibc
Group: Development/System
-Obsoletes: kernel-headers
+Obsoletes: kernel-headers < %{version}
Provides: kernel-headers = %{version}
%description headers
Kernel-headers includes the C header files that specify the interface
--
2.45.1



2024-06-11 15:07:57

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH] kbuild: rpm-pkg: fix rpmbuild warnings for kernel.spec

On Tue, Jun 11, 2024 at 1:39 AM Rafael Aquini <[email protected]> wrote:
>
> Newer revisions of rpmbuild are throwing warnings about the current
> kernel.spec template having an unversioned kernel-headers in the
> 'Obsoletes:' field and not being able to source the epoch's date from
> the spec's missing '%changelog' section:
>
> $ make srcrpm-pkg
> UPD include/config/kernel.release
> GEN rpmbuild/SPECS/kernel.spec
> UPD .tmp_HEAD
> ARCHIVE linux.tar.gz
> rpmbuild -bs rpmbuild/SPECS/kernel.spec --define='_topdir /mnt/nfs/work/kernel/linux/rpmbuild'
> warning: line 34: It's not recommended to have unversioned Obsoletes: Obsoletes: kernel-headers
> warning: source_date_epoch_from_changelog set but %changelog is missing
> Wrote: /mnt/nfs/work/kernel/linux/rpmbuild/SRPMS/kernel-6.10.0_rc3-1.src.rpm
>
> RPM build warnings:
> line 34: It's not recommended to have unversioned Obsoletes: Obsoletes: kernel-headers
> source_date_epoch_from_changelog set but %changelog is missing
>
> This patch addresses both RPM build warnings.
>
> Signed-off-by: Rafael Aquini <[email protected]>
> ---
> scripts/package/kernel.spec | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
> index e095eb1e290e..4d58b29c03ad 100644
> --- a/scripts/package/kernel.spec
> +++ b/scripts/package/kernel.spec
> @@ -1,3 +1,5 @@
> +%global source_date_epoch_from_changelog 0
>


Another possibility might be to add %changelog section.

In Debian packaging, debian/changelog is a requirement.

scripts/package/mkdebian generates a very small
debian/changelog with a single log entry.




> # _arch is undefined if /usr/lib/rpm/platform/*/macros was not included.
> %{!?_arch: %define _arch dummy}
> %{!?make: %define make make}
> @@ -27,7 +29,7 @@ The Linux Kernel, the operating system core itself
> %package headers
> Summary: Header files for the Linux kernel for use by glibc
> Group: Development/System
> -Obsoletes: kernel-headers
> +Obsoletes: kernel-headers < %{version}


No objection to this fix.



> Provides: kernel-headers = %{version}
> %description headers
> Kernel-headers includes the C header files that specify the interface
> --
> 2.45.1
>


--
Best Regards
Masahiro Yamada

2024-06-11 16:06:01

by Rafael Aquini

[permalink] [raw]
Subject: Re: [PATCH] kbuild: rpm-pkg: fix rpmbuild warnings for kernel.spec

On Wed, Jun 12, 2024 at 12:00:18AM +0900, Masahiro Yamada wrote:
> On Tue, Jun 11, 2024 at 1:39 AM Rafael Aquini <[email protected]> wrote:
> >
> > Newer revisions of rpmbuild are throwing warnings about the current
> > kernel.spec template having an unversioned kernel-headers in the
> > 'Obsoletes:' field and not being able to source the epoch's date from
> > the spec's missing '%changelog' section:
> >
> > $ make srcrpm-pkg
> > UPD include/config/kernel.release
> > GEN rpmbuild/SPECS/kernel.spec
> > UPD .tmp_HEAD
> > ARCHIVE linux.tar.gz
> > rpmbuild -bs rpmbuild/SPECS/kernel.spec --define='_topdir /mnt/nfs/work/kernel/linux/rpmbuild'
> > warning: line 34: It's not recommended to have unversioned Obsoletes: Obsoletes: kernel-headers
> > warning: source_date_epoch_from_changelog set but %changelog is missing
> > Wrote: /mnt/nfs/work/kernel/linux/rpmbuild/SRPMS/kernel-6.10.0_rc3-1.src.rpm
> >
> > RPM build warnings:
> > line 34: It's not recommended to have unversioned Obsoletes: Obsoletes: kernel-headers
> > source_date_epoch_from_changelog set but %changelog is missing
> >
> > This patch addresses both RPM build warnings.
> >
> > Signed-off-by: Rafael Aquini <[email protected]>
> > ---
> > scripts/package/kernel.spec | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
> > index e095eb1e290e..4d58b29c03ad 100644
> > --- a/scripts/package/kernel.spec
> > +++ b/scripts/package/kernel.spec
> > @@ -1,3 +1,5 @@
> > +%global source_date_epoch_from_changelog 0
> >
>
>
> Another possibility might be to add %changelog section.
>
> In Debian packaging, debian/changelog is a requirement.
>
> scripts/package/mkdebian generates a very small
> debian/changelog with a single log entry.
>

I'll take a stab at it, then. Thanks for the pointer!

Cheers,
-- Rafael


2024-06-11 16:34:21

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH] kbuild: rpm-pkg: fix rpmbuild warnings for kernel.spec

On Wed, Jun 12, 2024 at 1:03 AM Rafael Aquini <[email protected]> wrote:
>
> On Wed, Jun 12, 2024 at 12:00:18AM +0900, Masahiro Yamada wrote:
> > On Tue, Jun 11, 2024 at 1:39 AM Rafael Aquini <[email protected]> wrote:
> > >
> > > Newer revisions of rpmbuild are throwing warnings about the current
> > > kernel.spec template having an unversioned kernel-headers in the
> > > 'Obsoletes:' field and not being able to source the epoch's date from
> > > the spec's missing '%changelog' section:
> > >
> > > $ make srcrpm-pkg
> > > UPD include/config/kernel.release
> > > GEN rpmbuild/SPECS/kernel.spec
> > > UPD .tmp_HEAD
> > > ARCHIVE linux.tar.gz
> > > rpmbuild -bs rpmbuild/SPECS/kernel.spec --define='_topdir /mnt/nfs/work/kernel/linux/rpmbuild'
> > > warning: line 34: It's not recommended to have unversioned Obsoletes: Obsoletes: kernel-headers
> > > warning: source_date_epoch_from_changelog set but %changelog is missing
> > > Wrote: /mnt/nfs/work/kernel/linux/rpmbuild/SRPMS/kernel-6.10.0_rc3-1.src.rpm
> > >
> > > RPM build warnings:
> > > line 34: It's not recommended to have unversioned Obsoletes: Obsoletes: kernel-headers
> > > source_date_epoch_from_changelog set but %changelog is missing
> > >
> > > This patch addresses both RPM build warnings.
> > >
> > > Signed-off-by: Rafael Aquini <[email protected]>
> > > ---
> > > scripts/package/kernel.spec | 4 +++-
> > > 1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
> > > index e095eb1e290e..4d58b29c03ad 100644
> > > --- a/scripts/package/kernel.spec
> > > +++ b/scripts/package/kernel.spec
> > > @@ -1,3 +1,5 @@
> > > +%global source_date_epoch_from_changelog 0
> > >
> >
> >
> > Another possibility might be to add %changelog section.
> >
> > In Debian packaging, debian/changelog is a requirement.
> >
> > scripts/package/mkdebian generates a very small
> > debian/changelog with a single log entry.
> >
>
> I'll take a stab at it, then. Thanks for the pointer!



When you send v2, please split it into two patches.

You are addressing two warnings.
These are separate issues.




--
Best Regards
Masahiro Yamada

2024-06-11 21:11:53

by Rafael Aquini

[permalink] [raw]
Subject: [PATCH 0/2] kbuild: rpm-pkg: fix rpmbuild warnings for kernel.spec

Newer revisions of rpmbuild are throwing warnings about the current
kernel.spec template having an unversioned kernel-headers in the
'Obsoletes:' field and not being able to source the epoch's date from
the spec's missing '%changelog' section:

$ make srcrpm-pkg
UPD include/config/kernel.release
GEN rpmbuild/SPECS/kernel.spec
UPD .tmp_HEAD
ARCHIVE linux.tar.gz
rpmbuild -bs rpmbuild/SPECS/kernel.spec --define='_topdir /mnt/nfs/work/kernel/linux/rpmbuild'
warning: line 34: It's not recommended to have unversioned Obsoletes: Obsoletes: kernel-headers
warning: source_date_epoch_from_changelog set but %changelog is missing
Wrote: /mnt/nfs/work/kernel/linux/rpmbuild/SRPMS/kernel-6.10.0_rc3-1.src.rpm

RPM build warnings:
line 34: It's not recommended to have unversioned Obsoletes: Obsoletes: kernel-headers
source_date_epoch_from_changelog set but %changelog is missing

This patchset addresses both RPM build warnings.

Rafael Aquini (2):
kbuild: rpm-pkg: make sure to have versioned 'Obsoletes' for kernel.spec
kbuild: rpm-pkg: introduce a simple changelog section for kernel.spec

scripts/package/kernel.spec | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

--
2.45.1


2024-06-11 21:12:05

by Rafael Aquini

[permalink] [raw]
Subject: [PATCH 1/2] kbuild: rpm-pkg: make sure to have versioned 'Obsoletes' for kernel.spec

Fix the following rpmbuild warning:

$ make srcrpm-pkg
...
RPM build warnings:
line 34: It's not recommended to have unversioned Obsoletes: Obsoletes: kernel-headers

Signed-off-by: Rafael Aquini <[email protected]>
---
scripts/package/kernel.spec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
index e095eb1e290e..19e458341f45 100644
--- a/scripts/package/kernel.spec
+++ b/scripts/package/kernel.spec
@@ -27,7 +27,7 @@ The Linux Kernel, the operating system core itself
%package headers
Summary: Header files for the Linux kernel for use by glibc
Group: Development/System
-Obsoletes: kernel-headers
+Obsoletes: kernel-headers < %{version}
Provides: kernel-headers = %{version}
%description headers
Kernel-headers includes the C header files that specify the interface
--
2.45.1


2024-06-11 21:12:19

by Rafael Aquini

[permalink] [raw]
Subject: [PATCH 2/2] kbuild: rpm-pkg: introduce a simple changelog section for kernel.spec

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 <[email protected]>
---
scripts/package/kernel.spec | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
index 19e458341f45..126b23c1f6c2 100644
--- a/scripts/package/kernel.spec
+++ b/scripts/package/kernel.spec
@@ -132,3 +132,8 @@ fi
/usr/src/kernels/%{KERNELRELEASE}
/lib/modules/%{KERNELRELEASE}/build
%endif
+
+%changelog
+* %(echo "$(LC_ALL=C; date +'%a %b %d %Y') $(git config --get user.name) \
+<$(git config --get user.email)>") - %{version}-%{release}
+- Custom built Linux kernel.
--
2.45.1


2024-06-13 19:02:17

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH 1/2] kbuild: rpm-pkg: make sure to have versioned 'Obsoletes' for kernel.spec

On Tue, Jun 11, 2024 at 05:11:21PM -0400, Rafael Aquini wrote:
> Fix the following rpmbuild warning:
>
> $ make srcrpm-pkg
> ...
> RPM build warnings:
> line 34: It's not recommended to have unversioned Obsoletes: Obsoletes: kernel-headers
>
> Signed-off-by: Rafael Aquini <[email protected]>

Tested-by: Nathan Chancellor <[email protected]>

> ---
> scripts/package/kernel.spec | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
> index e095eb1e290e..19e458341f45 100644
> --- a/scripts/package/kernel.spec
> +++ b/scripts/package/kernel.spec
> @@ -27,7 +27,7 @@ The Linux Kernel, the operating system core itself
> %package headers
> Summary: Header files for the Linux kernel for use by glibc
> Group: Development/System
> -Obsoletes: kernel-headers
> +Obsoletes: kernel-headers < %{version}
> Provides: kernel-headers = %{version}
> %description headers
> Kernel-headers includes the C header files that specify the interface
> --
> 2.45.1
>