From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web08.25991.1620609624043664928 for ; Sun, 09 May 2021 18:20:26 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=LdXBB5Hm; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: bob.c.feng@intel.com) IronPort-SDR: 6UU+2hOfv4JjTztkb5VMSP6ram0uX4+ueQfDGrtt1ECaS7UFqWZniDk4chbjfFHCdUKlJJCB6w PQviXSe5bFnA== X-IronPort-AV: E=McAfee;i="6200,9189,9979"; a="284570800" X-IronPort-AV: E=Sophos;i="5.82,286,1613462400"; d="scan'208";a="284570800" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2021 18:20:22 -0700 IronPort-SDR: CcQFDYGkifNLCmzC6HjXqmxdeX4iDi9wcAqrRkvAwHLKwHKTVpQ1Rk7MLuqIMrpCMv/XqL4h0p pD+Lre3cnJjA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,286,1613462400"; d="scan'208";a="470617631" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga001.jf.intel.com with ESMTP; 09 May 2021 18:20:22 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Sun, 9 May 2021 18:20:22 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Sun, 9 May 2021 18:20:22 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.44) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Sun, 9 May 2021 18:20:21 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oKaxgfDboyFhtezqqGe9bUYcyfjax8x9JbMDR9WXHpT6GP7zzR6NXbdRXbPxQsJG3+1TpOxBOwYUFYowtwD92194HDBduHuNTCsTxerMvRi02+k7e7+iuuWZx8vZfbs7r1PsVOiUd+eZfD8Rz7rFOZ8FXb34idHTA6juhswrphKso4yk7/Gqjhsltpdtr/zOt/dyAsQlhASsxsPwGlp17xytrkwwpE52n018OF6yxAjb5k7SudvWQkOZhzkj2yCVwDWcLXBDYGWboAlAJjEEOz6w2u2dTjhVYXb7ylXgUhPlgUoj2oK3c1iM3LWCfIDUEO50iuU8JdIo6llaNmv35g== 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=dhGuE/Pwrt1FaMHPsV8DUg1l98YneKzSVwuqNuNFiLw=; b=CRZCV352WaZ+W5DdgkgEPR0SCasjnvbLnBrImnPBWWuDsyOuG/H7yXnW7CxWWgUPEkEXm697bfHNZ26aDAhufnP7aCI2ORYgBmyImx2CWiETYpdS70PAW/m2srC+ahDrnAlqUalLw4oLSmnc+Vyl/KSPTHg80tsF0bSz/XtwxQfkXVs0UGn+fGq/o5rcUTSxWLSNgh2soG0Tkj8zj4wNYREljEmcPu2zi/HethzVkAWrh60SKfTZURkBcMCjSaf0cExPmA0xZHSeJias5dKlV5aJuRQED4waum0jxPU8aqIaTjYO5w6fFqsyXuCuSINgBnaGGZN/vqLJs90vcxxZsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dhGuE/Pwrt1FaMHPsV8DUg1l98YneKzSVwuqNuNFiLw=; b=LdXBB5HmPKBoDqk6N5BBykSfqbdBG/jDTMl5TKpM1Boi9++XhHDpdfsEy1csEIMgDaVj52FZTTMx9gAA796SVoYmp9qkR5vOqIiWaqOF8UQO1qe27d+d4G5K1fIgS9541tFNGPdbIuCRiiPKA9NwizLFgQjvgqSgoywraxQOrK0= Received: from DM6PR11MB4073.namprd11.prod.outlook.com (2603:10b6:5:19f::22) by DM6PR11MB3148.namprd11.prod.outlook.com (2603:10b6:5:6f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24; Mon, 10 May 2021 01:20:20 +0000 Received: from DM6PR11MB4073.namprd11.prod.outlook.com ([fe80::cc64:a87c:5cf:5f18]) by DM6PR11MB4073.namprd11.prod.outlook.com ([fe80::cc64:a87c:5cf:5f18%3]) with mapi id 15.20.4108.031; Mon, 10 May 2021 01:20:20 +0000 From: "Bob Feng" To: "Kinney, Michael D" , "devel@edk2.groups.io" CC: Liming Gao , "Chen, Christine" Subject: Re: [Patch 1/1] BaseTools: Fix DSC override of Guided tool Thread-Topic: [Patch 1/1] BaseTools: Fix DSC override of Guided tool Thread-Index: AQHXREJbD4W2xY9aDEeR6wFjbsgm5qrb7JxQ Date: Mon, 10 May 2021 01:20:20 +0000 Message-ID: References: <20210508194250.310-1-michael.d.kinney@intel.com> In-Reply-To: <20210508194250.310-1-michael.d.kinney@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.53] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a7d09a50-b009-4259-63fd-08d91351c730 x-ms-traffictypediagnostic: DM6PR11MB3148: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:459; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Np/gvNH6KnLk3at8SxdNupN31mYadtIuwehEVcP8aPd5E5tc3iYVeGIDBzcnVLplNqLVB1Eryie4b8TPrGKCyqHer8GeqNHCDD8CTpq+xJdygUKXvTbnyD7UJkQc233oWni3WRHJPBnhorkN0rK4P42GrmIQk07Nc8jL/wEqzHuEoN903ihl2uKd8sbQblsYABV35cXWdgOBKKX7jSoOaCNr2st87jjztsRT2uV+8HSGLP7XjP/oI4QtpyMoKdFaAgPTIsAudbg4Oq7qDwHfpo4OIA+qoHBtqRE+gg/USeFP5PcjYo+izVDZtNsBmJNm8YziQycPMh+NQTQr42y4SeUle8BqMevIaxv1k1ggJiIiFvDAsWQRIqsH0ZjtaYARtWtXLhk/L1sjzzxpdHR4b7yGn2lOvEGGw3iIQOpjcnyNriEsztoX0yTvKLHr7O8JIjqLm8IiggoA2WZhjL1lV4yTeAxJtVVBC5cYUZmyrv18+x3yD3bIfebBpJ/5cXKMYv9q0mfoWiz23KiPNWcs+uOpkJ5IxVBb0ZPBMjr17dzKzENIMd8N9yWI6ObPuTiUjROBFGdKGIDjmL8zXEmy4icQezIkvf6YiUkY5HJ9uyKanjDIgiG8E7uo02Pw9uKOdatamU4KM7TEPEh1V7OPuk0O1WKAkf6/6BsukfB0Nz/Hsc6DidxyFK8QpZo0WeTb x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB4073.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(346002)(366004)(39860400002)(136003)(396003)(66476007)(66946007)(76116006)(66556008)(64756008)(2906002)(66446008)(71200400001)(122000001)(8676002)(54906003)(478600001)(8936002)(107886003)(186003)(316002)(52536014)(110136005)(83380400001)(5660300002)(30864003)(6506007)(38100700002)(9686003)(966005)(26005)(33656002)(4326008)(86362001)(55016002)(53546011)(7696005)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?HWdMlML0CO5tEv7Uh8MkKlS1H1gCZBaPLAKPPtGd9npl0glZy5nweaYYkHOT?= =?us-ascii?Q?f2grl6qpqQrTwCx20B8ifS7qhLsR+KxPM6nwfUoVnCtYm6/U/q9eFVmlCSZN?= =?us-ascii?Q?lWy+0hEonqw/024HXBKuEngW+VkNuiae6e27LJatSVU2RsfZVW8CBlgzDkgZ?= =?us-ascii?Q?oaKGF3sDoNnBFnXmxkSmYdroaaXGjOMxhNVNLTcCdS57cKmVbPeiuLHxmL3w?= =?us-ascii?Q?1/EEU4mCTCtIyDkGdc1snrwFrAxxKzWn5JNv7vzWHR3AO6kzFArzdbmrYjBE?= =?us-ascii?Q?nVUwvT85mYB3gM0e2NHQEOOsQiIFFNyK07zvtyANgVixgI94LN6+z9U2C0Ud?= =?us-ascii?Q?5o2uxkjfZfBVEOjowz8humvFTCw1JtPGQwlKuiUvkqgYRUCgPVFTluFtIpJR?= =?us-ascii?Q?3xj5EyR0GYKTgj1osL1o1HShMCuLJp6xyjOfDMtc7Ej5Ix4EZChHONIErWqV?= =?us-ascii?Q?yKAD932sUdKQd+e4+qP8Hqb595Ebv58P5MHZBimpfroMTqHt+e/drpQKCkTO?= =?us-ascii?Q?B6YQjD1RiK1lGOK2H9wp38b3UYXr9MoVT2JWUQthyPWzmL+N30STwxnm9Zln?= =?us-ascii?Q?vE+XRAHUwiLovk1IyOfRgX2eHjS2l+bzuAJFFnAZubBzdKVhXjOQKZEv1byv?= =?us-ascii?Q?Vt8Sju4BkcQi7Ti1ud2ss9BEFwG6Ge+X5FKA4fhjnP/FLLA7J7zXiR+BPOka?= =?us-ascii?Q?fXXbn6JAeeihOBRbokoMFmAQgcJpKJujSSN14k2ZMyxFdxF3QhjjL0Nl8dx3?= =?us-ascii?Q?rgNOsh1/CqgucnDJye9yxNnjpqbKeJFBRJDNw7tkpg9KKPuNBZxAw0yF9Qz9?= =?us-ascii?Q?a+QHzTUIEKSGZwA6HKJjVbXbgq8KzRAEFyVvJbWJ9JhfGQtLN0/vk+6Izgp4?= =?us-ascii?Q?GIXZMsQB4a570r2YyLWtGOpHb0CAhgaz1MxE3AIau1TmbMC+zYEOtx8e6wk0?= =?us-ascii?Q?q6Chx7v+gb+8+74pZwgKuqztthupyfnctRDkLHJxwraEgOhjeYCPI0VlD0bk?= =?us-ascii?Q?Gx/dEF2ohx41w9gApBEepfRw+HV4OGXfCoLB+wOeUV+DZwhbT/1wuEdCKZj6?= =?us-ascii?Q?EIN4GpvWFA/yt2PVt7MPRAT8WEAKkzo+9bNVRS4Ed/WjYUQqR7pA8jdD/WTa?= =?us-ascii?Q?BX2Pf7IwYAC3tXCSstydPR/0YT7MeSSty2nsAiGsH6ePGNvNpaq+1y2S06uV?= =?us-ascii?Q?aAz8gfehEnLdmr7W9XDWwghxD56gNlcKV5Y7vXPM0CA6XYnGUlfrYuXnA4kj?= =?us-ascii?Q?7w+PLXeZTu82x9rSmuhHaAc/s3UKGVt1x9UPXdf8K/C/vakhg3L/ZvpGkIcR?= =?us-ascii?Q?BaUH/cOJtDrgIaNOTdNjsBQt?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4073.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7d09a50-b009-4259-63fd-08d91351c730 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 May 2021 01:20:20.3122 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: DfrBbXHxnttzafyZ4PieETdbthkPqqKNOSygvHmzKXRUArXmOK2w/v8QLH9DTUqzr1Z1w+69zcIDBZ3u2cEunw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3148 Return-Path: bob.c.feng@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable This patch is good to me. Reviewed-by: Bob Feng -----Original Message----- From: Kinney, Michael D =20 Sent: Sunday, May 9, 2021 3:43 AM To: devel@edk2.groups.io Cc: Feng, Bob C ; Liming Gao ; Chen, Christine Subject: [Patch 1/1] BaseTools: Fix DSC override of Guided tool REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3359 If the DSC file provides an override of a Guided tool path and/or Guided to= ol GUID value, then make sure the one from the DSC file is used if it is hi= gher priority than the Guided tool in the tools_def.txt file. This makes t= he Guided tool used by GenFds match the tool listed GuidedSectionTools.txt. Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Signed-off-by: Michael D Kinney --- .../Source/Python/AutoGen/PlatformAutoGen.py | 7 +- .../Python/GenFds/GenFdsGlobalVariable.py | 228 ++++++++++++------ BaseTools/Source/Python/build/build.py | 52 ++-- 3 files changed, 190 insertions(+), 97 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/BaseTools= /Source/Python/AutoGen/PlatformAutoGen.py index 832c0da86bb7..592d4824a4b3 100644 --- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py @@ -918,14 +918,13 @@ class PlatformAutoGen(AutoGen): if Tool in self._BuildOptionWithToolDef(RetVal) and Attr i= n self._BuildOptionWithToolDef(RetVal)[Tool]: # check if override is indicated if self._BuildOptionWithToolDef(RetVal)[Tool][Attr].st= artswith('=3D'): - Value =3D self._BuildOptionWithToolDef(RetVal)[Too= l][Attr][1:] + Value =3D=20 + self._BuildOptionWithToolDef(RetVal)[Tool][Attr][1:].strip() else: - if Attr !=3D 'PATH': + # Do not append PATH or GUID + if Attr !=3D 'PATH' and Attr !=3D 'GUID': Value +=3D " " + self._BuildOptionWithToolDef(= RetVal)[Tool][Attr] else: Value =3D self._BuildOptionWithToolDef(RetVal)= [Tool][Attr] - Def =3D '_'.join([self.BuildTarget, self.ToolC= hain, self.Arch, Tool, Attr]) - self.Workspace.ToolDef.ToolsDefTxtDictionary[D= ef] =3D Value if Attr =3D=3D "PATH": # Don't put MAKE definition in the file if Tool !=3D "MAKE": diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseT= ools/Source/Python/GenFds/GenFdsGlobalVariable.py index c31fc24870d5..25f9d54874d3 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -32,6 +32,7 @@ from Common.LongFilePathSupport import OpenLongFilePath a= s open from Common.MultipleWorkspace import MultipleWorkspace as mws impo= rt Common.GlobalData as GlobalData from Common.BuildToolError import * +from AutoGen.AutoGen import CalculatePriorityValue =20 ## Global variables # @@ -850,6 +851,10 @@ class GenFdsGlobalVariable: # @param NameGuid The Guid name # def FindExtendTool(KeyStringList, CurrentArchList, NameGuid): + if GenFdsGlobalVariable.GuidToolDefinition: + if NameGuid in GenFdsGlobalVariable.GuidToolDefinition: + return GenFdsGlobalVariable.GuidToolDefinition[NameGuid] + ToolDefObj =3D ToolDefDict((os.path.join(os.getenv("WORKSPACE"), "Conf= "))) ToolDef =3D ToolDefObj.ToolDef ToolDb =3D ToolDef.ToolsDefTxtDatabase @@ -864,86 +869,159 @@ def Find= ExtendTool(KeyStringList, CurrentArchList, NameGuid): if Target + '_' + ToolChain + '_' + Arch not in KeyStringList: KeyStringList.append(Target + '_' + ToolChain + '_' + Arch= ) =20 - if GenFdsGlobalVariable.GuidToolDefinition: - if NameGuid in GenFdsGlobalVariable.GuidToolDefinition: - return GenFdsGlobalVariable.GuidToolDefinition[NameGuid] - - ToolDefinition =3D ToolDef.ToolsDefTxtDictionary ToolPathTmp =3D None ToolOption =3D None - ToolPathKey =3D None - ToolOptionKey =3D None - KeyList =3D None - for tool_def in ToolDefinition.items(): - KeyList =3D tool_def[0].split('_') - if len(KeyList) < 5: - continue - if KeyList[4] !=3D DataType.TAB_GUID: - continue - if NameGuid.lower() !=3D tool_def[1].lower(): - continue - Key =3D KeyList[0] + \ - '_' + \ - KeyList[1] + \ - '_' + \ - KeyList[2] + for Arch in CurrentArchList: + MatchItem =3D None + MatchPathItem =3D None + MatchOptionsItem =3D None for KeyString in KeyStringList: KeyStringBuildTarget, KeyStringToolChain, KeyStringArch =3D Ke= yString.split('_') - if KeyList[0] =3D=3D DataType.TAB_STAR: - KeyList[0] =3D KeyStringBuildTarget - if KeyList[1] =3D=3D DataType.TAB_STAR: - KeyList[1] =3D KeyStringToolChain - if KeyList[2] =3D=3D DataType.TAB_STAR: - KeyList[2] =3D KeyStringArch - if KeyList[0] =3D=3D KeyStringBuildTarget and KeyList[1] =3D= =3D KeyStringToolChain and KeyList[2] =3D=3D KeyStringArch: - ToolPathKey =3D Key + '_' + KeyList[3] + '_PATH' - ToolOptionKey =3D Key + '_' + KeyList[3] + '_FLAGS' - ToolPath =3D ToolDefinition.get(ToolPathKey) - ToolOption =3D ToolDefinition.get(ToolOptionKey) - if ToolPathTmp is None: - ToolPathTmp =3D ToolPath - else: - if ToolPathTmp !=3D ToolPath: - EdkLogger.error("GenFds", GENFDS_ERROR, "Don't kno= w which tool to use, %s or %s ?" % (ToolPathTmp, ToolPath)) + if KeyStringArch !=3D Arch: + continue + for Item in ToolDef.ToolsDefTxtDictionary: + if len(Item.split('_')) < 5: + continue + ItemTarget, ItemToolChain, ItemArch, ItemTool, ItemAttr = =3D Item.split('_') + if ItemTarget =3D=3D DataType.TAB_STAR: + ItemTarget =3D KeyStringBuildTarget + if ItemToolChain =3D=3D DataType.TAB_STAR: + ItemToolChain =3D KeyStringToolChain + if ItemArch =3D=3D DataType.TAB_STAR: + ItemArch =3D KeyStringArch + if ItemTarget !=3D KeyStringBuildTarget: + continue + if ItemToolChain !=3D KeyStringToolChain: + continue + if ItemArch !=3D KeyStringArch: + continue + if ItemAttr !=3D DataType.TAB_GUID: + # Not GUID attribute + continue + if ToolDef.ToolsDefTxtDictionary[Item].lower() !=3D NameGu= id.lower(): + # No GUID value match + continue + if MatchItem: + if MatchItem.split('_')[3] =3D=3D ItemTool: + # Tool name is the same + continue + if CalculatePriorityValue(MatchItem) > CalculatePriori= tyValue(Item): + # Current MatchItem is higher priority than new ma= tch item + continue + MatchItem =3D Item + if not MatchItem: + continue + ToolName =3D MatchItem.split('_')[3] + for Item in ToolDef.ToolsDefTxtDictionary: + if len(Item.split('_')) < 5: + continue + ItemTarget, ItemToolChain, ItemArch, ItemTool, ItemAttr = =3D Item.split('_') + if ItemTarget =3D=3D DataType.TAB_STAR: + ItemTarget =3D KeyStringBuildTarget + if ItemToolChain =3D=3D DataType.TAB_STAR: + ItemToolChain =3D KeyStringToolChain + if ItemArch =3D=3D DataType.TAB_STAR: + ItemArch =3D KeyStringArch + if ItemTarget !=3D KeyStringBuildTarget: + continue + if ItemToolChain !=3D KeyStringToolChain: + continue + if ItemArch !=3D KeyStringArch: + continue + if ItemTool !=3D ToolName: + continue + if ItemAttr =3D=3D 'PATH': + if MatchPathItem: + if CalculatePriorityValue(MatchPathItem) <=3D Calc= ulatePriorityValue(Item): + MatchPathItem =3D Item + else: + MatchPathItem =3D Item + if ItemAttr =3D=3D 'FLAGS': + if MatchOptionsItem: + if CalculatePriorityValue(MatchOptionsItem) <=3D C= alculatePriorityValue(Item): + MatchOptionsItem =3D Item + else: + MatchOptionsItem =3D Item + if MatchPathItem: + ToolPathTmp =3D ToolDef.ToolsDefTxtDictionary[MatchPathItem] + if MatchOptionsItem: + ToolOption =3D=20 + ToolDef.ToolsDefTxtDictionary[MatchOptionsItem] =20 - BuildOption =3D {} for Arch in CurrentArchList: - Platform =3D GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlob= alVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlo= balVariable.ToolChainTag] - # key is (ToolChainFamily, ToolChain, CodeBase) - for item in Platform.BuildOptions: - if '_PATH' in item[1] or '_FLAGS' in item[1] or '_GUID' in ite= m[1]: - if not item[0] or (item[0] and GenFdsGlobalVariable.ToolCh= ainFamily=3D=3D item[0]): - if item[1] not in BuildOption: - BuildOption[item[1]] =3D Platform.BuildOptions[ite= m] - if BuildOption: - ToolList =3D [DataType.TAB_TOD_DEFINES_TARGET, DataType.TAB_TO= D_DEFINES_TOOL_CHAIN_TAG, DataType.TAB_TOD_DEFINES_TARGET_ARCH] - for Index in range(2, -1, -1): - for Key in list(BuildOption.keys()): - List =3D Key.split('_') - if List[Index] =3D=3D DataType.TAB_STAR: - for String in ToolDb[ToolList[Index]]: - if String in [Arch, GenFdsGlobalVariable.Targe= tName, GenFdsGlobalVariable.ToolChainTag]: - List[Index] =3D String - NewKey =3D '%s_%s_%s_%s_%s' % tuple(List) - if NewKey not in BuildOption: - BuildOption[NewKey] =3D BuildOption[Ke= y] - continue - del BuildOption[Key] - elif List[Index] not in ToolDb[ToolList[Index]]: - del BuildOption[Key] - if BuildOption: - if not KeyList: - for Op in BuildOption: - if NameGuid =3D=3D BuildOption[Op]: - KeyList =3D Op.split('_') - Key =3D KeyList[0] + '_' + KeyList[1] +'_' + KeyList[2= ] - if Key in KeyStringList and KeyList[4] =3D=3D DataType= .TAB_GUID: - ToolPathKey =3D Key + '_' + KeyList[3] + '_PATH' - ToolOptionKey =3D Key + '_' + KeyList[3] + '_FLAGS= ' - if ToolPathKey in BuildOption: - ToolPathTmp =3D BuildOption[ToolPathKey] - if ToolOptionKey in BuildOption: - ToolOption =3D BuildOption[ToolOptionKey] - + MatchItem =3D None + MatchPathItem =3D None + MatchOptionsItem =3D None + for KeyString in KeyStringList: + KeyStringBuildTarget, KeyStringToolChain, KeyStringArch =3D Ke= yString.split('_') + if KeyStringArch !=3D Arch: + continue + Platform =3D GenFdsGlobalVariable.WorkSpace.BuildObject[GenFds= GlobalVariable.ActivePlatform, Arch, KeyStringBuildTarget, KeyStringToolCha= in] + for Item in Platform.BuildOptions: + if len(Item[1].split('_')) < 5: + continue + ItemTarget, ItemToolChain, ItemArch, ItemTool, ItemAttr = =3D Item[1].split('_') + if ItemTarget =3D=3D DataType.TAB_STAR: + ItemTarget =3D KeyStringBuildTarget + if ItemToolChain =3D=3D DataType.TAB_STAR: + ItemToolChain =3D KeyStringToolChain + if ItemArch =3D=3D DataType.TAB_STAR: + ItemArch =3D KeyStringArch + if ItemTarget !=3D KeyStringBuildTarget: + continue + if ItemToolChain !=3D KeyStringToolChain: + continue + if ItemArch !=3D KeyStringArch: + continue + if ItemAttr !=3D DataType.TAB_GUID: + # Not GUID attribute match + continue + if Platform.BuildOptions[Item].lower() !=3D NameGuid.lower= (): + # No GUID value match + continue + if MatchItem: + if MatchItem[1].split('_')[3] =3D=3D ItemTool: + # Tool name is the same + continue + if CalculatePriorityValue(MatchItem[1]) > CalculatePri= orityValue(Item[1]): + # Current MatchItem is higher priority than new ma= tch item + continue + MatchItem =3D Item + if not MatchItem: + continue + ToolName =3D MatchItem[1].split('_')[3] + for Item in Platform.BuildOptions: + if len(Item[1].split('_')) < 5: + continue + ItemTarget, ItemToolChain, ItemArch, ItemTool, ItemAttr = =3D Item[1].split('_') + if ItemTarget =3D=3D DataType.TAB_STAR: + ItemTarget =3D KeyStringBuildTarget + if ItemToolChain =3D=3D DataType.TAB_STAR: + ItemToolChain =3D KeyStringToolChain + if ItemArch =3D=3D DataType.TAB_STAR: + ItemArch =3D KeyStringArch + if ItemTarget !=3D KeyStringBuildTarget: + continue + if ItemToolChain !=3D KeyStringToolChain: + continue + if ItemArch !=3D KeyStringArch: + continue + if ItemTool !=3D ToolName: + continue + if ItemAttr =3D=3D 'PATH': + if MatchPathItem: + if CalculatePriorityValue(MatchPathItem[1]) <=3D C= alculatePriorityValue(Item[1]): + MatchPathItem =3D Item + else: + MatchPathItem =3D Item + if ItemAttr =3D=3D 'FLAGS': + if MatchOptionsItem: + if CalculatePriorityValue(MatchOptionsItem[1]) <= =3D CalculatePriorityValue(Item[1]): + MatchOptionsItem =3D Item + else: + MatchOptionsItem =3D Item + if MatchPathItem: + ToolPathTmp =3D Platform.BuildOptions[MatchPathItem] + if MatchOptionsItem: + ToolOption =3D Platform.BuildOptions[MatchOptionsItem] GenFdsGlobalVariable.GuidToolDefinition[NameGuid] =3D (ToolPathTmp, To= olOption) return ToolPathTmp, ToolOption diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Pyth= on/build/build.py index e5693c0d27a2..037493f0b02a 100755 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -62,6 +62,7 @@ from AutoGen.ModuleAutoGenHelper import WorkSpaceInfo, Pl= atformInfo from GenFds.FdfParser import FdfParser from AutoGen.IncludesAu= toGen import IncludesAutoGen from GenFds.GenFds import resetFdsGlobalVaria= ble +from AutoGen.AutoGen import CalculatePriorityValue =20 ## standard targets of build command gSupportedTarget =3D ['all', 'genc', 'genmake', 'modules', 'libraries', 'f= ds', 'clean', 'cleanall', 'cleanlib', 'run'] @@ -2425,27 +2426,42 @@ class = Build(): FvDir =3D Wa.FvDir if not os.path.exists(FvDir): continue - for Arch in self.ArchList: - # Look through the tool definitions for GUIDed tools + guidList =3D [] + tooldefguidList =3D [] guidAttribs =3D [] - for (attrib, value) in self.ToolDef.ToolsDefTxtDiction= ary.items(): - GuidBuildTarget, GuidToolChain, GuidArch, GuidTool= , GuidAttr =3D attrib.split('_') - if GuidAttr.upper() =3D=3D 'GUID': - if GuidBuildTarget =3D=3D TAB_STAR: - GuidBuildTarget =3D BuildTarget - if GuidToolChain =3D=3D TAB_STAR: - GuidToolChain =3D ToolChain - if GuidArch =3D=3D TAB_STAR: - GuidArch =3D Arch - if GuidBuildTarget =3D=3D BuildTarget and Guid= ToolChain =3D=3D ToolChain and GuidArch =3D=3D Arch: - path =3D '_'.join(attrib.split('_')[:-1]) = + '_PATH' - if path in self.ToolDef.ToolsDefTxtDiction= ary: - path =3D self.ToolDef.ToolsDefTxtDicti= onary[path] - path =3D self.GetRealPathOfTool(path) - guidAttribs.append((value.lower(), Gui= dTool, path)) + for Platform in Wa.AutoGenObjectList: + if Platform.BuildTarget !=3D BuildTarget: + continue + if Platform.ToolChain !=3D ToolChain: + continue + if Platform.Arch !=3D Arch: + continue + if hasattr (Platform, 'BuildOption'): + for Tool in Platform.BuildOption: + if 'GUID' in Platform.BuildOption[Tool]: + if 'PATH' in Platform.BuildOption[Tool= ]: + value =3D Platform.BuildOption[Too= l]['GUID'] + if value in guidList: + EdkLogger.error("build", FORMA= T_INVALID, "Duplicate GUID value %s used with Tool %s in DSC [BuildOptions]= ." % (value, Tool)) + path =3D Platform.BuildOption[Tool= ]['PATH'] + guidList.append(value) + guidAttribs.append((value, Tool, p= ath)) + for Tool in Platform.ToolDefinition: + if 'GUID' in Platform.ToolDefinition[Tool]: + if 'PATH' in Platform.ToolDefinition[Tool]= : + value =3D Platform.ToolDefinition[Tool= ]['GUID'] + if value in tooldefguidList: + EdkLogger.error("build", FORMAT_IN= VALID, "Duplicate GUID value %s used with Tool %s in tools_def.txt." % (val= ue, Tool)) + tooldefguidList.append(value) + if value in guidList: + # Already added by platform + continue + path =3D Platform.ToolDefinition[Tool]= ['PATH'] + guidList.append(value) + guidAttribs.append((value, Tool,=20 + path)) # Sort by GuidTool name - sorted (guidAttribs, key=3Dlambda x: x[1]) + guidAttribs =3D sorted (guidAttribs, key=3Dlambda x:=20 + x[1]) # Write out GuidedSecTools.txt toolsFile =3D os.path.join(FvDir, 'GuidedSectionTools.= txt') toolsFile =3D open(toolsFile, 'wt') -- 2.31.1.windows.1