From patchwork Wed Feb 15 01:20:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 57329 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3299637wrn; Tue, 14 Feb 2023 17:23:38 -0800 (PST) X-Google-Smtp-Source: AK7set92JSQUcpB/5Zv6o5uIkiGdj1snLTF3Z9ZLbW/V0mCPTLoOm0plRZcGpM7u1MXwGXv4kBo7 X-Received: by 2002:a05:6a20:3943:b0:c6:7673:f379 with SMTP id r3-20020a056a20394300b000c67673f379mr151922pzg.26.1676424217858; Tue, 14 Feb 2023 17:23:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676424217; cv=none; d=google.com; s=arc-20160816; b=HgQIdczhsdnc9T6gLuKGgZLMXzFhi2yCBWRxyQcpVFDep+TzkgCKqxZta4j/pe0X/M SmfwVy+1Vn8oxDEGMNRs5N8Zhj3U6YZnno84HnfGFwTXC4Cm+M+MUz+PTBep8NvzaBNn +uz3qBNGwFXwBJQdSv14tPrfmC9qBr3q4I7fyu7UF+wIIBVlXS8UA+utkCwAYdYSBxP8 Wxu1v/glVYI6Eh7ZrHEw8/metzRDAPemRAfsXwzr2KViD8+QCre6UEQhLMVJ64SNaSCK CHlw/eOb6gvIL+aKp4X9Dro76+T4E8eQ4NrQPfip8eKnUsUIXf1psWYGLTIN3AgbJYe1 xioQ== 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=7z6yf0XVLZ+sPHLeA9GOaPBthf4KSfXvdpVuevAtj/4=; b=z55VbSJz9sKpa+k6Fg03F+H7myE/GDmTbsu2PAKR3j2hlXCPibGvqKGRKYxDGHoKek kjbtDwJfJVY/B3jCZSdRCZpeTfbuEUuFkr+I+Oz5YH0uvRx1FqlNVoUiacdTYoKxH8xR UsG8j/F+lV88M2+EB+Gc4BYk/HY36ugo7ju2zpGXf/mgOB0QngHrarMYdci3uK3TfMnC cvJ/i6FgyLQBGhf1pxMeST2Nr/iRks9UudwC6kCBD1ola4aEB/LOHlfWL79zPhNub2jw zMItN9nlZcoCVKrtOLAboNSLolsu3uiV4ohP01yapJ3FI8y8MSnCz/6h9nkmQ9IxCDv+ 4CIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tuXS3J3l; 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 c14-20020a63724e000000b004fb359820cfsi7369208pgn.573.2023.02.14.17.23.24; Tue, 14 Feb 2023 17:23:37 -0800 (PST) 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=tuXS3J3l; 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 S233567AbjBOBWk (ORCPT + 99 others); Tue, 14 Feb 2023 20:22:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233491AbjBOBWU (ORCPT ); Tue, 14 Feb 2023 20:22:20 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FBD432CD2; Tue, 14 Feb 2023 17:21:49 -0800 (PST) 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 ED1076199C; Wed, 15 Feb 2023 01:21:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0DBCC433D2; Wed, 15 Feb 2023 01:21:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676424108; bh=WszWYo1Dp3gtPmdsDTDcLO4U185HID5tYaADLVl+YJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tuXS3J3lUbtayvg3n33el4JAI3hK8xT9eZMWTj6IPX1KusGuisadhyvWNeu5MGZh5 wFDikPC6YAbtPrvVF0ls/l2XO93KH2ogMTlvoRm8g3//MatM+WVGiEy1dqnsETc6bE qiHXJrxo5cCvqh/lHPXO+fFmOot3/DrhSXEbUo0i6K2lqjBs15VYDMxobws3pweOuG dqkl2/QnvzWD9h6wgefhNvPpg7Hf3M4hGpsnTfqyIhZIMRYEvsOTvT2FusR7JvHpUp y7cV2B5Xh83kEp3LuFB4DWn9+9+QqdhJq7rLSOBwHcl+TBNzp+DPq2H8amFcQNprLJ 3hmB9vs4eI7PQ== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Ben Hutchings , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH v6 09/12] kbuild: tar-pkg: use tar rules in scripts/Makefile.package Date: Wed, 15 Feb 2023 10:20:31 +0900 Message-Id: <20230215012034.403356-9-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230215012034.403356-1-masahiroy@kernel.org> References: <20230215012034.403356-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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?1757858200687679238?= X-GMAIL-MSGID: =?utf-8?q?1757858200687679238?= Use %.tar, %.tar.gz, %.tar.bz2, %.tar.xz, %.tar.zst rules in scripts/Makefile.package. Signed-off-by: Masahiro Yamada --- Changes in v6: - New patch scripts/Makefile.package | 29 +++++++++++++++++----- scripts/package/buildtar | 52 +--------------------------------------- 2 files changed, 24 insertions(+), 57 deletions(-) diff --git a/scripts/Makefile.package b/scripts/Makefile.package index 50b86b325d7a..b941e6341b36 100644 --- a/scripts/Makefile.package +++ b/scripts/Makefile.package @@ -145,13 +145,30 @@ snap-pkg: cd $(objtree)/snap && \ snapcraft --target-arch=$(UTS_MACHINE) -# tarball targets +# dir-pkg tar*-pkg - tarball targets # --------------------------------------------------------------------------- -tar-pkgs := dir-pkg tar-pkg targz-pkg tarbz2-pkg tarxz-pkg tarzst-pkg -PHONY += $(tar-pkgs) -$(tar-pkgs): - $(MAKE) -f $(srctree)/Makefile - +$(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@ + +tar-pkg-tarball = linux-$(KERNELRELEASE)-$(ARCH).$(1) +tar-pkg-phony = $(subst .,,$(1))-pkg + +tar-install: FORCE + $(Q)$(MAKE) -f $(srctree)/Makefile + +$(Q)$(srctree)/scripts/package/buildtar $@ + +PHONY += dir-pkg +dir-pkg: tar-install + @echo "Kernel tree successfully created in $<" + +define tar-pkg-rule +PHONY += $(tar-pkg-phony) +$(tar-pkg-phony): $(tar-pkg-tarball) + @: + +$(tar-pkg-tarball): private tar-rootdir := tar-install +$(tar-pkg-tarball): tar-install +endef + +$(foreach x, tar tar.gz tar.bz2 tar.xz tar.zst, $(eval $(call tar-pkg-rule,$(x)))) # perf-tar*-src-pkg - generate a source tarball with perf source # --------------------------------------------------------------------------- diff --git a/scripts/package/buildtar b/scripts/package/buildtar index 4d6f0b128efd..65b4ea502962 100755 --- a/scripts/package/buildtar +++ b/scripts/package/buildtar @@ -16,39 +16,7 @@ set -e # # Some variables and settings used throughout the script # -tmpdir="${objtree}/tar-install" -tarball="${objtree}/linux-${KERNELRELEASE}-${ARCH}.tar" - - -# -# Figure out how to compress, if requested at all -# -case "${1}" in - dir-pkg|tar-pkg) - opts= - ;; - targz-pkg) - opts="-I ${KGZIP}" - tarball=${tarball}.gz - ;; - tarbz2-pkg) - opts="-I ${KBZIP2}" - tarball=${tarball}.bz2 - ;; - tarxz-pkg) - opts="-I ${XZ}" - tarball=${tarball}.xz - ;; - tarzst-pkg) - opts="-I ${ZSTD}" - tarball=${tarball}.zst - ;; - *) - echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2 - exit 1 - ;; -esac - +tmpdir=$1 # # Clean-up and re-create the temporary directory @@ -148,21 +116,3 @@ case "${ARCH}" in sleep 5 ;; esac - -if [ "${1}" = dir-pkg ]; then - echo "Kernel tree successfully created in $tmpdir" - exit 0 -fi - -# -# Create the tarball -# -if tar --owner=root --group=root --help >/dev/null 2>&1; then - opts="$opts --owner=root --group=root" -fi - -tar cf $tarball -C $tmpdir $opts $dirs - -echo "Tarball successfully created in $tarball" - -exit 0