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: 80734 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp189854vqo; Fri, 7 Apr 2023 03:28:51 -0700 (PDT) X-Google-Smtp-Source: AKy350Zv1o4MUTC5W5QGW4b2GUs3VGa6Cz7P54CtzfstnNKg7Gm1Xl9YluicYjLI3xdbSaRe8Nec X-Received: by 2002:a17:906:a44e:b0:947:c8d5:fb3c with SMTP id cb14-20020a170906a44e00b00947c8d5fb3cmr2012462ejb.51.1680863330772; Fri, 07 Apr 2023 03:28:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680863330; cv=none; d=google.com; s=arc-20160816; b=QyeCryMAyhAMD7oaioxGBDndWSLLzE0VQqjv2vAoxbAt9oSzM65qibwVpG48MYGne+ /XZHvIsysLFdGa4owaL2s/meE58Di3isF78kkISiwYR9K6MUp58+7ChciKtP4XVHPP6y 8/YGWuah2D61HFECB+uJ78Dn7tm9yMvA+Gp/dnc6FWdXYmz79bM5I+AC0NqlnaL39dIF 3US9L8inN9B43K4v+yjSEzRlxI9dImFUTJqcqQN/kwCHa1xEifFVdzG2D3t08onZ/oQl VHOg8YN1WDTvXU/LpYWYiziJ66/8g5O/6OkrlT71nqzJlyphG1s/PooUe/ESuBmZGyVk mmvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Nw6ixyGSrKDKbHXqwdelFJ0sqb0pzb4trC9G9qrC7N0=; b=yjBnK4yjr9/ePQ9DLfyuNxY+JSakaGVzicZtIsyLcxv9mVwKmXBe6erV6q6lIAc2n9 JRgcEFyyC/mgV/5XWdI8rkxAqb5Qo6BbwTuQGkphf61HualoamYO4YVYBThvJ9e5qRyt pedmScIyPFrEwRmWJ4LLXqSru03agYHiD4v48636RHDVT66JNGm469VgVAMvlEVHPJ83 6/7jC8O5dlDERHN1yRkXl9n9vDgrU9EfFx2wDXfgu3xXmcA+w6BCaBx/qtBOlvYfButt PrngA2ECbNV1zMymVC/sKC6UEcKu1J5TBDdVPZPDm2/50E3D3cOPQUsfWF8mRfASZMGm Egeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Wz7AldFC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id vi3-20020a170907d40300b00947b5e0ec15si1727831ejc.110.2023.04.07.03.28.25; Fri, 07 Apr 2023 03:28:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Wz7AldFC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240322AbjDGKQq (ORCPT + 99 others); Fri, 7 Apr 2023 06:16:46 -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 X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762512947568049536?= X-GMAIL-MSGID: =?utf-8?q?1762512947568049536?= 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