History

kbuild: do not create intermediate *.tar for source tarballs

Since commit 05e96e96a315 ("kbuild: use git-archive for source package creation"), a source tarball is created in two steps; create *.tar file then compress it. I split the compression as a separate rule because I just thought 'git archive' supported only gzip. For other compression algorithms, I could pipe the two commands: $ git archive HEAD | xz > linux.tar.xz I read git-archive(1) carefully, and I realized GIT had provided a more elegant way: $ git -c tar.tar.xz.command=xz archive -o linux.tar.xz HEAD This commit uses 'tar.tar.*.command' configuration to specify the compression backend so we can compress a source tarball on-the-fly. GIT commit 767cf4579f0e ("archive: implement configurable tar filters") is more than a decade old, so it should be available on almost all build environments.

Masahiro Yamada committed 3 years ago

Commit f8d94c41 parent f6d82831 file · +17 −7Browse files

Unified · Split

scripts/Makefile.package+17−7
@@ -57,16 +57,23 @@ check-git: · 56 unmodified lines
57 false; \57 false; \
58 fi58 fi
59 59
60git-config-tar.gz = -c tar.tar.gz.command="$(KGZIP)"
61git-config-tar.bz2 = -c tar.tar.bz2.command="$(KBZIP2)"
62git-config-tar.xz = -c tar.tar.xz.command="$(XZ)"
63git-config-tar.zst = -c tar.tar.zst.command="$(ZSTD)"
64
60quiet_cmd_archive = ARCHIVE $@65quiet_cmd_archive = ARCHIVE $@
61 cmd_archive = git -C $(srctree) archive \66 cmd_archive = git -C $(srctree) $(git-config-tar$(suffix $@)) archive \
62 --output=$$(realpath $@) --prefix=$(basename $@)/ $(archive-args)67 --output=$$(realpath $@) --prefix=$(basename $@)/ $(archive-args)
63 68
64# Linux source tarball69# Linux source tarball
65# ---------------------------------------------------------------------------70# ---------------------------------------------------------------------------
66 71
67targets += linux.tar72linux-tarballs := $(addprefix linux, .tar.gz)
68linux.tar: archive-args = $$(cat $<)73
69linux.tar: .tmp_HEAD FORCE74targets += $(linux-tarballs)
75$(linux-tarballs): archive-args = $$(cat $<)
76$(linux-tarballs): .tmp_HEAD FORCE
70 $(call if_changed,archive)77 $(call if_changed,archive)
71 78
72# rpm-pkg79# rpm-pkg
@@ -186,9 +193,12 @@ perf-archive-args = --add-file=$$(realpath $(word 2, $^)) \ · 113 unmodified lines
186 --add-file=$$(realpath $(word 3, $^)) \193 --add-file=$$(realpath $(word 3, $^)) \
187 $$(cat $(word 2, $^))^{tree} $$(cat $<)194 $$(cat $(word 2, $^))^{tree} $$(cat $<)
188 195
189targets += perf-$(KERNELVERSION).tar196
190perf-$(KERNELVERSION).tar: archive-args = $(perf-archive-args)197perf-tarballs := $(addprefix perf-$(KERNELVERSION), .tar .tar.gz .tar.bz2 .tar.xz .tar.zst)
191perf-$(KERNELVERSION).tar: tools/perf/MANIFEST .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE FORCE198
199targets += $(perf-tarballs)
200$(perf-tarballs): archive-args = $(perf-archive-args)
201$(perf-tarballs): tools/perf/MANIFEST .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE FORCE
192 $(call if_changed,archive)202 $(call if_changed,archive)
193 203
194PHONY += perf-tar-src-pkg204PHONY += perf-tar-src-pkg

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t