From patchwork Mon Jan 6 12:01:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1218112 X-Patchwork-Delegate: trini@ti.com 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=none (p=none 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.b="fClUm0mk"; 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) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47rvHf2mHHz9sR1 for ; Mon, 6 Jan 2020 23:01:30 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 07EC580507; Mon, 6 Jan 2020 13:01:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none 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="fClUm0mk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 80CAE816EB; Mon, 6 Jan 2020 13:01: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.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FORGED_SPF_HELO, SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on0710.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0c::710]) (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 43BF080421 for ; Mon, 6 Jan 2020 13:01:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none 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=arc0szO6GdD6fIR3Ot9c/6cI1vc23iujnf2tT+49ecezNfO+BGRuyBIBVfea8fI+qD1zCVb7IaK8/ROn8XshqD0aZmYivHI15L3/aMuM2ul44EiSRzGxdhEJ9pEtxs4QX1C0JGBtgsj7GQjjG1Rb0b3InU9eONlZnwOMFl8Y6UkWoEhmE5xM1QKaky9FDjZR2exWn/EBKnViaapVXeYOECNB8LyBneQQUtnz8h4sWQUHtS0VbSGnl7vDSjXBRPGyjrjshMWHS7ZMTZomAKIjfNI08TZH/W76acKkn1OU54RNtOZXT2rLEETDfJmVhJU5AaTgcEWLJrGBp9MjvPaoqQ== 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=0nd/Q+tOehYvV5zSp/3grwB0s0cPUPfIYtFeLudIplg=; b=Vo8TmLKNqvxJl1kIeLxVc2nNNnD5LwVjwH9AnGCQHVSAneDjX664HysKzaqiR8FpBilwEucEZtbIk0f53mHOS9iIyJAkH6r3W4foyYoC/4uRKveADfy86zlAdbK9aSNmO5McmIFMaESVqyu86Fr0v/Pxt8FXMccV+E8FSTfNNYm2MPJb1UcFzrBa0AHUGXux5HnA4IbaOI1T5s8PaUbkkLe0zNC9CF0aP0ARUaKEDnnEOreCI6i/QBIas3bwM4ryo99Pv7nGkGI+4Ni1ftJ7w1lilDiVxJ3AyW0fFcHoLr0Qrp4yYQudpXKLCBEfS4BxRb74QcXsd8O/36E9eWwSMQ== 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=0nd/Q+tOehYvV5zSp/3grwB0s0cPUPfIYtFeLudIplg=; b=fClUm0mkYqVvvocGBWbabCsgYbgN7Lc6TNSB3ax5hGZOKcwwV57y8A+rdE/vzU9eOpgjZsiNbrOzM1RSInNykZ7GHfc3w8wutiGHqMCYjct1dbOh0uILvHWTtZ+NsWvH2ehQDFIXSa5HiACjE1FOC7C2fm2sHxXvJLXDZdTYtyY= Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (20.178.126.85) by VI1PR10MB2448.EURPRD10.PROD.OUTLOOK.COM (20.177.62.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Mon, 6 Jan 2020 12:01:17 +0000 Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::8175:5aa2:2870:766d]) by VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::8175:5aa2:2870:766d%6]) with mapi id 15.20.2602.015; Mon, 6 Jan 2020 12:01:17 +0000 Received: from prevas-ravi.prevas.se (81.216.59.226) by HE1PR0301CA0021.eurprd03.prod.outlook.com (2603:10a6:3:76::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.10 via Frontend Transport; Mon, 6 Jan 2020 12:01:16 +0000 From: Rasmus Villemoes To: "u-boot@lists.denx.de" Subject: [PATCH] scripts/get_default_envs.sh: preserve order of multiple entries for same variable Thread-Topic: [PATCH] scripts/get_default_envs.sh: preserve order of multiple entries for same variable Thread-Index: AQHVxIkA2n/UzkgSbkWPnFYUvNMBOw== Date: Mon, 6 Jan 2020 12:01:17 +0000 Message-ID: <20200106120107.22564-1-rasmus.villemoes@prevas.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0301CA0021.eurprd03.prod.outlook.com (2603:10a6:3:76::31) To VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) x-mailer: git-send-email 2.23.0 authentication-results: spf=none (sender IP is ) smtp.mailfrom=rasmus.villemoes@prevas.dk; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [81.216.59.226] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 033fe187-63f2-42d8-8abc-08d792a02291 x-ms-traffictypediagnostic: VI1PR10MB2448: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 0274272F87 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(366004)(39840400004)(136003)(346002)(396003)(199004)(189003)(66946007)(66476007)(6486002)(44832011)(107886003)(64756008)(66446008)(6506007)(66556008)(86362001)(71200400001)(2616005)(8936002)(5660300002)(6512007)(26005)(478600001)(8676002)(36756003)(2906002)(4326008)(186003)(81166006)(81156014)(8976002)(956004)(1076003)(316002)(6916009)(52116002)(54906003)(16526019); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR10MB2448; H:VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: prevas.dk does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 3u1MBGlX0vqFrf2495fpdYP2bZOAiv9DNdLeLfDGx5lgUndbtnyUsqpMzM+gyexKXrVB6jwmkFVtGh2NnMnkkMysj3LYIxn6psJ8itcad9v3AmbUE3OpurtKk9Ugjly2OmRGWyb99PY/rZK8mKDhS9XiO6EwjWBY3OpkMZdPQpXmSlSYM8SoIWaa/BfK9y4bTxPWGo5SZWUM0FxE4Oav+4FUEwPxLpilHT7gPr8iA8Tdk0tZ/eBpq5aGIpybqLJj7dp5hq0/Hs4MEj/6yJ9fNwOm4QNtEBf3nmWfHVYf3MP4TIyTafQf0tylcEphSbHyoQybI4LPbY3zO+Bt6rYTvNO8aJZ8GYLGYVF12DA/ld7k0RyxGPyqUJ87yxlV/8QwA6C78NA8p080GTcH6lr9xx4f+alLK0gutP5dDrvZFTH+jNLl7mN86JJfyuA8ud3l MIME-Version: 1.0 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 033fe187-63f2-42d8-8abc-08d792a02291 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jan 2020 12:01:17.1009 (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: cjLifYJIg5Zdn8V4lpQQYdmY6DvFNPHldNolwpxjKVGy2l3h+E012YEMhRkBNReQIsSrv+FOF5r3TlkSJkvp6ErihgxmS4WNDF+nEUlq2FU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB2448 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lukasz Majewski Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean It's possible that the default_environment[] array contains multiple entries for the same variable, e.g. a setting from env_default.h based on some CONFIG_* variable, and another from CONFIG_EXTRA_ENV_SETTINGS. In such a case, the last setting takes effect. Hence, in order to be able to use the output from this script as an CONFIG_DEFAULT_ENV_FILE and get the same default environment as one currently has, we need to preserve the order. So only sort by the variable name, and disable the last-resort comparison. We could pipe the result through uniq to remove duplicate lines, but I think there's some value in seeing that certain variables are defined multiple times. Signed-off-by: Rasmus Villemoes Reviewed-by: Lukasz Majewski Reviewed-by: Simon Glass --- scripts/get_default_envs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/get_default_envs.sh b/scripts/get_default_envs.sh index da86a9d69c..d1f2ce4d5c 100755 --- a/scripts/get_default_envs.sh +++ b/scripts/get_default_envs.sh @@ -35,7 +35,7 @@ cp ${env_obj_file_path} ${ENV_OBJ_FILE_COPY} ${OBJCOPY} -O binary -j ".rodata.default_environment" ${ENV_OBJ_FILE_COPY} # Replace default '\0' with '\n' and sort entries -tr '\0' '\n' < ${ENV_OBJ_FILE_COPY} | sort -u +tr '\0' '\n' < ${ENV_OBJ_FILE_COPY} | sort --field-separator== -k1,1 --stable rm ${ENV_OBJ_FILE_COPY}