From: Riku Voipio Date: Mon, 7 May 2018 07:11:34 +0000 (+0300) Subject: kbuild: deb-pkg improve maintainer address generation X-Git-Tag: v4.19~884^2~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d5940c60e0575ad666132a612a73e6597f90d4c3;p=platform%2Fkernel%2Flinux-rpi.git 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 " - 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 Signed-off-by: Riku Voipio Signed-off-by: Masahiro Yamada --- diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 6adb3a1..985d72d 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -71,22 +71,21 @@ if [ "$ARCH" = "um" ] ; then packagename=user-mode-linux-$version fi -# Try to determine maintainer and email values -if [ -n "$DEBEMAIL" ]; then - email=$DEBEMAIL -elif [ -n "$EMAIL" ]; then - email=$EMAIL -else - email=$(id -nu)@$(hostname -f 2>/dev/null || hostname) -fi -if [ -n "$DEBFULLNAME" ]; then - name=$DEBFULLNAME -elif [ -n "$NAME" ]; then - name=$NAME +email=${DEBEMAIL-$EMAIL} + +# use email string directly if it contains +if echo $email | grep -q '<.*>'; then + maintainer=$email else - name="Anonymous" + # 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>" fi -maintainer="$name <$email>" # Try to determine distribution if [ -n "$KDEB_CHANGELOG_DIST" ]; then