From patchwork Fri Apr 7 10:16:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13204641 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CC60C6FD1D for ; Fri, 7 Apr 2023 10:16:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233146AbjDGKQn (ORCPT ); Fri, 7 Apr 2023 06:16:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbjDGKQi (ORCPT ); Fri, 7 Apr 2023 06:16:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6376886A6; Fri, 7 Apr 2023 03:16:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ED1F664EEC; Fri, 7 Apr 2023 10:16:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24A25C433EF; Fri, 7 Apr 2023 10:16:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680862596; bh=3xL2hEj3dYcOFlBodNMi0Lf4vCiBWs75OJihC7IKVCE=; h=From:To:Cc:Subject:Date:From; b=ggNeOfiKjjdTFkisMEjWaIGE1Vnyo6swZvXKzaNkH2zfmN21cKA20pvwhaz1UGgeD 6kBdDMpgcy0Ei9vOTcobwx3WrRYOc2+iZ3eZGFYfMxy33dr2Kc4m/mgaQhkhkTznQv cbtlejcUe0rcDa43aFbISJcBW3rtMIDMOEHE573XUxrWSI3oHDzYgwt24KvTM4jod4 heVLusarSonsdu1jqLHuFJEyLWNbTK4yJZAyzcI7r/0dei75jDnU5yfUZs49+TKU0d oaE5mjEZMEoP+97R1uqDXcU9O4SBvOVoAqmayZ5u4kdZKrpZmlQH7/ciFEaN8LPW3z pNZxHiMNVM0Eg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 1/3] kbuild: merge cmd_archive_linux and cmd_archive_perf Date: Fri, 7 Apr 2023 19:16:27 +0900 Message-Id: <20230407101629.1298051-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org The two commands, cmd_archive_linux and cmd_archive_perf, are similar. Merge them to make it easier to add more changes to the git-archive command. Signed-off-by: Masahiro Yamada Reviewed-by: Nathan Chancellor --- scripts/Makefile.package | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/scripts/Makefile.package b/scripts/Makefile.package index 61f72eb8d9be..a205617730c6 100644 --- a/scripts/Makefile.package +++ b/scripts/Makefile.package @@ -57,16 +57,17 @@ check-git: false; \ fi +quiet_cmd_archive = ARCHIVE $@ + cmd_archive = git -C $(srctree) archive \ + --output=$$(realpath $@) --prefix=$(basename $@)/ $(archive-args) + # Linux source tarball # --------------------------------------------------------------------------- -quiet_cmd_archive_linux = ARCHIVE $@ - cmd_archive_linux = \ - git -C $(srctree) archive --output=$$(realpath $@) --prefix=$(basename $@)/ $$(cat $<) - targets += linux.tar +linux.tar: archive-args = $$(cat $<) linux.tar: .tmp_HEAD FORCE - $(call if_changed,archive_linux) + $(call if_changed,archive) # rpm-pkg # --------------------------------------------------------------------------- @@ -180,16 +181,14 @@ quiet_cmd_perf_version_file = GEN $@ .tmp_perf/PERF-VERSION-FILE: .tmp_HEAD $(srctree)/tools/perf/util/PERF-VERSION-GEN | .tmp_perf $(call cmd,perf_version_file) -quiet_cmd_archive_perf = ARCHIVE $@ - cmd_archive_perf = \ - git -C $(srctree) archive --output=$$(realpath $@) --prefix=$(basename $@)/ \ - --add-file=$$(realpath $(word 2, $^)) \ +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 - $(call if_changed,archive_perf) + $(call if_changed,archive) PHONY += perf-tar-src-pkg perf-tar-src-pkg: perf-$(KERNELVERSION).tar From patchwork Fri Apr 7 10:16:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13204642 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11411C76196 for ; Fri, 7 Apr 2023 10:16:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233493AbjDGKQo (ORCPT ); Fri, 7 Apr 2023 06:16:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233373AbjDGKQk (ORCPT ); Fri, 7 Apr 2023 06:16:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F1AC8A4D; Fri, 7 Apr 2023 03:16:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 12F6E64EFD; Fri, 7 Apr 2023 10:16:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFC1FC4339B; Fri, 7 Apr 2023 10:16:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680862598; bh=ZO80oO4Qe+xdn84207QY7gzhpkvyOfUyW2wiMjCrFWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wz7AldFC5GKIVQBzLQsWl/gys3SNoK6K/x0zXY+xuvMqVfDDWYtXU+WUN07JkNDeF s8xjtLZ8hejRvNk0x8NbQEqOn0esCFSzWv8sZhTyzlepw4GuonhPfrxKvkMBjt1NgZ fIYlBNHcmlIVApwCdatcZmvoUmThwYyNdDUUCKkuEZg/ABN84/y5L3q5bzrvJV98yX Ph5zK1OwqB+upZqCWAXebbmQMpl5zuoLnJjLdleJWA9z2eUns691dq+9K/lpYroFRn v7/Ad8uIq/M48YoPCmiBOwAI8HjebMRvCzL69fpnfxLSTK2jTrY51uCHowYLqkgg90 qaToHzC+bbQrA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 2/3] kbuild: do not create intermediate *.tar for source tarballs Date: Fri, 7 Apr 2023 19:16:28 +0900 Message-Id: <20230407101629.1298051-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230407101629.1298051-1-masahiroy@kernel.org> References: <20230407101629.1298051-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.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 Reviewed-by: Nathan Chancellor --- 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 From patchwork Fri Apr 7 10:16:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13204643 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41D75C77B6E for ; Fri, 7 Apr 2023 10:16:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240024AbjDGKQo (ORCPT ); Fri, 7 Apr 2023 06:16:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbjDGKQm (ORCPT ); Fri, 7 Apr 2023 06:16:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C565493EA; Fri, 7 Apr 2023 03:16:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5AC5864F13; Fri, 7 Apr 2023 10:16:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1803FC4339E; Fri, 7 Apr 2023 10:16:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680862600; bh=CKzFfekVaBNvU9m5gXHN+n1Z/uYMoDtKwhblrUGGlII=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lRrp1yO24AlnRDuPIVq6WBifDugBAX4NldgVCmGVHQ0GVCrgYk2spE6wlSIBFVTE7 YEwgtU/VYoKcYI5wFQWHpq19+QqG7GsJ2yBV5ZyuNW1oZT5cJTyW0ab4Gz63kegS0W UQVm/2xbDcyno0ABSqUh87ju+087QkMj2IY5zbZN2pKf1EmqC4F5FGEf5T7wiNR/mr kEw3W4LlAv1hJ38+yTnuyzHI01w0mYMwd5HrarCL3fSujux+LC0M3SZPt70atR+u0H uFVXWUktlIKhzxb04dARYtFrwIN7vEUQ7wGmsME1D72RHtNwIkcVO0Ad5xZ40o3E6N euy3A8P6Blraw== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nick Terrell , Nicolas Schier Subject: [PATCH 3/3] kbuild: do not create intermediate *.tar for tar packages Date: Fri, 7 Apr 2023 19:16:29 +0900 Message-Id: <20230407101629.1298051-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230407101629.1298051-1-masahiroy@kernel.org> References: <20230407101629.1298051-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Commit 05e96e96a315 ("kbuild: use git-archive for source package creation") split the compression as a separate step to factor out the common build rules. With the previous commit, we got back to the situation where compressed source tarballs are created by a single rule. There is no reason to keep the separate compression rules. Generate the comressed tar packages directly. Signed-off-by: Masahiro Yamada Reviewed-by: Nathan Chancellor --- scripts/Makefile.package | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/scripts/Makefile.package b/scripts/Makefile.package index 7707975f729b..e0e18d7dfbd5 100644 --- a/scripts/Makefile.package +++ b/scripts/Makefile.package @@ -2,7 +2,6 @@ # Makefile for the different targets used to generate full packages of a kernel include $(srctree)/scripts/Kbuild.include -include $(srctree)/scripts/Makefile.lib KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE)) KBUILD_PKG_ROOTCMD ?="fakeroot -u" @@ -27,21 +26,6 @@ fi ; \ tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \ --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3) -# tarball compression -# --------------------------------------------------------------------------- - -%.tar.gz: %.tar - $(call cmd,gzip) - -%.tar.bz2: %.tar - $(call cmd,bzip2) - -%.tar.xz: %.tar - $(call cmd,xzmisc) - -%.tar.zst: %.tar - $(call cmd,zstd) - # Git # --------------------------------------------------------------------------- @@ -153,10 +137,17 @@ tar-install: FORCE $(Q)$(MAKE) -f $(srctree)/Makefile +$(Q)$(srctree)/scripts/package/buildtar $@ +compress-tar.gz = -I "$(KGZIP)" +compress-tar.bz2 = -I "$(KBZIP2)" +compress-tar.xz = -I "$(XZ)" +compress-tar.zst = -I "$(ZSTD)" + quiet_cmd_tar = TAR $@ - cmd_tar = cd $<; tar cf ../$@ --owner=root --group=root --sort=name * + cmd_tar = cd $<; tar cf ../$@ $(compress-tar$(suffix $@)) --owner=root --group=root --sort=name * + +dir-tarballs := $(addprefix linux-$(KERNELRELEASE)-$(ARCH), .tar .tar.gz .tar.bz2 .tar.xz .tar.zst) -linux-$(KERNELRELEASE)-$(ARCH).tar: tar-install +$(dir-tarballs): tar-install $(call cmd,tar) PHONY += dir-pkg