From patchwork Mon May 7 07:11:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 10383335 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5B3C960159 for ; Mon, 7 May 2018 07:11:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45AA228823 for ; Mon, 7 May 2018 07:11:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39A8F28844; Mon, 7 May 2018 07:11:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE39B28823 for ; Mon, 7 May 2018 07:11:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750996AbeEGHLy (ORCPT ); Mon, 7 May 2018 03:11:54 -0400 Received: from mail-lf0-f48.google.com ([209.85.215.48]:32955 "EHLO mail-lf0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750795AbeEGHLx (ORCPT ); Mon, 7 May 2018 03:11:53 -0400 Received: by mail-lf0-f48.google.com with SMTP id m18-v6so39041713lfb.0 for ; Mon, 07 May 2018 00:11:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=ljZqVF8KDzGEgNYUjFaQhsSk+RJcuOACsB12w5MJiz8=; b=gD/GBpkg+/vQDznDaBBDiemWO9KDm6GZkS8ZLKw2AqovCUYeyRKtDbE/KBq8JrXJnU nEnc3svyqWGALkI5R+cH3ssptbLAc9D0iHQC8RrLwocisJHIyoVLJgzzUZyjF/Pp9T0L w1GvALDKCmmLFDR4pC0RWk8/WpIIl7c5G/Iag= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ljZqVF8KDzGEgNYUjFaQhsSk+RJcuOACsB12w5MJiz8=; b=i1fCEdySvvpAgcMKTZUqYbjsPVZ4EYwIuJRmTr2a2qnQekEWDHdA6AsQMuRHxpGwUu RVpdggNrlk85eOaBlRXfl7sa3RdC3XaY4qtPgdhs4YBF1LNmTxfL+Cd60ymACvkZJEbZ ek2S8B/AJu+HSJZFcADD3QSbGJXgeG1ZrL2UOPn7AjKkv7cWuR7uAIwXoRZan1Lo816B lO5Dr5HVydMaU2KLARNUsedMTdiw5SeiZCPR4VbWl9QjKUbJif5xSp6pgYJxQ01h8KJs +31aff8HFxFphe2n+nkNAE/taBKG8N7UWCWgGDtxa4mfceOs7x4NmHc/YfrE+4g+q1Bm E8AA== X-Gm-Message-State: ALKqPwcyJ0kG6vxEvGPpRa6D+aU7x2jb2XCRlN1/TyK4Asy39mxp3dLq AmxZhBXWNhhGeP1pgl/0Z/h5WIXfQew= X-Google-Smtp-Source: AB8JxZp2zmsvfVzi0PL0wOw9povI60s1j2yGd28JA2H1YxAu8r0y+vQM2tutRbUmH1TP8BVOESayvw== X-Received: by 2002:a2e:9816:: with SMTP id a22-v6mr219815ljj.27.1525677111982; Mon, 07 May 2018 00:11:51 -0700 (PDT) Received: from beaming.home (91-154-20-92.elisa-laajakaista.fi. [91.154.20.92]) by smtp.gmail.com with ESMTPSA id z78-v6sm3886741lje.11.2018.05.07.00.11.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 May 2018 00:11:50 -0700 (PDT) From: riku.voipio@linaro.org To: linux-kbuild@vger.kernel.org, Masahiro Yamada Cc: debian-kernel@lists.debian.org, malat@debian.org, Riku Voipio Subject: [PATCH v2] kbuild: deb-pkg improve maintainer address generation Date: Mon, 7 May 2018 10:11:34 +0300 Message-Id: <20180507071134.5213-1-riku.voipio@linaro.org> X-Mailer: git-send-email 2.14.2 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Riku Voipio 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 --- v2: include improvements suggested by Masahiro-san scripts/package/mkdebian | 27 +++++++++++++-------------- 1 file 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 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