From patchwork Tue Jul 2 18:02:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13720130 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A01281C2308; Tue, 2 Jul 2024 18:03:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719943417; cv=none; b=YPaRutgKLI7NSSTvIHV5ccdz1ERQYlb86li5kPzbE9oAG31YbmaIL+U/SV3F4/I6tZ8LLrJAHAIt0hzzWXl3axk8c4Af6Z1ReAFMXD5L8TiLBV1p5rMDGSRLXj6IcSQRbuOfWlJgbsQgEXaHr3XNX32Xvf+UoYC8F9qcklnvlJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719943417; c=relaxed/simple; bh=lf+3YIV6GJEHHtvc0aZRR8uMxi/pZD7e0qFLN3AxOXE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Ut72xbD3bWIRtQ7cPvo9R6T6vVI5ZkqhOvogDxLSEyYBfUCC//0bIBTsAffXMgSUGw6x6mEYvOgEMzXasgRWvyO4kWtJHMKdbyhn8V5kDOPZ+Z7s2wE2jyjfYwqfda+y4WtBqeLzhN0DvP+isUHQQNYtL4jqYBU/cHHZCD0d/Uo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fdFGdGQS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fdFGdGQS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB7E4C116B1; Tue, 2 Jul 2024 18:03:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719943417; bh=lf+3YIV6GJEHHtvc0aZRR8uMxi/pZD7e0qFLN3AxOXE=; h=From:To:Cc:Subject:Date:From; b=fdFGdGQS5PT1epVp298uigkPx2CD7bLcjOGM+Hsx9OYtw0H3FK4C+yYQ1e/ttZaGc +XiVvpGRtmhllb5j2noqZISj4JKvSUl/JefAIHu8zT0zbcWi3SQDhRlF7Y7vMdJxQB OJ60BfP75VotLZdXKDn4oz/hz5o2MBWIL0j06VXN68kU2yzBn0iUgHFUR7p8VhBPfu nba5TfNQCogjLg+maNqgNnweIa6i8dtBwJVUesfYWiwfgqwQL/DB80LmXzEQmIoLgc XM5nHA34FK8l3sdFjqpaSWNyCdKQanK0PSRxVCnJ+xmZxY0HsNyE5bGGnuBS9esmQh Vei1psezg3Jzw== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nicolas Schier Subject: [PATCH v2 1/3] kbuild: deb-pkg: remove support for EMAIL environment variable Date: Wed, 3 Jul 2024 03:02:40 +0900 Message-ID: <20240702180332.398978-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Commit edec611db047 ("kbuild, deb-pkg: improve maintainer identification") added the EMAIL and NAME environment variables. Commit d5940c60e057 ("kbuild: deb-pkg improve maintainer address generation") removed support for NAME, but kept support for EMAIL. The EMAIL and NAME environment variables are still supported by some tools (see 'man debchange'), but not by all. We should support both of them, or neither of them. We should not stop halfway. Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- Changes in v2: - New patch scripts/package/mkdebian | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index b9a5b789c655..589f92b88c42 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -125,7 +125,7 @@ gen_source () rm -rf debian mkdir debian -email=${DEBEMAIL-$EMAIL} +email=${DEBEMAIL} # use email string directly if it contains if echo "${email}" | grep -q '<.*>'; then From patchwork Tue Jul 2 18:02:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13720131 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E7101C9EA8; Tue, 2 Jul 2024 18:03:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719943419; cv=none; b=sIs6RPCEwiokD9mHp8xa0iTLznoxK7LeCqxMDXGafDQAL/JclVma8t2JWr3lulnHKRs/aGQ2tQkWgvxjsl7aawilSB7CI5JB+gs5zGn4R095QdYjZiYP1pG/FSDjgJ6ioVR2SKvqCSzI6qRaBwG0tH+z54IjH81zhwBNNI0vxwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719943419; c=relaxed/simple; bh=I6yGZ06EQ0HwMlVgzB8aX/mn7PxmDl5I3IEYPTsQ2ZA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FjH6fvx1K+FzqZyEZDUONlilPALQ4IV4w7QA8NAjy4/3xtjTUnlekXv4cY0cxOV2a2jNXQM4Zg0tkZyuizp28vbh9n4ZcTnJ3NHK8nHltO4oatsRNdmjL4YRoPhHMP/8phiCllBfNkYFdxP9kVXE0yNZ3mfr8ESA+FQoC43iIDQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Uclj5Mqv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Uclj5Mqv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEC0BC4AF0C; Tue, 2 Jul 2024 18:03:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719943419; bh=I6yGZ06EQ0HwMlVgzB8aX/mn7PxmDl5I3IEYPTsQ2ZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uclj5Mqvp98cAU/s/uZx3peqd7GSvcao28AYERKUBAwMFP1lauHsg4DENbWKXqic0 thJgOM1RrkR0I9s/+alHUvty/f6hwE9IH43/1xjSvIJ6zMHORqGALigBvJVcHmGBSn b8m1rhovJvz62naxxFkvtP4nyWEBfpt243aq4zcgXkjshfZ4dnb6XXickTkRu01h/8 Ac4Ehs6ODLVomYT3cJc2bUi+w0JFSBeErJPumVgHJYM72GQTyZ0SeyjcX91jBoU02l K1QWkJjfu3f00AI3cBl05A+ef79iJ+dzF82RAf09zdilVtr47QYUlfhks/UJa88qA3 FTCPMfG64/I3A== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nicolas Schier Subject: [PATCH v2 2/3] kbuild: deb-pkg: remove support for "name " form for DEBEMAIL Date: Wed, 3 Jul 2024 03:02:41 +0900 Message-ID: <20240702180332.398978-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240702180332.398978-1-masahiroy@kernel.org> References: <20240702180332.398978-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Commit d5940c60e057 ("kbuild: deb-pkg improve maintainer address generation") supported the "name " form for DEBEMAIL, with behavior slightly different from devscripts. In Kbuild, if DEBEMAIL has the form "name ", it will be used as-is for debian/changelog. DEBFULLNAME will be ignored. In contrast, debchange takes the name from DEBFULLNAME (or NAME) if set, as described in 'man debchange': If this variable has the form "name ", then the maintainer name will also be taken from here if neither DEBFULLNAME nor NAME is set. This commit removes support for the "name form for DEBEMAIL, as the current behavior is already different from debchange, and the Debian manual suggests setting the email address and name separately in DEBEMAIL and DEBFULLNAME. [1] If there are any complaints about this removal, we can re-add it, with better alignment with the debchange implementation. [2] [1]: https://www.debian.org/doc/manuals/debmake-doc/ch03.en.html#email-setup [2]: https://salsa.debian.org/debian/devscripts/-/blob/v2.23.7/scripts/debchange.pl#L802 Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- Changes in v2: - New patch scripts/package/mkdebian | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 589f92b88c42..83c6636fadb8 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -125,21 +125,15 @@ gen_source () rm -rf debian mkdir debian -email=${DEBEMAIL} - -# use email string directly if it contains -if echo "${email}" | grep -q '<.*>'; then - maintainer=${email} +user=${KBUILD_BUILD_USER-$(id -nu)} +name=${DEBFULLNAME-${user}} +if [ "${DEBEMAIL:+set}" ]; then + email=${DEBEMAIL} else - # or construct the maintainer string - user=${KBUILD_BUILD_USER-$(id -nu)} - name=${DEBFULLNAME-${user}} - if [ -z "${email}" ]; then - buildhost=${KBUILD_BUILD_HOST-$(hostname -f 2>/dev/null || hostname)} - email="${user}@${buildhost}" - fi - maintainer="${name} <${email}>" + buildhost=${KBUILD_BUILD_HOST-$(hostname -f 2>/dev/null || hostname)} + email="${user}@${buildhost}" fi +maintainer="${name} <${email}>" if [ "$1" = --need-source ]; then gen_source From patchwork Tue Jul 2 18:02:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13720132 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBDDF1C2308; Tue, 2 Jul 2024 18:03:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719943420; cv=none; b=Naa7ewa3T0g/NjhgAK3UfR7D/JfqtU2JZG/g9fe0c1FOtOAVSAIQ+jlNr4OJW/+ZKsyIVVV9s4nL8jQe2h8NVFN6oDD7Ir4BjMi/o0185yJT9EVNgBlzge6midCzqPbKOVVIHrX/Mn7WZDtD9JtkalrduPXa68jU+pTMIV7Igzc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719943420; c=relaxed/simple; bh=zzOU2P/2RX733uvIXhmTJk0qMFVBXzpz0F9MYY9P1CM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c9v9rY8gIwRVBa59SlxurqRWfA377D3/C/DVvycC8x8RSuOi4k/xLHeZ1W1NGTPVMx8udhwOKimbmRtgINBBmM3oiwM6C1KtKZSK/6aaxQYbcI22W+UUu2AWD0t9sDa6blmUhTKK0v8Gx6ajjQQPgDnffj8nKIbo9kduQ7btM+E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ADbFIJ2M; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ADbFIJ2M" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A80A3C116B1; Tue, 2 Jul 2024 18:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719943420; bh=zzOU2P/2RX733uvIXhmTJk0qMFVBXzpz0F9MYY9P1CM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ADbFIJ2MkWPBlb9McLjo7MSiCu7ike6JJjdsCmooB4q45vqRUAs9xx3XIsP7Zxe+p 14iKFcAkLm2rtTmDsxBJ5gIlad5ooTKr7DEbG72Jw7gdNiliIbqNM13maU6aRq9dWl xTWqMAlmgYvMyAGLYWDmMRtqb/Lf5tZ6bIH2kmUnEqTRqxNk2u1c+Y/hj5Gd+yXpkJ cptlyycnyi44LfnSeGWLNkforWSB24F1XVhwSfbWr4gFs/M/q+eusG2ANrhUSaHmOd j/mwa1qXVVtoD42vIwiG9lROM/nLWW4wsL3yhIE3n1aRq/g3BXOizuZaBpv/eeZ8P3 vCDXI1vAEOQJA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nicolas Schier , Nathan Chancellor Subject: [PATCH v2 3/3] kbuild: package: add -e and -u options to some shell scripts Date: Wed, 3 Jul 2024 03:02:42 +0900 Message-ID: <20240702180332.398978-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240702180332.398978-1-masahiroy@kernel.org> References: <20240702180332.398978-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Set -e to make these scripts fail on the first error. Set -u because these scripts are invoked by Makefile, and do not work properly without necessary variables defined. I tweaked mkdebian to cope with optional environment variables. Remove the explicit "test -n ..." from install-extmod-build. Both options are described in POSIX. [1] [1]: https://pubs.opengroup.org/onlinepubs/009604499/utilities/set.html Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- Changes in v2: - Fix build errors from scripts/package/mkdebian scripts/package/builddeb | 2 +- scripts/package/buildtar | 2 +- scripts/package/gen-diff-patch | 2 ++ scripts/package/install-extmod-build | 5 +---- scripts/package/mkdebian | 8 ++++---- scripts/package/mkspec | 2 ++ 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index e797ad360f7a..c1757db6aa8a 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -10,7 +10,7 @@ # specified in KDEB_HOOKDIR) that will be called on package install and # removal. -set -e +set -eu is_enabled() { grep -q "^$1=y" include/config/auto.conf diff --git a/scripts/package/buildtar b/scripts/package/buildtar index eb67787f8673..cc87a473c01f 100755 --- a/scripts/package/buildtar +++ b/scripts/package/buildtar @@ -11,7 +11,7 @@ # Wichert Akkerman . # -set -e +set -eu # # Some variables and settings used throughout the script diff --git a/scripts/package/gen-diff-patch b/scripts/package/gen-diff-patch index 8a98b7bb78a0..f272f7770ea3 100755 --- a/scripts/package/gen-diff-patch +++ b/scripts/package/gen-diff-patch @@ -1,6 +1,8 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0-only +set -eu + diff_patch=$1 mkdir -p "$(dirname "${diff_patch}")" diff --git a/scripts/package/install-extmod-build b/scripts/package/install-extmod-build index 76e0765dfcd6..8cc9e13403ae 100755 --- a/scripts/package/install-extmod-build +++ b/scripts/package/install-extmod-build @@ -1,13 +1,10 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0-only -set -e +set -eu destdir=${1} -test -n "${srctree}" -test -n "${SRCARCH}" - is_enabled() { grep -q "^$1=y" include/config/auto.conf } diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 83c6636fadb8..0cc1913aad30 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -4,7 +4,7 @@ # # Simple script to generate a debian/ directory for a Linux kernel. -set -e +set -eu is_enabled() { grep -q "^$1=y" include/config/auto.conf @@ -19,7 +19,7 @@ if_enabled_echo() { } set_debarch() { - if [ -n "$KBUILD_DEBARCH" ] ; then + if [ "${KBUILD_DEBARCH:+set}" ]; then debarch="$KBUILD_DEBARCH" return fi @@ -141,7 +141,7 @@ fi # Some variables and settings used throughout the script version=$KERNELRELEASE -if [ -n "$KDEB_PKGVERSION" ]; then +if [ "${KDEB_PKGVERSION:+set}" ]; then packageversion=$KDEB_PKGVERSION else packageversion=$(${srctree}/scripts/setlocalversion --no-local ${srctree})-$($srctree/scripts/build-version) @@ -158,7 +158,7 @@ debarch= set_debarch # Try to determine distribution -if [ -n "$KDEB_CHANGELOG_DIST" ]; then +if [ "${KDEB_CHANGELOG_DIST:+set}" ]; then distribution=$KDEB_CHANGELOG_DIST # In some cases lsb_release returns the codename as n/a, which breaks dpkg-parsechangelog elif distribution=$(lsb_release -cs 2>/dev/null) && [ -n "$distribution" ] && [ "$distribution" != "n/a" ]; then diff --git a/scripts/package/mkspec b/scripts/package/mkspec index cffc2567bef2..77d25dda37e3 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -9,6 +9,8 @@ # Patched for non-x86 by Opencon (L) 2002 # +set -eu + output=$1 mkdir -p "$(dirname "${output}")"