diff mbox series

kbuild: rpm-pkg: fix rpmbuild warnings for kernel.spec

Message ID 20240610163856.693110-1-aquini@redhat.com (mailing list archive)
State New
Headers show
Series kbuild: rpm-pkg: fix rpmbuild warnings for kernel.spec | expand

Commit Message

Rafael Aquini June 10, 2024, 4:38 p.m. UTC
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 <aquini@redhat.com>
---
 scripts/package/kernel.spec | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Masahiro Yamada June 11, 2024, 3 p.m. UTC | #1
On Tue, Jun 11, 2024 at 1:39 AM Rafael Aquini <aquini@redhat.com> 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 <aquini@redhat.com>
> ---
>  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
>
Rafael Aquini June 11, 2024, 4:03 p.m. UTC | #2
On Wed, Jun 12, 2024 at 12:00:18AM +0900, Masahiro Yamada wrote:
> On Tue, Jun 11, 2024 at 1:39 AM Rafael Aquini <aquini@redhat.com> 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 <aquini@redhat.com>
> > ---
> >  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
Masahiro Yamada June 11, 2024, 4:33 p.m. UTC | #3
On Wed, Jun 12, 2024 at 1:03 AM Rafael Aquini <aquini@redhat.com> 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 <aquini@redhat.com> 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 <aquini@redhat.com>
> > > ---
> > >  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.
diff mbox series

Patch

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