Skip to contentSkip to conversation

kbuild/debian: Use KBUILD_BUILD_* when set

PATCH Superseded Mathieu Malaterre 3 participants 8 messages Apr 23, 2018 – May 3, 2018 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild/debian: Use KBUILD_BUILD_* when set

Be nice to the user and check env vars KBUILD_BUILD_USER & KBUILD_BUILD_HOST when those are set.

---
 scripts/package/mkdebian | 2 ++
 1 file changed, 2 insertions(+)
scripts/package/mkdebian +2 -0
index 6adb3a16ba3b..05d58d3ae8a0 100755
@@ -76,6 +76,8 @@ if [ -n "$DEBEMAIL" ]; then
        email=$DEBEMAIL
 elif [ -n "$EMAIL" ]; then
        email=$EMAIL
+elif [ -n "$KBUILD_BUILD_USER" ] && [ -n "$KBUILD_BUILD_HOST" ]; then
+       email=$KBUILD_BUILD_USER@$KBUILD_BUILD_HOST
 else
        email=$(id -nu)@$(hostname -f 2>/dev/null || hostname)
 fi
Signature · 1 line
2.11.0
#1 lore raw
Quoted 2 lines · Mathieu Malaterre

Be nice to the user and check env vars KBUILD_BUILD_USER & KBUILD_BUILD_HOST when those are set.

mkdebian sets the maintainer address as "$name <$email>", but this patch only sets the email part. I also wonder about the precedence, I think KBUILD_* should be considered over the generic Debian variables.

Riku

Quoted 25 lines
---
 scripts/package/mkdebian | 2 ++
 1 file changed, 2 insertions(+)
scripts/package/mkdebian +2 -1
index 6adb3a16ba3b..05d58d3ae8a0 100755
@@ -76,6 +76,8 @@ if [ -n "$DEBEMAIL" ]; then
        email=$DEBEMAIL
 elif [ -n "$EMAIL" ]; then
        email=$EMAIL
+elif [ -n "$KBUILD_BUILD_USER" ] && [ -n "$KBUILD_BUILD_HOST" ]; then
+       email=$KBUILD_BUILD_USER@$KBUILD_BUILD_HOST
 else
        email=$(id -nu)@$(hostname -f 2>/dev/null || hostname)
 fi
--

2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

2018-05-02 20:30 GMT+09:00 Riku Voipio <[email protected]>:

Quoted 7 lines · Mathieu Malaterre
Quoted 2 lines

Be nice to the user and check env vars KBUILD_BUILD_USER & KBUILD_BUILD_HOST when those are set.

mkdebian sets the maintainer address as "$name <$email>", but this patch only sets the email part. I also wonder about the precedence, I think KBUILD_* should be considered over the generic Debian variables.

How come?

If you see scripts/mkcompile_h, KBUILD_BUILD_USER and KBUILD_BUILD_HOST are used for overriding 'whoami' and 'hostname', respectively.

So, I think it is reasonable to put

email=$KBUILD_BUILD_USER@$KBUILD_BUILD_HOST

over

  email=$(id -nu)@$(hostname -f 2>/dev/null || hostname)

But, it is questionable to put it even over $DEBEMAIL.

I think the intention of this patch is to support another (a bit better) fallback in case DEBEMAIL is not set.

Quoted 31 lines

Riku

Quoted 21 lines
---
 scripts/package/mkdebian | 2 ++
 1 file changed, 2 insertions(+)
scripts/package/mkdebian +2 -1
index 6adb3a16ba3b..05d58d3ae8a0 100755
@@ -76,6 +76,8 @@ if [ -n "$DEBEMAIL" ]; then
        email=$DEBEMAIL
 elif [ -n "$EMAIL" ]; then
        email=$EMAIL
+elif [ -n "$KBUILD_BUILD_USER" ] && [ -n "$KBUILD_BUILD_HOST" ]; then
+       email=$KBUILD_BUILD_USER@$KBUILD_BUILD_HOST
 else
        email=$(id -nu)@$(hostname -f 2>/dev/null || hostname)
 fi
--

2.11.0

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw
In reply to Riku Voipio
Quoted 7 lines · Riku Voipio
Quoted 2 lines · Mathieu Malaterre

Be nice to the user and check env vars KBUILD_BUILD_USER & KBUILD_BUILD_HOST when those are set.

mkdebian sets the maintainer address as "$name <$email>", but this patch only sets the email part. I also wonder about the precedence, I think KBUILD_* should be considered over the generic Debian variables.

I simply tried to re-use the KBUILD_* env vars whenever possible. This did made sense, since:

$ dmesg|grep debian
                                                                  ~
[    0.000000] Linux version 4.14.0-0.bpo.3-amd64
([email protected]) (gcc version 6.3.0 20170516 (Debian
6.3.0-18)) #1 SMP Debian 4.14.13-1~bpo9+1 (2018-01-14)

and

$ apt-cache show linux-image-amd64| grep Main
                                                                  ~
Maintainer: Debian Kernel Team <[email protected]>

I do not believe this should take precedence over DEBEMAIL.

Quoted 27 lines

Riku

Quoted 25 lines
---
 scripts/package/mkdebian | 2 ++
 1 file changed, 2 insertions(+)
scripts/package/mkdebian +2 -1
index 6adb3a16ba3b..05d58d3ae8a0 100755
@@ -76,6 +76,8 @@ if [ -n "$DEBEMAIL" ]; then
        email=$DEBEMAIL
 elif [ -n "$EMAIL" ]; then
        email=$EMAIL
+elif [ -n "$KBUILD_BUILD_USER" ] && [ -n "$KBUILD_BUILD_HOST" ]; then
+       email=$KBUILD_BUILD_USER@$KBUILD_BUILD_HOST
 else
        email=$(id -nu)@$(hostname -f 2>/dev/null || hostname)
 fi
--

2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 18 lines · Mathieu Malaterre
Quoted 7 lines · Riku Voipio
Quoted 2 lines · Mathieu Malaterre

Be nice to the user and check env vars KBUILD_BUILD_USER & KBUILD_BUILD_HOST when those are set.

mkdebian sets the maintainer address as "$name <$email>", but this patch only sets the email part. I also wonder about the precedence, I think KBUILD_* should be considered over the generic Debian variables.

I simply tried to re-use the KBUILD_* env vars whenever possible. This did made sense, since:

$ dmesg|grep debian
                                                                  ~
[    0.000000] Linux version 4.14.0-0.bpo.3-amd64
([email protected]) (gcc version 6.3.0 20170516 (Debian
6.3.0-18)) #1 SMP Debian 4.14.13-1~bpo9+1 (2018-01-14)
Quoted 7 lines

and

$ apt-cache show linux-image-amd64| grep Main
                                                                  ~
Maintainer: Debian Kernel Team <[email protected]>

I do not believe this should take precedence over DEBEMAIL.

It seems that the env var DEBEMAIL is now accepting a new syntax (at least I was not aware of this syntax):

https://manpages.debian.org/unstable/devscripts/dch.1.en.html

[...]If the environment variable DEBEMAIL is set, this will be used for the email address. If this variable has the form "name <email>", then the maintainer name will also be taken from here[...]

I'll send a v2 that check DEBEMAIL does not contains '<>'.

Quoted 27 lines
Quoted 27 lines

Riku

Quoted 25 lines
---
 scripts/package/mkdebian | 2 ++
 1 file changed, 2 insertions(+)
scripts/package/mkdebian +2 -1
index 6adb3a16ba3b..05d58d3ae8a0 100755
@@ -76,6 +76,8 @@ if [ -n "$DEBEMAIL" ]; then
        email=$DEBEMAIL
 elif [ -n "$EMAIL" ]; then
        email=$EMAIL
+elif [ -n "$KBUILD_BUILD_USER" ] && [ -n "$KBUILD_BUILD_HOST" ]; then
+       email=$KBUILD_BUILD_USER@$KBUILD_BUILD_HOST
 else
        email=$(id -nu)@$(hostname -f 2>/dev/null || hostname)
 fi
--

2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

PATCH v2 1/1 kbuild/debian: Use KBUILD_BUILD_* when set

In reply to Mathieu Malaterre

Be nice to the user and check env vars KBUILD_BUILD_USER & KBUILD_BUILD_HOST when those are set.

Since DEBEMAIL accept a syntax where the full name is present, be extra nice to user and extract email address only.

Cc Riku Voipio <[email protected]>
Cc Masahiro Yamada <[email protected]>

---
v2: update patch since syntax of DEBEMAIL may contain full name

 scripts/package/mkdebian | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
scripts/package/mkdebian +11 -1
index 6adb3a16ba3b..3f4e43446db3 100755
@@ -73,9 +73,19 @@ fi
 
 # Try to determine maintainer and email values
 if [ -n "$DEBEMAIL" ]; then
-       email=$DEBEMAIL
+       case "$DEBEMAIL" in
+         *\ * )
+           email=$(echo $DEBEMAIL | cut -d '<' -f2 | cut -d '>' -f1)
+           echo >&2 "Extracting email from DEBEMAIL. Use DEBFULLNAME instead."
+           ;;
+         *)
+           email=$DEBEMAIL
+           ;;
+       esac
 elif [ -n "$EMAIL" ]; then
        email=$EMAIL
+elif [ -n "$KBUILD_BUILD_USER" ] && [ -n "$KBUILD_BUILD_HOST" ]; then
+       email=$KBUILD_BUILD_USER@$KBUILD_BUILD_HOST
 else
        email=$(id -nu)@$(hostname -f 2>/dev/null || hostname)
 fi
Signature · 1 line
2.11.0
#6 lore raw
Quoted 19 lines · Mathieu Malaterre

Be nice to the user and check env vars KBUILD_BUILD_USER & KBUILD_BUILD_HOST when those are set.

Since DEBEMAIL accept a syntax where the full name is present, be extra nice to user and extract email address only.

Cc Riku Voipio <[email protected]>
Cc Masahiro Yamada <[email protected]>

---
v2: update patch since syntax of DEBEMAIL may contain full name

 scripts/package/mkdebian | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
scripts/package/mkdebian +0 -0
index 6adb3a16ba3b..3f4e43446db3 100755

scripts/package/mkdebian fi · line 78

Quoted 7 lines
scripts/package/mkdebian +3 -1
@@ -73,9 +73,19 @@ fi
 
 # Try to determine maintainer and email values
 if [ -n "$DEBEMAIL" ]; then
-       email=$DEBEMAIL
+       case "$DEBEMAIL" in
+         *\ * )
+           email=$(echo $DEBEMAIL | cut -d '<' -f2 | cut -d '>' -f1)

Why go through all the trouble of deconstructing the string and then reassemble it a few lines down in the script?

I'll submit an alternative way to handle the Maintainer address setting.

Quoted 16 lines
scripts/package/mkdebian +8 -1
+           echo >&2 "Extracting email from DEBEMAIL. Use DEBFULLNAME instead."
+           ;;
+         *)
+           email=$DEBEMAIL
+           ;;
+       esac
 elif [ -n "$EMAIL" ]; then
        email=$EMAIL
+elif [ -n "$KBUILD_BUILD_USER" ] && [ -n "$KBUILD_BUILD_HOST" ]; then
+       email=$KBUILD_BUILD_USER@$KBUILD_BUILD_HOST
 else
        email=$(id -nu)@$(hostname -f 2>/dev/null || hostname)
 fi
--

2.11.0

#7 lore raw
In reply to Mathieu Malaterre
Quoted 11 lines · Mathieu Malaterre

Be nice to the user and check env vars KBUILD_BUILD_USER & KBUILD_BUILD_HOST when those are set.

Since DEBEMAIL accept a syntax where the full name is present, be extra nice to user and extract email address only.

Cc Riku Voipio <[email protected]>
Cc Masahiro Yamada <[email protected]>

---
v2: update patch since syntax of DEBEMAIL may contain full name

Should be replaced by:

https://lists.debian.org/debian-kernel/2018/05/msg00029.html

Quoted 31 lines
 scripts/package/mkdebian | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
scripts/package/mkdebian +11 -2
index 6adb3a16ba3b..3f4e43446db3 100755
@@ -73,9 +73,19 @@ fi
 
 # Try to determine maintainer and email values
 if [ -n "$DEBEMAIL" ]; then
-       email=$DEBEMAIL
+       case "$DEBEMAIL" in
+         *\ * )
+           email=$(echo $DEBEMAIL | cut -d '<' -f2 | cut -d '>' -f1)
+           echo >&2 "Extracting email from DEBEMAIL. Use DEBFULLNAME instead."
+           ;;
+         *)
+           email=$DEBEMAIL
+           ;;
+       esac
 elif [ -n "$EMAIL" ]; then
        email=$EMAIL
+elif [ -n "$KBUILD_BUILD_USER" ] && [ -n "$KBUILD_BUILD_HOST" ]; then
+       email=$KBUILD_BUILD_USER@$KBUILD_BUILD_HOST
 else
        email=$(id -nu)@$(hostname -f 2>/dev/null || hostname)
 fi
--

2.11.0