2022-11-21 15:15:47

by Jonathan Toppins

[permalink] [raw]
Subject: [PATCH next v2] kbuild: add ability to make source rpm buildable using koji

From: Ivan Vecera <[email protected]>

Changes:
- added new target 'srcrpm-pkg' to generate source rpm
- added required build tools to spec file
- removed locally compiled host tools to force their re-compile

Signed-off-by: Ivan Vecera <[email protected]>
Signed-off-by: Jonathan Toppins <[email protected]>
Acked-by: Íñigo Huguet <[email protected]>
Tested-by: Ivan Vecera <[email protected]>
---

Notes:
v2:
* updated UTS_MACHINE to be $(UTS_MACHINE)-linux
suggested by Masahiro Yamada

scripts/Makefile.package | 10 ++++++++++
scripts/package/mkspec | 7 +++++++
2 files changed, 17 insertions(+)

diff --git a/scripts/Makefile.package b/scripts/Makefile.package
index 8bbcced67c22..1290f1c631fb 100644
--- a/scripts/Makefile.package
+++ b/scripts/Makefile.package
@@ -62,6 +62,16 @@ rpm-pkg:
+rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -ta $(KERNELPATH).tar.gz \
--define='_smp_mflags %{nil}'

+# srcrpm-pkg
+# ---------------------------------------------------------------------------
+PHONY += srcrpm-pkg
+srcrpm-pkg:
+ $(MAKE) clean
+ $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
+ $(call cmd,src_tar,$(KERNELPATH),kernel.spec)
+ +rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -ts $(KERNELPATH).tar.gz \
+ --define='_smp_mflags %{nil}' --define='_srcrpmdir $(srctree)'
+
# binrpm-pkg
# ---------------------------------------------------------------------------
PHONY += binrpm-pkg
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index 70392fd2fd29..dda00a948a01 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -33,6 +33,8 @@ EXCLUDES="$RCS_TAR_IGNORE --exclude=*vmlinux* --exclude=*.mod \
--exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \
--exclude=.config.old --exclude=.missing-syscalls.d --exclude=*.s"

+test -n "$LOCALVERSION" && MAKE="$MAKE LOCALVERSION=$LOCALVERSION"
+
# We can label the here-doc lines for conditional output to the spec file
#
# Labels:
@@ -49,6 +51,9 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
URL: https://www.kernel.org
$S Source: kernel-$__KERNELRELEASE.tar.gz
Provides: $PROVIDES
+$S BuildRequires: bc binutils bison dwarves elfutils-libelf-devel flex
+$S BuildRequires: gcc make openssl openssl-devel perl python3 rsync
+
# $UTS_MACHINE as a fallback of _arch in case
# /usr/lib/rpm/platform/*/macros was not included.
%define _arch %{?_arch:$UTS_MACHINE}
@@ -80,6 +85,8 @@ $S$M against the $__KERNELRELEASE kernel package.
$S$M
$S %prep
$S %setup -q
+$S rm -f scripts/basic/fixdep scripts/kconfig/conf
+$S rm -f tools/objtool/{fixdep,objtool}
$S
$S %build
$S $MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}
--
2.31.1



2022-12-06 05:50:59

by Jonathan Toppins

[permalink] [raw]
Subject: Re: [PATCH next v2] kbuild: add ability to make source rpm buildable using koji

On 11/21/22 09:48, Jonathan Toppins wrote:
> From: Ivan Vecera <[email protected]>
>
> Changes:
> - added new target 'srcrpm-pkg' to generate source rpm
> - added required build tools to spec file
> - removed locally compiled host tools to force their re-compile
>
> Signed-off-by: Ivan Vecera <[email protected]>
> Signed-off-by: Jonathan Toppins <[email protected]>
> Acked-by: Íñigo Huguet <[email protected]>
> Tested-by: Ivan Vecera <[email protected]>
> ---
>
> Notes:
> v2:
> * updated UTS_MACHINE to be $(UTS_MACHINE)-linux
> suggested by Masahiro Yamada

Quick ping, wanted to make sure I didn't miss any requests. Looking at
patchwork there appear to be no replies to this version. Would it be
reasonable to assume this version will be accepted and make it into the
next kernel?

>
> scripts/Makefile.package | 10 ++++++++++
> scripts/package/mkspec | 7 +++++++
> 2 files changed, 17 insertions(+)
>
> diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> index 8bbcced67c22..1290f1c631fb 100644
> --- a/scripts/Makefile.package
> +++ b/scripts/Makefile.package
> @@ -62,6 +62,16 @@ rpm-pkg:
> +rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -ta $(KERNELPATH).tar.gz \
> --define='_smp_mflags %{nil}'
>
> +# srcrpm-pkg
> +# ---------------------------------------------------------------------------
> +PHONY += srcrpm-pkg
> +srcrpm-pkg:
> + $(MAKE) clean
> + $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
> + $(call cmd,src_tar,$(KERNELPATH),kernel.spec)
> + +rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -ts $(KERNELPATH).tar.gz \
> + --define='_smp_mflags %{nil}' --define='_srcrpmdir $(srctree)'
> +
> # binrpm-pkg
> # ---------------------------------------------------------------------------
> PHONY += binrpm-pkg
> diff --git a/scripts/package/mkspec b/scripts/package/mkspec
> index 70392fd2fd29..dda00a948a01 100755
> --- a/scripts/package/mkspec
> +++ b/scripts/package/mkspec
> @@ -33,6 +33,8 @@ EXCLUDES="$RCS_TAR_IGNORE --exclude=*vmlinux* --exclude=*.mod \
> --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \
> --exclude=.config.old --exclude=.missing-syscalls.d --exclude=*.s"
>
> +test -n "$LOCALVERSION" && MAKE="$MAKE LOCALVERSION=$LOCALVERSION"
> +
> # We can label the here-doc lines for conditional output to the spec file
> #
> # Labels:
> @@ -49,6 +51,9 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
> URL: https://www.kernel.org
> $S Source: kernel-$__KERNELRELEASE.tar.gz
> Provides: $PROVIDES
> +$S BuildRequires: bc binutils bison dwarves elfutils-libelf-devel flex
> +$S BuildRequires: gcc make openssl openssl-devel perl python3 rsync
> +
> # $UTS_MACHINE as a fallback of _arch in case
> # /usr/lib/rpm/platform/*/macros was not included.
> %define _arch %{?_arch:$UTS_MACHINE}
> @@ -80,6 +85,8 @@ $S$M against the $__KERNELRELEASE kernel package.
> $S$M
> $S %prep
> $S %setup -q
> +$S rm -f scripts/basic/fixdep scripts/kconfig/conf
> +$S rm -f tools/objtool/{fixdep,objtool}
> $S
> $S %build
> $S $MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}

2022-12-06 06:02:18

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH next v2] kbuild: add ability to make source rpm buildable using koji

Hi,

On 12/5/22 21:37, Jonathan Toppins wrote:
> On 11/21/22 09:48, Jonathan Toppins wrote:
>> From: Ivan Vecera <[email protected]>
>>
>> Changes:
>> - added new target 'srcrpm-pkg' to generate source rpm
>> - added required build tools to spec file
>> - removed locally compiled host tools to force their re-compile
>>
>> Signed-off-by: Ivan Vecera <[email protected]>
>> Signed-off-by: Jonathan Toppins <[email protected]>
>> Acked-by: Íñigo Huguet <[email protected]>
>> Tested-by: Ivan Vecera <[email protected]>
>> ---
>>
>> Notes:
>>      v2:
>>       * updated UTS_MACHINE to be $(UTS_MACHINE)-linux
>>         suggested by Masahiro Yamada
>
> Quick ping, wanted to make sure I didn't miss any requests. Looking at patchwork there appear to be no replies to this version. Would it be reasonable to assume this version will be accepted and make it into the next kernel?

I have a request:
Tell us what "koji" is. I'm surprised that that word is not in the
patch description at all.

Thanks.

>>
>>   scripts/Makefile.package | 10 ++++++++++
>>   scripts/package/mkspec   |  7 +++++++
>>   2 files changed, 17 insertions(+)
>>
>> diff --git a/scripts/Makefile.package b/scripts/Makefile.package
>> index 8bbcced67c22..1290f1c631fb 100644
>> --- a/scripts/Makefile.package
>> +++ b/scripts/Makefile.package
>> @@ -62,6 +62,16 @@ rpm-pkg:
>>       +rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -ta $(KERNELPATH).tar.gz \
>>       --define='_smp_mflags %{nil}'
>>   +# srcrpm-pkg
>> +# ---------------------------------------------------------------------------
>> +PHONY += srcrpm-pkg
>> +srcrpm-pkg:
>> +    $(MAKE) clean
>> +    $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
>> +    $(call cmd,src_tar,$(KERNELPATH),kernel.spec)
>> +    +rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -ts $(KERNELPATH).tar.gz \
>> +    --define='_smp_mflags %{nil}' --define='_srcrpmdir $(srctree)'
>> +
>>   # binrpm-pkg
>>   # ---------------------------------------------------------------------------
>>   PHONY += binrpm-pkg
>> diff --git a/scripts/package/mkspec b/scripts/package/mkspec
>> index 70392fd2fd29..dda00a948a01 100755
>> --- a/scripts/package/mkspec
>> +++ b/scripts/package/mkspec
>> @@ -33,6 +33,8 @@ EXCLUDES="$RCS_TAR_IGNORE --exclude=*vmlinux* --exclude=*.mod \
>>   --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \
>>   --exclude=.config.old --exclude=.missing-syscalls.d --exclude=*.s"
>>   +test -n "$LOCALVERSION" && MAKE="$MAKE LOCALVERSION=$LOCALVERSION"
>> +
>>   # We can label the here-doc lines for conditional output to the spec file
>>   #
>>   # Labels:
>> @@ -49,6 +51,9 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
>>       URL: https://www.kernel.org
>>   $S    Source: kernel-$__KERNELRELEASE.tar.gz
>>       Provides: $PROVIDES
>> +$S    BuildRequires: bc binutils bison dwarves elfutils-libelf-devel flex
>> +$S    BuildRequires: gcc make openssl openssl-devel perl python3 rsync
>> +
>>       # $UTS_MACHINE as a fallback of _arch in case
>>       # /usr/lib/rpm/platform/*/macros was not included.
>>       %define _arch %{?_arch:$UTS_MACHINE}
>> @@ -80,6 +85,8 @@ $S$M    against the $__KERNELRELEASE kernel package.
>>   $S$M
>>   $S    %prep
>>   $S    %setup -q
>> +$S    rm -f scripts/basic/fixdep scripts/kconfig/conf
>> +$S    rm -f tools/objtool/{fixdep,objtool}
>>   $S
>>   $S    %build
>>   $S    $MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}
>

--
~Randy

2022-12-06 07:36:02

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH next v2] kbuild: add ability to make source rpm buildable using koji

On Tue, Dec 6, 2022 at 2:44 PM Randy Dunlap <[email protected]> wrote:
>
> Hi,
>
> On 12/5/22 21:37, Jonathan Toppins wrote:
> > On 11/21/22 09:48, Jonathan Toppins wrote:
> >> From: Ivan Vecera <[email protected]>
> >>
> >> Changes:
> >> - added new target 'srcrpm-pkg' to generate source rpm
> >> - added required build tools to spec file
> >> - removed locally compiled host tools to force their re-compile
> >>
> >> Signed-off-by: Ivan Vecera <[email protected]>
> >> Signed-off-by: Jonathan Toppins <[email protected]>
> >> Acked-by: Íñigo Huguet <[email protected]>
> >> Tested-by: Ivan Vecera <[email protected]>
> >> ---
> >>
> >> Notes:
> >> v2:
> >> * updated UTS_MACHINE to be $(UTS_MACHINE)-linux
> >> suggested by Masahiro Yamada
> >
> > Quick ping, wanted to make sure I didn't miss any requests. Looking at patchwork there appear to be no replies to this version. Would it be reasonable to assume this version will be accepted and make it into the next kernel?
>
> I have a request:
> Tell us what "koji" is. I'm surprised that that word is not in the
> patch description at all.
>
> Thanks.




I applied this patch, but somehow I replied to v1
https://lore.kernel.org/linux-kbuild/CAK7LNATPZkMCabD5aGNamp-gH3aZvFPr2_Yq=N=rM_ht2i3p6g@mail.gmail.com/



I have never used it, but I guess koji is a build engine
that generates binary packages from a source package.

That's why they want to create only a source package.


This patch is not related to koji
(and I suggested them to drop it from the subject)

I just tested it by using 'rpmbuild' on my local machine.












> >>
> >> scripts/Makefile.package | 10 ++++++++++
> >> scripts/package/mkspec | 7 +++++++
> >> 2 files changed, 17 insertions(+)
> >>
> >> diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> >> index 8bbcced67c22..1290f1c631fb 100644
> >> --- a/scripts/Makefile.package
> >> +++ b/scripts/Makefile.package
> >> @@ -62,6 +62,16 @@ rpm-pkg:
> >> +rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -ta $(KERNELPATH).tar.gz \
> >> --define='_smp_mflags %{nil}'
> >> +# srcrpm-pkg
> >> +# ---------------------------------------------------------------------------
> >> +PHONY += srcrpm-pkg
> >> +srcrpm-pkg:
> >> + $(MAKE) clean
> >> + $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
> >> + $(call cmd,src_tar,$(KERNELPATH),kernel.spec)
> >> + +rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -ts $(KERNELPATH).tar.gz \
> >> + --define='_smp_mflags %{nil}' --define='_srcrpmdir $(srctree)'
> >> +
> >> # binrpm-pkg
> >> # ---------------------------------------------------------------------------
> >> PHONY += binrpm-pkg
> >> diff --git a/scripts/package/mkspec b/scripts/package/mkspec
> >> index 70392fd2fd29..dda00a948a01 100755
> >> --- a/scripts/package/mkspec
> >> +++ b/scripts/package/mkspec
> >> @@ -33,6 +33,8 @@ EXCLUDES="$RCS_TAR_IGNORE --exclude=*vmlinux* --exclude=*.mod \
> >> --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \
> >> --exclude=.config.old --exclude=.missing-syscalls.d --exclude=*.s"
> >> +test -n "$LOCALVERSION" && MAKE="$MAKE LOCALVERSION=$LOCALVERSION"
> >> +
> >> # We can label the here-doc lines for conditional output to the spec file
> >> #
> >> # Labels:
> >> @@ -49,6 +51,9 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
> >> URL: https://www.kernel.org
> >> $S Source: kernel-$__KERNELRELEASE.tar.gz
> >> Provides: $PROVIDES
> >> +$S BuildRequires: bc binutils bison dwarves elfutils-libelf-devel flex
> >> +$S BuildRequires: gcc make openssl openssl-devel perl python3 rsync
> >> +
> >> # $UTS_MACHINE as a fallback of _arch in case
> >> # /usr/lib/rpm/platform/*/macros was not included.
> >> %define _arch %{?_arch:$UTS_MACHINE}
> >> @@ -80,6 +85,8 @@ $S$M against the $__KERNELRELEASE kernel package.
> >> $S$M
> >> $S %prep
> >> $S %setup -q
> >> +$S rm -f scripts/basic/fixdep scripts/kconfig/conf
> >> +$S rm -f tools/objtool/{fixdep,objtool}
> >> $S
> >> $S %build
> >> $S $MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}
> >
>
> --
> ~Randy



--
Best Regards
Masahiro Yamada

2022-12-26 14:22:57

by Alexander Gordeev

[permalink] [raw]
Subject: Re: [PATCH next v2] kbuild: add ability to make source rpm buildable using koji

On Mon, Nov 21, 2022 at 09:48:45AM -0500, Jonathan Toppins wrote:

Hi Jonathan, Ivan et al,

This patch causes a regression on 6.2-rc1 when rpm-pkg target
is specified on non-rpm system (i.e s390 running Ubuntu). The
offending chunk is:

> @@ -49,6 +51,9 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
> URL: https://www.kernel.org
> $S Source: kernel-$__KERNELRELEASE.tar.gz
> Provides: $PROVIDES
> +$S BuildRequires: bc binutils bison dwarves elfutils-libelf-devel flex
> +$S BuildRequires: gcc make openssl openssl-devel perl python3 rsync
> +
> # $UTS_MACHINE as a fallback of _arch in case
> # /usr/lib/rpm/platform/*/macros was not included.
> %define _arch %{?_arch:$UTS_MACHINE}

2022-12-29 05:02:25

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH next v2] kbuild: add ability to make source rpm buildable using koji

On Mon, Dec 26, 2022 at 10:41 PM Alexander Gordeev
<[email protected]> wrote:
>
> On Mon, Nov 21, 2022 at 09:48:45AM -0500, Jonathan Toppins wrote:
>
> Hi Jonathan, Ivan et al,
>
> This patch causes a regression on 6.2-rc1 when rpm-pkg target
> is specified on non-rpm system (i.e s390 running Ubuntu). The
> offending chunk is:
>
> > @@ -49,6 +51,9 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
> > URL: https://www.kernel.org
> > $S Source: kernel-$__KERNELRELEASE.tar.gz
> > Provides: $PROVIDES
> > +$S BuildRequires: bc binutils bison dwarves elfutils-libelf-devel flex
> > +$S BuildRequires: gcc make openssl openssl-devel perl python3 rsync
> > +
> > # $UTS_MACHINE as a fallback of _arch in case
> > # /usr/lib/rpm/platform/*/macros was not included.
> > %define _arch %{?_arch:$UTS_MACHINE}



$ make RPMOPTS=--nodeps rpm-pkg

works for me.


FWIW:
https://lore.kernel.org/lkml/[email protected]/




--
Best Regards
Masahiro Yamada