Skip to contentSkip to conversation

kbuild: deb-pkg: remove support for EMAIL environment variable

PATCH In review Masahiro Yamada 2 participants 8 messages Jul 2, 2024 – Jul 4, 2024 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 kbuild: deb-pkg: remove support for EMAIL environment variable

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.

---

Changes in v2:
- New patch

 scripts/package/mkdebian | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/package/mkdebian +1 -1
index b9a5b789c655..589f92b88c42 100755
@@ -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
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 2/3 kbuild: deb-pkg: remove support for "name <email>" form for DEBEMAIL

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

---

Changes in v2:
- New patch

 scripts/package/mkdebian | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
scripts/package/mkdebian +7 -13
index 589f92b88c42..83c6636fadb8 100755
@@ -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
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v2 2/3] kbuild: deb-pkg: remove support for "name <email>" form for DEBEMAIL

+CC

Quoted 70 lines · Masahiro Yamada

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

---

Changes in v2:
- New patch

 scripts/package/mkdebian | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
scripts/package/mkdebian +7 -14
index 589f92b88c42..83c6636fadb8 100755
@@ -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

Signature · 2 lines
Best Regards
Masahiro Yamada
Reviewed-by
#3 lore raw

Re: [PATCH v2 2/3] kbuild: deb-pkg: remove support for "name <email>" form for DEBEMAIL

Quoted 70 lines · Masahiro Yamada

+CC

Quoted 65 lines · Masahiro Yamada

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

---

Changes in v2:
- New patch

 scripts/package/mkdebian | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
scripts/package/mkdebian +7 -13
index 589f92b88c42..83c6636fadb8 100755
@@ -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}>"
 
Quoted 4 lines
Quoted 4 lines
scripts/package/mkdebian +0 -1
 if [ "$1" = --need-source ]; then
        gen_source
--

2.43.0

#4 lore raw

PATCH v2 3/3 kbuild: package: add -e and -u options to some shell scripts

In reply to Masahiro Yamada

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

---

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(-)
scripts/package/builddeb +1 -1
index e797ad360f7a..c1757db6aa8a 100755
@@ -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
scripts/package/buildtar +1 -1
index eb67787f8673..cc87a473c01f 100755
@@ -11,7 +11,7 @@
 # Wichert Akkerman <[email protected]>.
 #
 
-set -e
+set -eu
 
 #
 # Some variables and settings used throughout the script
scripts/package/gen-diff-patch +2 -0
index 8a98b7bb78a0..f272f7770ea3 100755
@@ -1,6 +1,8 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-only
 
+set -eu
+
 diff_patch=$1
 
 mkdir -p "$(dirname "${diff_patch}")"
scripts/package/install-extmod-build +1 -4
index 76e0765dfcd6..8cc9e13403ae 100755
@@ -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
 }
scripts/package/mkdebian +4 -4
index 83c6636fadb8..0cc1913aad30 100755
@@ -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
scripts/package/mkspec +2 -0
index cffc2567bef2..77d25dda37e3 100755
@@ -9,6 +9,8 @@
 #	Patched for non-x86 by Opencon (L) 2002 <[email protected]>
 #
 
+set -eu
+
 output=$1
 
 mkdir -p "$(dirname "${output}")"
Signature · 1 line
2.43.0
#5 lore raw
In reply to Masahiro Yamada

(+CC more Debian developers)

Quoted 39 lines · Masahiro Yamada

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.

---

Changes in v2:
- New patch

 scripts/package/mkdebian | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/package/mkdebian +1 -2
index b9a5b789c655..589f92b88c42 100755
@@ -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

Signature · 2 lines
Best Regards
Masahiro Yamada
Reviewed-by
#6 lore raw
Quoted 34 lines · Masahiro Yamada

(+CC more Debian developers)

Quoted 30 lines · Masahiro Yamada

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.

---

Changes in v2:
- New patch

 scripts/package/mkdebian | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/package/mkdebian +0 -0
index b9a5b789c655..589f92b88c42 100755
@@ -125,7 +125,7 @@ gen_source ()
 rm -rf debian
 mkdir debian
 
Quoted 7 lines
Quoted 7 lines
scripts/package/mkdebian +1 -2
-email=${DEBEMAIL-$EMAIL}
+email=${DEBEMAIL}
 
 # use email string directly if it contains <email>
 if echo "${email}" | grep -q '<.*>'; then
--

2.43.0

#7 lore raw
In reply to Masahiro Yamada

+CC

Quoted 39 lines · Masahiro Yamada

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.

---

Changes in v2:
- New patch

 scripts/package/mkdebian | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/package/mkdebian +1 -2
index b9a5b789c655..589f92b88c42 100755
@@ -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

Signature · 2 lines
Best Regards
Masahiro Yamada