diff mbox series

[v5,3/7] kbuild: rpm-pkg: build binary packages from source rpm

Message ID 20230210181828.124765-3-masahiroy@kernel.org (mailing list archive)
State New, archived
Headers show
Series [v5,1/7] kbuild: add a tool to list files ignored by git | expand

Commit Message

Masahiro Yamada Feb. 10, 2023, 6:18 p.m. UTC
The build rules of rpm-pkg and srcrpm-pkg are almost the same.
Remove the code duplication.

Change rpm-pkg to build binary packages from the source package generated
by srcrpm-pkg.

This changes the output directory of the srpm generated by 'make rpm-pkg'
because srcrpm-pkg overrides _srcrpmdir.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

(no changes since v3)

Changes in v3:
  - Explain that the source package location will be changed.

 scripts/Makefile.package | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/scripts/Makefile.package b/scripts/Makefile.package
index 0dda909f87a9..0b66bd667212 100644
--- a/scripts/Makefile.package
+++ b/scripts/Makefile.package
@@ -53,11 +53,9 @@  tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \
 # rpm-pkg
 # ---------------------------------------------------------------------------
 PHONY += rpm-pkg
-rpm-pkg:
-	$(MAKE) clean
-	$(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
-	$(call cmd,src_tar,$(KERNELPATH),kernel.spec)
-	+rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -ta $(KERNELPATH).tar.gz \
+rpm-pkg: srpm = $(shell rpmspec --srpm --query --queryformat='%{name}-%{VERSION}-%{RELEASE}.src.rpm' kernel.spec)
+rpm-pkg: srcrpm-pkg
+	+rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -rb $(srpm) \
 	--define='_smp_mflags %{nil}'
 
 # srcrpm-pkg