[PATCH v6 12/12] kbuild: add srcdeb-pkg target

From: Masahiro Yamada
Date: Tue Feb 14 2023 - 20:22:57 EST


This new target builds only the debian source package.

Factor similar code out to the 'build-deb-pkg' variable.

Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
---

Changes in v6:
- New patch

scripts/Makefile.package | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/scripts/Makefile.package b/scripts/Makefile.package
index b941e6341b36..8650d9432c26 100644
--- a/scripts/Makefile.package
+++ b/scripts/Makefile.package
@@ -100,6 +100,9 @@ binrpm-pkg:
+rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \
$(UTS_MACHINE)-linux -bb $(objtree)/binkernel.spec

+# deb-pkg srcdeb-pkg bindeb-pkg
+# ---------------------------------------------------------------------------
+
quiet_cmd_debianize = GEN $@
cmd_debianize = $(srctree)/scripts/package/mkdebian

@@ -117,14 +120,27 @@ debian-orig: linux.tar.gz debian
cp $< ../$(orig-name); \
fi

+build-deb-pkg = \
+ dpkg-buildpackage \
+ --build=$(build-type) --no-pre-clean --unsigned-changes \
+ $(if $(findstring source, $(build-type)), --unsigned-source) \
+ $(if $(findstring binary, $(build-type)), -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch)) \
+ $(DPKG_FLAGS)
+
PHONY += deb-pkg
+deb-pkg: private build-type := source,binary
deb-pkg: debian-orig
- +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) \
- --build=source,binary -nc -us -uc
+ +$(build-deb-pkg)
+
+PHONY += srcdeb-pkg
+srcdeb-pkg: private build-type := source
+srcdeb-pkg: debian-orig
+ +$(build-deb-pkg)

PHONY += bindeb-pkg
+bindeb-pkg: private build-type := binary
bindeb-pkg: debian
- +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -b -nc -uc
+ +$(build-deb-pkg)

PHONY += intdeb-pkg
intdeb-pkg:
@@ -225,6 +241,7 @@ help:
@echo ' srcrpm-pkg - Build only the source kernel RPM package'
@echo ' binrpm-pkg - Build only the binary kernel RPM package'
@echo ' deb-pkg - Build both source and binary deb kernel packages'
+ @echo ' binsrc-pkg - Build only the source kernel deb package'
@echo ' bindeb-pkg - Build only the binary kernel deb package'
@echo ' snap-pkg - Build only the binary kernel snap package'
@echo ' (will connect to external hosts)'
--
2.34.1