From patchwork Sat Sep 2 08:05:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 111500 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp2038555qge; Sat, 2 Sep 2017 01:06:21 -0700 (PDT) X-Google-Smtp-Source: ADKCNb62jKm4WJ/uY4Z+ihG+KKloSo89G5amsXuMyGmrryfMxqMlvnBFR0iGj2szz9vnWwWRfT8x X-Received: by 10.84.133.6 with SMTP id 6mr5632268plf.128.1504339581846; Sat, 02 Sep 2017 01:06:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504339581; cv=none; d=google.com; s=arc-20160816; b=FpaVLtZ/UV2L5s9CPCAzsbd5KF4TbG/fXn9NnWtyWQJ8sngeHuLqaDU2YuoUk6vuDQ IrCujX3IrMjF3OzBi6dI8vBM+9VJSpvlGO1KKtCBFzXW6qb92LbUKJXyI8ZK3MGrQ/T4 3vESJg4+U9y8GFYZ/C/8tjtDfJQdNZ+igKZLWHikj+Aas/gYhs1FbDaEsqpZQUWZZU4s ak325Qgo7Bx1UFVXGBAqZsXht1nlX440f78B4NXHgJ+UtBLzUxAdxNBCusDPJlhAuuwh GZxIxVOc9QEzkf827e4w4IMI7M+yJhzXT9HSKw36q/xVHxr7QVmJa3El2R3oF22fH1z1 CYDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=sZzrURp8Nvu7e6Mxy6cSwAu03dy1FFZUvT6vyoI8Pr4=; b=0Slf35gKJYrB6hi1RyNCCHnDihnd9pQi/jyeZg4bTenqY70rycChIlUzWudxTV3dsp qG/5XrSa7d9ub5eZ0moSWpgxOz1HPOEaI1pMeyBg5WM+zh7Rqu5OWbrngAsk8O90iaq3 92KHH5GgBHyND8Zz9hinRbrnYbDqWTIIF7Jw8qYVrGVmI0gfgspRJErSnSMRvWEY3i9w 5HnpcTxpLyTGbmbo2IW/wQvWqX3mfNYq0aKDNwS4zbVZaEZOnzgEa3ZoJgJsq1o1XE2Y W35Siv0g+g5k1ToaZnef3tRqPtoUxgvbQbMJmcO57cXhv8Gk05KKBR6wrnntFKoc1a5s KSgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=w+zFD7b/; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g80si39406pfb.269.2017.09.02.01.06.21; Sat, 02 Sep 2017 01:06:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=w+zFD7b/; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752706AbdIBIGF (ORCPT + 26 others); Sat, 2 Sep 2017 04:06:05 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:39901 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752669AbdIBIGE (ORCPT ); Sat, 2 Sep 2017 04:06:04 -0400 Received: from grover.sesame (FL1-122-131-185-176.osk.mesh.ad.jp [122.131.185.176]) (authenticated) by conuserg-07.nifty.com with ESMTP id v8285dNU025842; Sat, 2 Sep 2017 17:05:42 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v8285dNU025842 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1504339542; bh=sZzrURp8Nvu7e6Mxy6cSwAu03dy1FFZUvT6vyoI8Pr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w+zFD7b/I3G+f5mkA6+jAMy86ZP3DY7ced0/y949UBXGrdvKGLet5ye0+JRX/eldE 6qc4RbF5iJVppQ0uODnl0NAqQwfA7tx5bxSEq1D19S1sL61eEw2coqPn3dz38vwqo6 zj0/RS9nGOwwiD5TH6ZRpOH+jKALxK3WID8IdX9OBMKSliVX2mwoHPYqDJ/luU2vYS eJkNEITkbsim/lmtcqEAFB7qDzVNq2qI1K1fHEXUvBgNDwz3kX5LzP+v1HUscANhom KSnAo1wOMyL16i0wL0mBH7vZQtiL4GXn/J7tQlP/vtkyLKX7ODdtXJXnLqW4VXMYxy xqfAyn9JoYmsA== X-Nifty-SrcIP: [122.131.185.176] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] kbuild: buildtar: do not print successful message if tar returns error Date: Sat, 2 Sep 2017 17:05:35 +0900 Message-Id: <1504339535-31825-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504339535-31825-1-git-send-email-yamada.masahiro@socionext.com> References: <1504339535-31825-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The previous commit spotted that "Tarball successfully created ..." is displayed even if the "tar" command returns error code because it is followed by "| ${compress}". Let the build fail instead of printing the successful message since if the "tar" command fails, the output may not be what users expect. Avoid the use of the pipe. While we are here, refactor the script removing the use of sub-shell, ${compress}, ${file_ext}. Signed-off-by: Masahiro Yamada --- scripts/package/buildtar | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) -- 2.7.4 diff --git a/scripts/package/buildtar b/scripts/package/buildtar index 60dd836a0214..51f947118256 100755 --- a/scripts/package/buildtar +++ b/scripts/package/buildtar @@ -24,20 +24,19 @@ tarball="${objtree}/linux-${KERNELRELEASE}-${ARCH}.tar" # case "${1}" in tar-pkg) - compress="cat" - file_ext="" + opts= ;; targz-pkg) - compress="gzip" - file_ext=".gz" + opts=--gzip + tarball=${tarball}.gz ;; tarbz2-pkg) - compress="bzip2" - file_ext=".bz2" + opts=--bzip2 + tarball=${tarball}.bz2 ;; tarxz-pkg) - compress="xz" - file_ext=".xz" + opts=--xz + tarball=${tarball}.xz ;; *) echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2 @@ -125,14 +124,12 @@ esac # # Create the tarball # -( - opts= - if tar --owner=root --group=root --help >/dev/null 2>&1; then - opts="--owner=root --group=root" - fi - tar cf - -C "$tmpdir" $dirs $opts | ${compress} > "${tarball}${file_ext}" -) +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}${file_ext}" +echo "Tarball successfully created in $tarball" exit 0