[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230128173843.765212-4-masahiroy@kernel.org>
Date: Sun, 29 Jan 2023 02:38:43 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: linux-kbuild@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nicolas Schier <nicolas@...sle.eu>,
Masahiro Yamada <masahiroy@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Miguel Ojeda <ojeda@...nel.org>,
Wedson Almeida Filho <wedsonaf@...il.com>,
rust-for-linux@...r.kernel.org
Subject: [PATCH 4/4] kbuild: srcrpm-pkg: create source package without cleaning
If you run 'make (src)rpm-pkg', all objects are lost due to 'make clean',
which makes the incremental builds impossible.
Instead of cleaning, pass the exclude list to tar's --exclude-from
option.
Previously, the .config was contained in the source tarball.
With this commit, the source rpm consists of separate linux.tar.gz
and .config.
Remove stale comments. Now, 'make (src)rpm-pkg' works with O= option.
Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
---
scripts/Makefile.package | 50 +++-------------------------------------
scripts/package/mkspec | 8 +++----
2 files changed, 7 insertions(+), 51 deletions(-)
diff --git a/scripts/Makefile.package b/scripts/Makefile.package
index 8fa6f05967aa..b899fe747bc9 100644
--- a/scripts/Makefile.package
+++ b/scripts/Makefile.package
@@ -3,53 +3,11 @@
include $(srctree)/scripts/Kbuild.include
-# RPM target
-# ---------------------------------------------------------------------------
-# The rpm target generates two rpm files:
-# /usr/src/packages/SRPMS/kernel-2.6.7rc2-1.src.rpm
-# /usr/src/packages/RPMS/i386/kernel-2.6.7rc2-1.<arch>.rpm
-# The src.rpm files includes all source for the kernel being built
-# The <arch>.rpm includes kernel configuration, modules etc.
-#
-# Process to create the rpm files
-# a) clean the kernel
-# b) Generate .spec file
-# c) Build a tar ball, using symlink to make kernel version
-# first entry in the path
-# d) and pack the result to a tar.gz file
-# e) generate the rpm files, based on kernel.spec
-# - Use /. to avoid tar packing just the symlink
-
-# Note that the rpm-pkg target cannot be used with KBUILD_OUTPUT,
-# but the binrpm-pkg target can; for some reason O= gets ignored.
-
-# Remove hyphens since they have special meaning in RPM filenames
-KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
KDEB_SOURCENAME ?= linux-upstream
KBUILD_PKG_ROOTCMD ?="fakeroot -u"
export KDEB_SOURCENAME
-# Include only those top-level files that are needed by make, plus the GPL copy
-TAR_CONTENT := Documentation LICENSES arch block certs crypto drivers fs \
- include init io_uring ipc kernel lib mm net rust \
- samples scripts security sound tools usr virt \
- .config Makefile \
- Kbuild Kconfig COPYING $(wildcard localversion*)
MKSPEC := $(srctree)/scripts/package/mkspec
-quiet_cmd_src_tar = TAR $(2).tar.gz
- cmd_src_tar = \
-if test "$(objtree)" != "$(srctree)"; then \
- echo >&2; \
- echo >&2 " ERROR:"; \
- echo >&2 " Building source tarball is not possible outside the"; \
- echo >&2 " kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
- echo >&2 " binrpm-pkg or bindeb-pkg target instead."; \
- echo >&2; \
- false; \
-fi ; \
-tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \
- --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3)
-
# Source Tarball
# ---------------------------------------------------------------------------
@@ -76,12 +34,10 @@ rpm-pkg: srcrpm-pkg
# srcrpm-pkg
# ---------------------------------------------------------------------------
PHONY += srcrpm-pkg
-srcrpm-pkg:
- $(MAKE) clean
+srcrpm-pkg: linux.tar.gz
$(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)'
+ +rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -bs kernel.spec \
+ --define='_smp_mflags %{nil}' --define='_sourcedir .' --define='_srcrpmdir .'
# binrpm-pkg
# ---------------------------------------------------------------------------
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index 108c0cb95436..83a64d9d7372 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -47,7 +47,8 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
Group: System Environment/Kernel
Vendor: The Linux Community
URL: https://www.kernel.org
-$S Source: kernel-$__KERNELRELEASE.tar.gz
+$S Source0: linux.tar.gz
+$S Source1: .config
Provides: $PROVIDES
$S BuildRequires: bc binutils bison dwarves
$S BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
@@ -83,9 +84,8 @@ $S$M This package provides kernel headers and makefiles sufficient to build modu
$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 %setup -q -n linux
+$S cp %{SOURCE1} .
$S
$S %build
$S $MAKE %{?_smp_mflags} KERNELRELEASE=$KERNELRELEASE KBUILD_BUILD_VERSION=%{release}
--
2.34.1
Powered by blists - more mailing lists