All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] builddeb: make deb building more flexible
@ 2021-05-25 23:01 bage
  2021-05-25 23:01 ` [PATCH v2 1/5] builddeb: ignore or export files for clean pkg build bage
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: bage @ 2021-05-25 23:01 UTC (permalink / raw)
  To: Masahiro Yamada, Michal Marek; +Cc: Bastian Germann, linux-kbuild, tglx

From: Bastian Germann <bage@linutronix.de>

Building Debian packages via the [bin]deb-pkg make targets has some
shortcomings. These targets do not allow for packing a Debian source
package independently from actually building the binary package.

This series improves that process by making it possible to rebuild
the packages without errors via dpkg-buildpackage, by separating
source package creation from binary package building, and by making
the dbg package build optional.

Changelog v2:
  * Drop "use standard format for copyright file" (equivalent available)
  * Enable parallel builds (via ordered make target dependencies)
  * Include previously excluded top-level files in tarball
  * Other minor suggestions by Masahiro

Bastian Germann (5):
  builddeb: ignore or export files for clean pkg build
  builddeb: set CC on cross build to prefixed gcc
  builddeb: clean generated package content
  builddeb: introduce profile excluding the dbg pkg
  kbuild: introduce srcdeb-pkg target

 scripts/Makefile.package | 11 +++++++++--
 scripts/package/mkdebian | 13 ++++++++++++-
 2 files changed, 21 insertions(+), 3 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/5] builddeb: ignore or export files for clean pkg build
  2021-05-25 23:01 [PATCH v2 0/5] builddeb: make deb building more flexible bage
@ 2021-05-25 23:01 ` bage
  2021-05-25 23:01 ` [PATCH v2 2/5] builddeb: set CC on cross build to prefixed gcc bage
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bage @ 2021-05-25 23:01 UTC (permalink / raw)
  To: Masahiro Yamada, Michal Marek; +Cc: Bastian Germann, linux-kbuild, tglx

From: Bastian Germann <bage@linutronix.de>

scripts/Makefile.package's TAR_CONTENT lists the files to include in orig
tarballs while the deb-pkg make target only ignores .git. This results in
the other top-level files ending up in the .diff.gz.

Extend the TAR_CONTENT with the git-controlled top-level files.

Let dpkg-source ignore .git with the default diff-ignore and list
dynamically generated files that are not cleaned in extend-diff-ignore.
Use the debian/source/options in order to have those always available on
building the package.

Signed-off-by: Bastian Germann <bage@linutronix.de>
---
 scripts/Makefile.package | 5 +++--
 scripts/package/mkdebian | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/Makefile.package b/scripts/Makefile.package
index b74c65284fb2..360ce0ae2fa1 100644
--- a/scripts/Makefile.package
+++ b/scripts/Makefile.package
@@ -28,8 +28,9 @@ 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 := $(KBUILD_ALLDIRS) .config .scmversion Makefile \
+               .clang-format .cocciconfig .get_maintainer.ignore \
+               .gitignore .mailmap CREDITS MAINTAINERS README \
                Kbuild Kconfig COPYING $(wildcard localversion*)
 MKSPEC     := $(srctree)/scripts/package/mkspec
 
@@ -75,7 +76,7 @@ deb-pkg:
 	$(call cmd,src_tar,$(KDEB_SOURCENAME))
 	origversion=$$(dpkg-parsechangelog -SVersion |sed 's/-[^-]*$$//');\
 		mv $(KDEB_SOURCENAME).tar.gz ../$(KDEB_SOURCENAME)_$${origversion}.orig.tar.gz
-	+dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -i.git -us -uc
+	+dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -us -uc
 
 PHONY += bindeb-pkg
 bindeb-pkg:
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index 60a2a63a5e90..b317d26e2bbf 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -134,6 +134,8 @@ fi
 
 mkdir -p debian/source/
 echo "1.0" > debian/source/format
+echo diff-ignore > debian/source/options
+echo 'extend-diff-ignore = ".config.old|.version|.*include/generated.*|scripts/mod/.*"' >> debian/source/options
 
 echo $debarch > debian/arch
 extra_build_depends=", $(if_enabled_echo CONFIG_UNWINDER_ORC libelf-dev:native)"
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/5] builddeb: set CC on cross build to prefixed gcc
  2021-05-25 23:01 [PATCH v2 0/5] builddeb: make deb building more flexible bage
  2021-05-25 23:01 ` [PATCH v2 1/5] builddeb: ignore or export files for clean pkg build bage
@ 2021-05-25 23:01 ` bage
  2021-05-25 23:01 ` [PATCH v2 3/5] builddeb: clean generated package content bage
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bage @ 2021-05-25 23:01 UTC (permalink / raw)
  To: Masahiro Yamada, Michal Marek; +Cc: Bastian Germann, linux-kbuild, tglx

From: Bastian Germann <bage@linutronix.de>

Building the generated package with CC unset will fail for cross
compilation. Detect that and set CC to a sane default prefixed by
dpkg-architecture's DEB_HOST_GNU_TYPE variable.

Signed-off-by: Bastian Germann <bage@linutronix.de>
---
 scripts/package/mkdebian | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index b317d26e2bbf..449e284a449c 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -223,6 +223,14 @@ fi
 cat <<EOF > debian/rules
 #!$(command -v $MAKE) -f
 
+include /usr/share/dpkg/architecture.mk
+
+ifneq (\$(DEB_BUILD_GNU_TYPE),\$(DEB_HOST_GNU_TYPE))
+ifeq (\$(origin CC),default)
+CC := \$(DEB_HOST_GNU_TYPE)-gcc
+endif
+endif
+
 srctree ?= .
 
 build-indep:
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/5] builddeb: clean generated package content
  2021-05-25 23:01 [PATCH v2 0/5] builddeb: make deb building more flexible bage
  2021-05-25 23:01 ` [PATCH v2 1/5] builddeb: ignore or export files for clean pkg build bage
  2021-05-25 23:01 ` [PATCH v2 2/5] builddeb: set CC on cross build to prefixed gcc bage
@ 2021-05-25 23:01 ` bage
  2021-05-25 23:01 ` [PATCH v2 4/5] builddeb: introduce profile excluding the dbg pkg bage
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bage @ 2021-05-25 23:01 UTC (permalink / raw)
  To: Masahiro Yamada, Michal Marek; +Cc: Bastian Germann, linux-kbuild, tglx

From: Bastian Germann <bage@linutronix.de>

For each binary Debian package, a directory with the package name is
created in the debian directory. Correct the generated file matches in the
package's clean target, which were renamed without adjusting the target.

Fixes: 1694e94e4f46 ("builddeb: match temporary directory name to the package name")
Signed-off-by: Bastian Germann <bage@linutronix.de>
---
 scripts/package/mkdebian | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index 449e284a449c..9470581d8c75 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -246,7 +246,7 @@ binary-arch: build-arch
 	KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile intdeb-pkg
 
 clean:
-	rm -rf debian/*tmp debian/files
+	rm -rf debian/files debian/linux-*
 	\$(MAKE) clean
 
 binary: binary-arch
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 4/5] builddeb: introduce profile excluding the dbg pkg
  2021-05-25 23:01 [PATCH v2 0/5] builddeb: make deb building more flexible bage
                   ` (2 preceding siblings ...)
  2021-05-25 23:01 ` [PATCH v2 3/5] builddeb: clean generated package content bage
@ 2021-05-25 23:01 ` bage
  2021-05-25 23:01 ` [PATCH v2 5/5] kbuild: introduce srcdeb-pkg target bage
  2021-06-28 18:46 ` [PATCH v2 0/5] builddeb: make deb building more flexible Bastian Germann
  5 siblings, 0 replies; 7+ messages in thread
From: bage @ 2021-05-25 23:01 UTC (permalink / raw)
  To: Masahiro Yamada, Michal Marek; +Cc: Bastian Germann, linux-kbuild, tglx

From: Bastian Germann <bage@linutronix.de>

Enabling CONFIG_DEBUG_INFO implies building the binary linux-image-*-dbg.
As this increases package build time significantly, one might want to
exclude it from being built.

Add a pkg.$sourcename.nodbg build profile for that package so it can be
excluded via e.g.: `make DPKG_FLAGS="-P=pkg.linux-upstream.nodbg" deb-pkg`

Link: https://wiki.debian.org/BuildProfileSpec
Signed-off-by: Bastian Germann <bage@linutronix.de>
---
 scripts/package/mkdebian | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index 9470581d8c75..2e95966fe4dd 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -212,6 +212,7 @@ if is_enabled CONFIG_DEBUG_INFO; then
 cat <<EOF >> debian/control
 
 Package: linux-image-$version-dbg
+Build-Profiles: <!pkg.$sourcename.nodbg>
 Section: debug
 Architecture: $debarch
 Description: Linux kernel debugging symbols for $version
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 5/5] kbuild: introduce srcdeb-pkg target
  2021-05-25 23:01 [PATCH v2 0/5] builddeb: make deb building more flexible bage
                   ` (3 preceding siblings ...)
  2021-05-25 23:01 ` [PATCH v2 4/5] builddeb: introduce profile excluding the dbg pkg bage
@ 2021-05-25 23:01 ` bage
  2021-06-28 18:46 ` [PATCH v2 0/5] builddeb: make deb building more flexible Bastian Germann
  5 siblings, 0 replies; 7+ messages in thread
From: bage @ 2021-05-25 23:01 UTC (permalink / raw)
  To: Masahiro Yamada, Michal Marek; +Cc: Bastian Germann, linux-kbuild, tglx

From: Bastian Germann <bage@linutronix.de>

A Debian source package can be generated only in combination with building
it afterwards. Introduce a target srcdeb-pkg that generates the source
package without building it (adding dpkg-buildpackage's -S flag).

Make the former deb-pkg run both srcdeb-pkg and bindeb-pkg to retain its
behavior.

Signed-off-by: Bastian Germann <bage@linutronix.de>
---
 scripts/Makefile.package | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/scripts/Makefile.package b/scripts/Makefile.package
index 360ce0ae2fa1..dd347355c95e 100644
--- a/scripts/Makefile.package
+++ b/scripts/Makefile.package
@@ -71,12 +71,17 @@ binrpm-pkg:
 
 PHONY += deb-pkg
 deb-pkg:
+	$(MAKE) srcdeb-pkg
+	$(MAKE) bindeb-pkg
+
+PHONY += srcdeb-pkg
+srcdeb-pkg:
 	$(MAKE) clean
 	$(CONFIG_SHELL) $(srctree)/scripts/package/mkdebian
 	$(call cmd,src_tar,$(KDEB_SOURCENAME))
 	origversion=$$(dpkg-parsechangelog -SVersion |sed 's/-[^-]*$$//');\
 		mv $(KDEB_SOURCENAME).tar.gz ../$(KDEB_SOURCENAME)_$${origversion}.orig.tar.gz
-	+dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -us -uc
+	+dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -S -us -uc
 
 PHONY += bindeb-pkg
 bindeb-pkg:
@@ -146,6 +151,7 @@ help:
 	@echo '  rpm-pkg             - Build both source and binary RPM kernel packages'
 	@echo '  binrpm-pkg          - Build only the binary kernel RPM package'
 	@echo '  deb-pkg             - Build both source and binary deb kernel packages'
+	@echo '  srcdeb-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.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/5] builddeb: make deb building more flexible
  2021-05-25 23:01 [PATCH v2 0/5] builddeb: make deb building more flexible bage
                   ` (4 preceding siblings ...)
  2021-05-25 23:01 ` [PATCH v2 5/5] kbuild: introduce srcdeb-pkg target bage
@ 2021-06-28 18:46 ` Bastian Germann
  5 siblings, 0 replies; 7+ messages in thread
From: Bastian Germann @ 2021-06-28 18:46 UTC (permalink / raw)
  To: Masahiro Yamada, Michal Marek; +Cc: linux-kbuild

Am 26.05.21 um 01:01 schrieb bage@linutronix.de:
> From: Bastian Germann <bage@linutronix.de>
> 
> Building Debian packages via the [bin]deb-pkg make targets has some
> shortcomings. These targets do not allow for packing a Debian source
> package independently from actually building the binary package.
> 
> This series improves that process by making it possible to rebuild
> the packages without errors via dpkg-buildpackage, by separating
> source package creation from binary package building, and by making
> the dbg package build optional.
> 
> Changelog v2:
>    * Drop "use standard format for copyright file" (equivalent available)
>    * Enable parallel builds (via ordered make target dependencies)
>    * Include previously excluded top-level files in tarball
>    * Other minor suggestions by Masahiro
> 
> Bastian Germann (5):
>    builddeb: ignore or export files for clean pkg build
>    builddeb: set CC on cross build to prefixed gcc
>    builddeb: clean generated package content
>    builddeb: introduce profile excluding the dbg pkg
>    kbuild: introduce srcdeb-pkg target
> 
>   scripts/Makefile.package | 11 +++++++++--
>   scripts/package/mkdebian | 13 ++++++++++++-
>   2 files changed, 21 insertions(+), 3 deletions(-)

Gentle ping after a month without reply.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-06-28 18:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 23:01 [PATCH v2 0/5] builddeb: make deb building more flexible bage
2021-05-25 23:01 ` [PATCH v2 1/5] builddeb: ignore or export files for clean pkg build bage
2021-05-25 23:01 ` [PATCH v2 2/5] builddeb: set CC on cross build to prefixed gcc bage
2021-05-25 23:01 ` [PATCH v2 3/5] builddeb: clean generated package content bage
2021-05-25 23:01 ` [PATCH v2 4/5] builddeb: introduce profile excluding the dbg pkg bage
2021-05-25 23:01 ` [PATCH v2 5/5] kbuild: introduce srcdeb-pkg target bage
2021-06-28 18:46 ` [PATCH v2 0/5] builddeb: make deb building more flexible Bastian Germann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.