From nobody Sat May 4 13:38:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1520579973987194.49613829107614; Thu, 8 Mar 2018 23:19:33 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 37724225892D8; Thu, 8 Mar 2018 23:13:15 -0800 (PST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 24FFC21ED1C4F for ; Thu, 8 Mar 2018 23:13:12 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Mar 2018 23:19:29 -0800 Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.129]) by orsmga001.jf.intel.com with ESMTP; 08 Mar 2018 23:19:28 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,444,1515484800"; d="scan'208";a="37279168" From: Yonghong Zhu To: edk2-devel@lists.01.org Date: Fri, 9 Mar 2018 15:19:28 +0800 Message-Id: <1520579968-10408-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [edk2] [Patch] BaseTools: Fix a bug for --pcd used in ConditionalStatement calculate X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move the GlobalData.BuildOptionPcd before FdfParser() function and add type check for Pcd item. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu Reviewed-by: Liming Gao --- BaseTools/Source/Python/GenFds/FdfParser.py | 2 ++ BaseTools/Source/Python/GenFds/GenFds.py | 2 +- BaseTools/Source/Python/Workspace/MetaFileParser.py | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index 76d7e6a..dda7ed4 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -925,10 +925,12 @@ class FdfParser: =20 MacroDict.update(GlobalData.gGlobalDefines) MacroDict.update(GlobalData.gCommandLineDefines) if GlobalData.BuildOptionPcd: for Item in GlobalData.BuildOptionPcd: + if type(Item) is tuple: + continue PcdName, TmpValue =3D Item.split("=3D") TmpValue =3D BuildOptionValue(TmpValue, {}) MacroDict[PcdName.strip()] =3D TmpValue # Highest priority =20 diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Py= thon/GenFds/GenFds.py index 4c56cbb..03126e3 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -140,10 +140,11 @@ def main(): if not os.path.exists(ActivePlatform) : EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform = doesn't exist!") else: EdkLogger.error("GenFds", OPTION_MISSING, "Missing active plat= form") =20 + GlobalData.BuildOptionPcd =3D Options.OptionPcd if Options.Opt= ionPcd else {} GenFdsGlobalVariable.ActivePlatform =3D PathClass(NormPath(ActiveP= latform)) =20 if (Options.ConfDirectory): # Get alternate Conf location, if it is absolute, then just us= e the absolute directory name ConfDirectoryPath =3D os.path.normpath(Options.ConfDirectory) @@ -324,11 +325,10 @@ def main(): EdkLogger.error("GenFds", FORMAT_I= NVALID, "The FV %s's region is specified in multiple FD with different valu= e." %FvObj.UiFvName) else: FvObj.FvRegionInFD =3D RegionObj.Size RegionObj.BlockInfoOfRegion(FdObj.Bloc= kSizeList, FvObj) =20 - GlobalData.BuildOptionPcd =3D Options.OptionPcd if Options.Opt= ionPcd else {} """Call GenFds""" GenFds.GenFd('', FdfParserObj, BuildWorkSpace, ArchList) =20 """Generate GUID cross reference file""" GenFds.GenerateGuidXRefFile(BuildWorkSpace, ArchList, FdfParserObj) diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTool= s/Source/Python/Workspace/MetaFileParser.py index 69bdf21..2eb4c75 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -1243,10 +1243,12 @@ class DscParser(MetaFileParser): # PCD cannot be referenced in macro definition if self._ItemType not in [MODEL_META_DATA_DEFINE, MODEL_META_DATA_= GLOBAL_DEFINE]: Macros.update(self._Symbols) if GlobalData.BuildOptionPcd: for Item in GlobalData.BuildOptionPcd: + if type(Item) is tuple: + continue PcdName, TmpValue =3D Item.split("=3D") TmpValue =3D BuildOptionValue(TmpValue, self._GuidDict) Macros[PcdName.strip()] =3D TmpValue return Macros =20 --=20 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel