From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Nicolas Schier <nicolas@fjasle.eu>
Subject: [PATCH 2/3] kbuild: do not create intermediate *.tar for source tarballs
Date: Fri, 7 Apr 2023 19:16:28 +0900 [thread overview]
Message-ID: <20230407101629.1298051-2-masahiroy@kernel.org> (raw)
In-Reply-To: <20230407101629.1298051-1-masahiroy@kernel.org>
Since commit 05e96e96a315 ("kbuild: use git-archive for source package
creation"), source tarballs are 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 compression. I admit
the unneeded *.tar file is annoying.
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 create a compressed tarball directly.
GIT commit 767cf4579f0e ("archive: implement configurable tar filters")
is more than a decade old, so it should be available on almost all build
environments.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/Makefile.package | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/scripts/Makefile.package b/scripts/Makefile.package
index a205617730c6..7707975f729b 100644
--- a/scripts/Makefile.package
+++ b/scripts/Makefile.package
@@ -57,16 +57,23 @@ check-git:
false; \
fi
+archive-config-tar.gz = -c tar.tar.gz.command="$(KGZIP)"
+archive-config-tar.bz2 = -c tar.tar.bz2.command="$(KBZIP2)"
+archive-config-tar.xz = -c tar.tar.xz.command="$(XZ)"
+archive-config-tar.zst = -c tar.tar.zst.command="$(ZSTD)"
+
quiet_cmd_archive = ARCHIVE $@
- cmd_archive = git -C $(srctree) archive \
+ cmd_archive = git -C $(srctree) $(archive-config-tar$(suffix $@)) archive \
--output=$$(realpath $@) --prefix=$(basename $@)/ $(archive-args)
# Linux source tarball
# ---------------------------------------------------------------------------
-targets += linux.tar
-linux.tar: archive-args = $$(cat $<)
-linux.tar: .tmp_HEAD FORCE
+linux-tarballs := $(addprefix linux, .tar.gz)
+
+targets += $(linux-tarballs)
+$(linux-tarballs): archive-args = $$(cat $<)
+$(linux-tarballs): .tmp_HEAD FORCE
$(call if_changed,archive)
# rpm-pkg
@@ -185,9 +192,12 @@ perf-archive-args = --add-file=$$(realpath $(word 2, $^)) \
--add-file=$$(realpath $(word 3, $^)) \
$$(cat $(word 2, $^))^{tree} $$(cat $<)
-targets += perf-$(KERNELVERSION).tar
-perf-$(KERNELVERSION).tar: archive-args = $(perf-archive-args)
-perf-$(KERNELVERSION).tar: tools/perf/MANIFEST .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE FORCE
+
+perf-tarballs := $(addprefix perf-$(KERNELVERSION), .tar .tar.gz .tar.bz2 .tar.xz .tar.zst)
+
+targets += $(perf-tarballs)
+$(perf-tarballs): archive-args = $(perf-archive-args)
+$(perf-tarballs): tools/perf/MANIFEST .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE FORCE
$(call if_changed,archive)
PHONY += perf-tar-src-pkg
--
2.37.2
next prev parent reply other threads:[~2023-04-07 10:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-07 10:16 [PATCH 1/3] kbuild: merge cmd_archive_linux and cmd_archive_perf Masahiro Yamada
2023-04-07 10:16 ` Masahiro Yamada [this message]
2023-04-07 18:11 ` [PATCH 2/3] kbuild: do not create intermediate *.tar for source tarballs Nathan Chancellor
2023-04-08 1:32 ` Masahiro Yamada
2023-04-07 10:16 ` [PATCH 3/3] kbuild: do not create intermediate *.tar for tar packages Masahiro Yamada
2023-04-07 18:12 ` Nathan Chancellor
2023-04-20 8:54 ` Tariq Toukan
2023-04-20 9:06 ` Nicolas Schier
2023-04-20 9:19 ` Leon Romanovsky
2023-04-20 12:31 ` Masahiro Yamada
2023-04-11 0:33 ` Masahiro Yamada
2023-04-07 18:00 ` [PATCH 1/3] kbuild: merge cmd_archive_linux and cmd_archive_perf Nathan Chancellor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230407101629.1298051-2-masahiroy@kernel.org \
--to=masahiroy@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nicolas@fjasle.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox