* [PATCH v2 2/3] kbuild: deb-pkg: remove support for "name <email>" form for DEBEMAIL
2024-07-02 18:02 [PATCH v2 1/3] kbuild: deb-pkg: remove support for EMAIL environment variable Masahiro Yamada
@ 2024-07-02 18:02 ` Masahiro Yamada
2024-07-03 15:06 ` Masahiro Yamada
2024-07-02 18:02 ` [PATCH v2 3/3] kbuild: package: add -e and -u options to some shell scripts Masahiro Yamada
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Masahiro Yamada @ 2024-07-02 18:02 UTC (permalink / raw)
To: linux-kbuild
Cc: linux-kernel, Masahiro Yamada, Nathan Chancellor, Nicolas Schier
Commit d5940c60e057 ("kbuild: deb-pkg improve maintainer address
generation") supported the "name <email>" form for DEBEMAIL, with
behavior slightly different from devscripts.
In Kbuild, if DEBEMAIL has the form "name <email>", 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 <email>", then the maintainer name
will also be taken from here if neither DEBFULLNAME nor NAME is set.
This commit removes support for the "name <email> 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 <masahiroy@kernel.org>
---
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 <email>
-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
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH v2 2/3] kbuild: deb-pkg: remove support for "name <email>" form for DEBEMAIL
2024-07-02 18:02 ` [PATCH v2 2/3] kbuild: deb-pkg: remove support for "name <email>" form for DEBEMAIL Masahiro Yamada
@ 2024-07-03 15:06 ` Masahiro Yamada
2024-07-04 9:28 ` Nicolas Schier
0 siblings, 1 reply; 8+ messages in thread
From: Masahiro Yamada @ 2024-07-03 15:06 UTC (permalink / raw)
To: linux-kbuild
Cc: linux-kernel, Nathan Chancellor, Nicolas Schier, riku.voipio,
Ben Hutchings
+CC
On Wed, Jul 3, 2024 at 3:03 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> Commit d5940c60e057 ("kbuild: deb-pkg improve maintainer address
> generation") supported the "name <email>" form for DEBEMAIL, with
> behavior slightly different from devscripts.
>
> In Kbuild, if DEBEMAIL has the form "name <email>", 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 <email>", then the maintainer name
> will also be taken from here if neither DEBFULLNAME nor NAME is set.
>
> This commit removes support for the "name <email> 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 <masahiroy@kernel.org>
> ---
>
> 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 <email>
> -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
> --
> 2.43.0
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH v2 2/3] kbuild: deb-pkg: remove support for "name <email>" form for DEBEMAIL
2024-07-03 15:06 ` Masahiro Yamada
@ 2024-07-04 9:28 ` Nicolas Schier
0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Schier @ 2024-07-04 9:28 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, linux-kernel, Nathan Chancellor, riku.voipio,
Ben Hutchings
On Thu, Jul 04, 2024 at 12:06:13AM +0900, Masahiro Yamada wrote:
> +CC
>
>
>
> On Wed, Jul 3, 2024 at 3:03 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > Commit d5940c60e057 ("kbuild: deb-pkg improve maintainer address
> > generation") supported the "name <email>" form for DEBEMAIL, with
> > behavior slightly different from devscripts.
> >
> > In Kbuild, if DEBEMAIL has the form "name <email>", 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 <email>", then the maintainer name
> > will also be taken from here if neither DEBFULLNAME nor NAME is set.
> >
> > This commit removes support for the "name <email> 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 <masahiroy@kernel.org>
> > ---
> >
> > 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 <email>
> > -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
> > --
> > 2.43.0
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 3/3] kbuild: package: add -e and -u options to some shell scripts
2024-07-02 18:02 [PATCH v2 1/3] kbuild: deb-pkg: remove support for EMAIL environment variable Masahiro Yamada
2024-07-02 18:02 ` [PATCH v2 2/3] kbuild: deb-pkg: remove support for "name <email>" form for DEBEMAIL Masahiro Yamada
@ 2024-07-02 18:02 ` Masahiro Yamada
2024-07-03 14:57 ` [PATCH v2 1/3] kbuild: deb-pkg: remove support for EMAIL environment variable Masahiro Yamada
2024-07-03 16:33 ` Masahiro Yamada
3 siblings, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2024-07-02 18:02 UTC (permalink / raw)
To: linux-kbuild
Cc: linux-kernel, Masahiro Yamada, Nicolas Schier, Nathan Chancellor
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 <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
---
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 <wichert@wiggy.net>.
#
-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 <opencon@rio.skydome.net>
#
+set -eu
+
output=$1
mkdir -p "$(dirname "${output}")"
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH v2 1/3] kbuild: deb-pkg: remove support for EMAIL environment variable
2024-07-02 18:02 [PATCH v2 1/3] kbuild: deb-pkg: remove support for EMAIL environment variable Masahiro Yamada
2024-07-02 18:02 ` [PATCH v2 2/3] kbuild: deb-pkg: remove support for "name <email>" form for DEBEMAIL Masahiro Yamada
2024-07-02 18:02 ` [PATCH v2 3/3] kbuild: package: add -e and -u options to some shell scripts Masahiro Yamada
@ 2024-07-03 14:57 ` Masahiro Yamada
2024-07-04 9:26 ` Nicolas Schier
2024-07-03 16:33 ` Masahiro Yamada
3 siblings, 1 reply; 8+ messages in thread
From: Masahiro Yamada @ 2024-07-03 14:57 UTC (permalink / raw)
To: linux-kbuild
Cc: linux-kernel, Nathan Chancellor, Nicolas Schier, Riku Voipio,
Ben Hutchings
(+CC more Debian developers)
On Wed, Jul 3, 2024 at 3:03 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> 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 <masahiroy@kernel.org>
> ---
>
> 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 <email>
> if echo "${email}" | grep -q '<.*>'; then
> --
> 2.43.0
>
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH v2 1/3] kbuild: deb-pkg: remove support for EMAIL environment variable
2024-07-03 14:57 ` [PATCH v2 1/3] kbuild: deb-pkg: remove support for EMAIL environment variable Masahiro Yamada
@ 2024-07-04 9:26 ` Nicolas Schier
0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Schier @ 2024-07-04 9:26 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, linux-kernel, Nathan Chancellor, Riku Voipio,
Ben Hutchings
On Wed, Jul 03, 2024 at 11:57:44PM +0900, Masahiro Yamada wrote:
> (+CC more Debian developers)
>
>
> On Wed, Jul 3, 2024 at 3:03 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > 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 <masahiroy@kernel.org>
> > ---
> >
> > 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 <email>
> > if echo "${email}" | grep -q '<.*>'; then
> > --
> > 2.43.0
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/3] kbuild: deb-pkg: remove support for EMAIL environment variable
2024-07-02 18:02 [PATCH v2 1/3] kbuild: deb-pkg: remove support for EMAIL environment variable Masahiro Yamada
` (2 preceding siblings ...)
2024-07-03 14:57 ` [PATCH v2 1/3] kbuild: deb-pkg: remove support for EMAIL environment variable Masahiro Yamada
@ 2024-07-03 16:33 ` Masahiro Yamada
3 siblings, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2024-07-03 16:33 UTC (permalink / raw)
To: Linux Kbuild mailing list
Cc: linux-kernel, Nathan Chancellor, Nicolas Schier, riku.voipio,
Ben Hutchings
+CC
On Wed, Jul 3, 2024 at 3:03 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> 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 <masahiroy@kernel.org>
> ---
>
> 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 <email>
> if echo "${email}" | grep -q '<.*>'; then
> --
> 2.43.0
>
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 8+ messages in thread