mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 13:22:23 +00:00
kbuild: deb-pkg: create source package without cleaning
If you run 'make deb-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, *.diff.gz contained some check-in files such as .clang-format, .cocciconfig. With this commit, *.diff.gz will only contain the .config and debian/. The other source files will go into the .orig tarball. linux.tar.gz is rebuilt only when the source files that would go into the tarball are changed. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
This commit is contained in:
parent
5c3d1d0abb
commit
7bf4582d7a
@ -43,13 +43,47 @@ if test "$(objtree)" != "$(srctree)"; then \
|
||||
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 " binrpm-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)
|
||||
|
||||
# .tmp_filelist .tmp_filelist_exclude
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
scripts/list-gitignored: FORCE
|
||||
$(Q)$(MAKE) -f $(srctree)/Makefile scripts_package
|
||||
|
||||
# 1f5d3a6b6532e25a5cdf1f311956b2b03d343a48 removed '*.rej' from .gitignore,
|
||||
# but it is definitely a generated file.
|
||||
filechk_filelist = \
|
||||
$< --exclude='*.rej' --output=$@_exclude --prefix=./ --rootdir=$(srctree) --stat=-
|
||||
|
||||
.tmp_filelist: scripts/list-gitignored FORCE
|
||||
$(call filechk,filelist)
|
||||
|
||||
# tarball
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
quiet_cmd_tar = TAR $@
|
||||
cmd_tar = tar -c -f $@ $(tar-compress-opt) $(tar-exclude-opt) \
|
||||
--owner=0 --group=0 --sort=name \
|
||||
--transform 's:^\.:$*:S' -C $(tar-rootdir) .
|
||||
|
||||
tar-rootdir := $(srctree)
|
||||
|
||||
%.tar.gz: private tar-compress-opt := -I $(KGZIP)
|
||||
%.tar.gz:
|
||||
$(call cmd,tar)
|
||||
|
||||
# Linux source tarball
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
linux.tar.gz: tar-exclude-opt = --exclude=./$@ --exclude-from=$<_exclude
|
||||
linux.tar.gz: .tmp_filelist
|
||||
|
||||
# rpm-pkg
|
||||
# ---------------------------------------------------------------------------
|
||||
PHONY += rpm-pkg
|
||||
@ -80,13 +114,12 @@ binrpm-pkg:
|
||||
$(UTS_MACHINE)-linux -bb $(objtree)/binkernel.spec
|
||||
|
||||
PHONY += deb-pkg
|
||||
deb-pkg:
|
||||
$(MAKE) clean
|
||||
deb-pkg: linux.tar.gz
|
||||
$(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) --source-option=-sP -i.git -us -uc
|
||||
cp linux.tar.gz ../$(KDEB_SOURCENAME)_$${origversion}.orig.tar.gz
|
||||
+dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) \
|
||||
--build=source,binary --source-option=-sP -nc -us -uc
|
||||
|
||||
PHONY += bindeb-pkg
|
||||
bindeb-pkg:
|
||||
@ -174,4 +207,7 @@ help:
|
||||
@echo ' perf-tarxz-src-pkg - Build $(perf-tar).tar.xz source tarball'
|
||||
@echo ' perf-tarzst-src-pkg - Build $(perf-tar).tar.zst source tarball'
|
||||
|
||||
PHONY += FORCE
|
||||
FORCE:
|
||||
|
||||
.PHONY: $(PHONY)
|
||||
|
@ -84,6 +84,8 @@ set_debarch() {
|
||||
fi
|
||||
}
|
||||
|
||||
rm -rf debian
|
||||
|
||||
# Some variables and settings used throughout the script
|
||||
version=$KERNELRELEASE
|
||||
if [ -n "$KDEB_PKGVERSION" ]; then
|
||||
@ -135,6 +137,28 @@ fi
|
||||
mkdir -p debian/source/
|
||||
echo "1.0" > debian/source/format
|
||||
|
||||
# Ugly: ignore anything except .config or debian/
|
||||
cat<<'EOF' > debian/source/local-options
|
||||
diff-ignore
|
||||
|
||||
extend-diff-ignore = ^[^.d]
|
||||
|
||||
extend-diff-ignore = ^\.[^c]
|
||||
extend-diff-ignore = ^\.c($|[^o])
|
||||
extend-diff-ignore = ^\.co($|[^n])
|
||||
extend-diff-ignore = ^\.con($|[^f])
|
||||
extend-diff-ignore = ^\.conf($|[^i])
|
||||
extend-diff-ignore = ^\.confi($|[^g])
|
||||
extend-diff-ignore = ^\.config.
|
||||
|
||||
extend-diff-ignore = ^d($|[^e])
|
||||
extend-diff-ignore = ^de($|[^b])
|
||||
extend-diff-ignore = ^deb($|[^i])
|
||||
extend-diff-ignore = ^debi($|[^a])
|
||||
extend-diff-ignore = ^debia($|[^n])
|
||||
extend-diff-ignore = ^debian[^/]
|
||||
EOF
|
||||
|
||||
echo $debarch > debian/arch
|
||||
extra_build_depends=", $(if_enabled_echo CONFIG_UNWINDER_ORC libelf-dev:native)"
|
||||
extra_build_depends="$extra_build_depends, $(if_enabled_echo CONFIG_SYSTEM_TRUSTED_KEYRING libssl-dev:native)"
|
||||
|
Loading…
Reference in New Issue
Block a user