summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRiku Voipio <riku.voipio@linaro.org>2018-05-07 03:11:34 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-05-17 09:38:15 -0400
commitd5940c60e0575ad666132a612a73e6597f90d4c3 (patch)
treee44cc0c41f20979fb92a29f59eec815fd35955fb /scripts
parentb3aa58d2e85d5253a35a81320ae4d63ba6a482f0 (diff)
kbuild: deb-pkg improve maintainer address generation
There is multiple issues with the genaration of maintainer string It uses DEBEMAIL and EMAIL enviroment variables, which may contain angle brackets, creating invalid maintainer strings. The documented KBUILD_BUILD_USER and KBUILD_BUILD_HOST variables are not used. Undocumented and uncommon NAME variable is used. Refactor the Maintainer string to: - use EMAIL or DEBEMAIL directly if they are in form "name <user@host>" - use KBUILD_BUILD_USER and KBUILD_BUILD_HOST if set before falling back to autodetection - no longer use NAME variable or the useless Anonymous string The logic is switched from multiline if/then/fi statements to compact shell variable substition commands. Reported-by: Mathieu Malaterre <malat@debian.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/package/mkdebian27
1 files changed, 13 insertions, 14 deletions
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index 6adb3a16ba3b..985d72d1ab34 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -71,22 +71,21 @@ if [ "$ARCH" = "um" ] ; then
71 packagename=user-mode-linux-$version 71 packagename=user-mode-linux-$version
72fi 72fi
73 73
74# Try to determine maintainer and email values 74email=${DEBEMAIL-$EMAIL}
75if [ -n "$DEBEMAIL" ]; then 75
76 email=$DEBEMAIL 76# use email string directly if it contains <email>
77elif [ -n "$EMAIL" ]; then 77if echo $email | grep -q '<.*>'; then
78 email=$EMAIL 78 maintainer=$email
79else
80 email=$(id -nu)@$(hostname -f 2>/dev/null || hostname)
81fi
82if [ -n "$DEBFULLNAME" ]; then
83 name=$DEBFULLNAME
84elif [ -n "$NAME" ]; then
85 name=$NAME
86else 79else
87 name="Anonymous" 80 # or construct the maintainer string
81 user=${KBUILD_BUILD_USER-$(id -nu)}
82 name=${DEBFULLNAME-$user}
83 if [ -z "$email" ]; then
84 buildhost=${KBUILD_BUILD_HOST-$(hostname -f 2>/dev/null || hostname)}
85 email="$user@$buildhost"
86 fi
87 maintainer="$name <$email>"
88fi 88fi
89maintainer="$name <$email>"
90 89
91# Try to determine distribution 90# Try to determine distribution
92if [ -n "$KDEB_CHANGELOG_DIST" ]; then 91if [ -n "$KDEB_CHANGELOG_DIST" ]; then