From patchwork Tue Oct 27 10:30:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1388413 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=QRyLE3ue; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CL7JM5hfdz9sSf for ; Tue, 27 Oct 2020 21:30:27 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 430B1823E3; Tue, 27 Oct 2020 11:30:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="QRyLE3ue"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6CCDE82364; Tue, 27 Oct 2020 11:30:22 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02on0722.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::722]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 121DC82364 for ; Tue, 27 Oct 2020 11:30:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YD+3sRRqP5XDFHvqN5hydRRt9xLWaiHlwkefFoUKGu/y/kRuaHiBg6K7Vdgc4tWczUjliah7UPfxBn8GU24aUNljAujAT0NTwaZfW/HvpUJbtxRQbOjF7UP/uidlBEXRCyrCnyTtFtjbKutiiuK0WF773EQaBv+YRRzlFFyuSOb4EBO2lRketNdHKy969hCXTC2wzpWdo7sKvb0CR+Z1apZdj2rLcisgE9qXfiHf6nZdyZji33oRd4OW5Ntj9MrPyHm8zlSCMD4ILBFPG7z5tUatp93nG1XX7LAuji//fRwqRKe6P8pIDQ1HyKRQSpWQ/2lYIaUPx4ArjBVH7PG54w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b6ONG6xW1x/DBcabSnO4jnPPjHftiL1E1+z0v1sTSxk=; b=E+TCMh8UGtPwDMX6vUlMtktwc4LEZSYWTfvqfdTu/zYWY5lg7ao0A1yVNUeOYNXIYe3IGvgHqv97+TKiQVOayFN7OLW4g3iXeywgV0RHvEuzdzboPfvH8P3ZtMgxVdbQ/YU7KHE0VpN0CBwbfcEvdE539+i+RUn722BsNFRjtbMyYHariohchXED4xyzGzNWxxD76pInnvkoIbeDyDuViW0KFxM2V02LGM5wh7WGry2F1rSw4Sal4Ys4t+RM5xg74U6xFJebhfzyegFPXQYeZ24E3iqn1nrJOfMcxYkHeoGzE6hvKUdVu4ml6ksiB4JtQtPT5IVR4wAoDJyoqmf+Ow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b6ONG6xW1x/DBcabSnO4jnPPjHftiL1E1+z0v1sTSxk=; b=QRyLE3ueog/DCCy83dlZbMiy6R7CWfosdGuNPnQxGbAGF+AJ4FjdSlF/q70FyKIndqB4BDKzX7op+EytZJ3HlaEu/4pmDqowFG5dPi4mgZc+NfyoE5eNR0Nl9OP9t8PVjsJSjD3CXE0P5uPZqJZr8Vz+Nc3ufIRGyLc6HbC6xhQ= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM9PR10MB4232.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:1cc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Tue, 27 Oct 2020 10:30:16 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9dc3:9785:dc4e:ad62]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9dc3:9785:dc4e:ad62%6]) with mapi id 15.20.3477.028; Tue, 27 Oct 2020 10:30:16 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Philipp Tomsich , Tom Rini , Rasmus Villemoes Subject: [RFC PATCH] scripts/setlocalversion: avoid keeping double-quotes in UBOOTRELEASE Date: Tue, 27 Oct 2020 11:30:06 +0100 Message-Id: <20201027103006.27772-1-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 X-Originating-IP: [81.216.59.226] X-ClientProxiedBy: AM0PR01CA0091.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::32) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (81.216.59.226) by AM0PR01CA0091.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Tue, 27 Oct 2020 10:30:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f856c3ec-55cd-45bd-17a3-08d87a634bb5 X-MS-TrafficTypeDiagnostic: AM9PR10MB4232: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mCBarw2bSInjm9FNNjXJdnsyQOYKTC/GBIDmvu93sFRyvEsfE+7+zDWrp1pAm0T7VYAwyUoOsKjecNWFRSHAYTKLsdaOoGNwYLDUtmuV8FVbqqa8eChaptVN4pMwZW4wIh1VWmcOv0u49EPwfCp4OvN5KVLc+gQAPS70kJZFtnICt03gX65RDIrHMZtPBo/xmDf4F3LMuEbLcEB1NxAkFivRKOJhDtMTZ1ilzICMchngiQ0ZcKlZzSkn9NXFnziDPJdq//rwe29nRC32f/U9WLMvoxX6fxdM3XvYFHi2zr0/UCUwV4RxWoShcPb3voQ3lkcOSY2YrvI9L6Qczf+DVw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(396003)(346002)(376002)(136003)(39850400004)(366004)(66476007)(26005)(186003)(4326008)(66556008)(6512007)(1076003)(86362001)(6666004)(956004)(36756003)(2616005)(5660300002)(478600001)(8976002)(44832011)(66946007)(8936002)(6916009)(316002)(83380400001)(107886003)(54906003)(8676002)(6486002)(52116002)(6506007)(2906002)(16526019); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: xabFGOE3khie835rl3gxMy+qcqyXj8w6Ml4KFDaVYxR6zRhUdjHXWVcfK4Va1H9f7A3VeVrV1ocFSmxupAn/MkABTqiX+VPkG5BeeoBeytYvKXeOKK7jFBhPypggwPwUvpd0uQD9IIyLfBE6Ah4TGV/tqKIdOvF4kIU76WOXiS1X5af/sihm/gFumsfrdT19RTutkhsXIthqAdOd8KRWtbtla99Bms13wIpG8Aig4AU04cMb1q8ln+JpClzc8HDen+6QE4T+RMtETDnYv4jc7W21uUCtIq+E+9P7U5QuN2So8iYAGs890pLn/jWJv8T8W85EPsahjC8V30v4LXu2seA7JovI/5TVn1JnzRoPWv/J3wwkBzzla7utRYLjBcr1kaqRTgTQgZtcBrimfu4IgbuVQhcgxGQFjAUdM1A5ixe4uZeKOkdLupv0eWDS7H699NdO7lfR6gjWYuca3cLeLGL5Ai4H5XpnQJXV8pHi1V//ZA6npyAGAnLB0Dfx+wm46YJeEMXAMMrnl0Be8IGU4tCVsGMk07nBAToaNPHIa1jk6n/HZdzjeXM0hcrQOfi9HbALhome2aLT04EbnUzl2tDWKC5QhELZjpisJL0tS+xlTWAq/R5gSypCu9TiCTm3Kv7yIdzigwxRPc4dngrbew== X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: f856c3ec-55cd-45bd-17a3-08d87a634bb5 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2020 10:30:16.5054 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OM1ZgdaWg/3g5cABaw3ss/Gh2qFOazGQDuMfiCvg4hemkuJDOhsY6DET9WEqFipAETKQgD938SjkX9BdXo/sNz5JMgrKLcXGDeiLEQqBMbU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR10MB4232 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean CONFIG_LOCALVERSION is a string Kconfig item, so auto.conf always contains a line of the form CONFIG_LOCALVERSION="foo" (usually with nothing between the quotes). Since 81630a3b (scripts: setlocalversion: safely extract variables from auto.conf using awk), those quotes are no longer automatically stripped as part of the shell sourcing auto.conf, so they get included in the value of the shell variable CONFIG_LOCALVERSION, which in turn then bleeds to the output and to include/config/uboot.release, which contains 2020.10"foo"-00879-gae4fdd7b04 They are still present in the value of the UBOOTRELEASE make variable. When that variable is used to generate version_autogenerated.h, we end up running the command echo \#define PLAIN_VERSION \"2020.10"foo"-00879-gae4fdd7b04\" via the shell, and thus the quotes do finally get stripped via the shell's rule for concatenating words (in essence, the evaluation by a shell has been postponed till that point). However, UBOOTRELEASE is also used in a few other places, e.g. -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" so that expands to -n "U-Boot 2020.10"foo"-00879-gae4fdd7b04 for $(BOARD) board" which (still) works, but mostly by chance. To avoid those quotes from appearing in uboot.release and causing confusion when one tries to debug things, and to get closer to how Linux' setlocalversion works, while still avoiding evaluating the lines that may contain $() constructs, grep for the few lines we're interested in and eval those. Signed-off-by: Rasmus Villemoes --- This is not really meant for applying, hence RFC. I hope to be able to get U-Boot's and linux' copies completely in sync (since the last sync a few weeks ago, 548b8b51 has landed in linux), so if this is ok in principle, I'll try submitting the similar patch on the linux side, and if that's accepted, we can do another sync after that. scripts/setlocalversion | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/setlocalversion b/scripts/setlocalversion index c1c0435267..8484bea07f 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -151,10 +151,9 @@ fi if test -e include/config/auto.conf; then # We are interested only in CONFIG_LOCALVERSION and - # CONFIG_LOCALVERSION_AUTO, so extract these in a safe - # way (i.e. w/o sourcing auto.conf) - CONFIG_LOCALVERSION=`cat include/config/auto.conf | awk -F '=' '/^CONFIG_LOCALVERSION=/ {print $2}'` - CONFIG_LOCALVERSION_AUTO=`cat include/config/auto.conf | awk -F '=' '/^CONFIG_LOCALVERSION_AUTO=/ {print $2}'` + # CONFIG_LOCALVERSION_AUTO, so avoid other lines that may have + # odd side effects when evaluated. + eval "$(grep -E '^CONFIG_LOCALVERSION(_AUTO)?=' include/config/auto.conf)" else echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2 exit 1