From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 73C052253FB51 for ; Fri, 9 Mar 2018 00:16:45 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Mar 2018 00:23:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,444,1515484800"; d="scan'208";a="210166471" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga006.fm.intel.com with ESMTP; 09 Mar 2018 00:23:02 -0800 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 9 Mar 2018 00:23:02 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 9 Mar 2018 00:23:01 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.226]) by shsmsx102.ccr.corp.intel.com ([169.254.2.80]) with mapi id 14.03.0319.002; Fri, 9 Mar 2018 16:22:59 +0800 From: "Gao, Liming" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [Patch] BaseTools: Fix a bug for --pcd used in ConditionalStatement calculate Thread-Index: AQHTt3cE4ldKGfRf9EmOOQKOBjSI3KPHkLOg Date: Fri, 9 Mar 2018 08:22:58 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E1E458F@SHSMSX104.ccr.corp.intel.com> References: <1520579968-10408-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1520579968-10408-1-git-send-email-yonghong.zhu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: , X-List-Received-Date: Fri, 09 Mar 2018 08:16:45 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of >Yonghong Zhu >Sent: Friday, March 09, 2018 3:19 PM >To: edk2-devel@lists.01.org >Subject: [edk2] [Patch] BaseTools: Fix a bug for --pcd used in >ConditionalStatement calculate > >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 >--- > 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: > > 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 > >diff --git a/BaseTools/Source/Python/GenFds/GenFds.py >b/BaseTools/Source/Python/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 >platform") > >+ GlobalData.BuildOptionPcd =3D Options.OptionPcd if Options.Op= tionPcd >else {} > GenFdsGlobalVariable.ActivePlatform =3D >PathClass(NormPath(ActivePlatform)) > > if (Options.ConfDirectory): > # Get alternate Conf location, if it is absolute, then just u= se the absolute >directory name > ConfDirectoryPath =3D os.path.normpath(Options.ConfDirectory) >@@ -324,11 +325,10 @@ def main(): > EdkLogger.error("GenFds", FORMAT_= INVALID, "The >FV %s's region is specified in multiple FD with different >value." %FvObj.UiFvName) > else: > FvObj.FvRegionInFD =3D RegionObj.Size > RegionObj.BlockInfoOfRegion(FdObj.Blo= ckSizeList, FvObj) > >- GlobalData.BuildOptionPcd =3D Options.OptionPcd if Options.Op= tionPcd >else {} > """Call GenFds""" > GenFds.GenFd('', FdfParserObj, BuildWorkSpace, ArchList) > > """Generate GUID cross reference file""" > GenFds.GenerateGuidXRefFile(BuildWorkSpace, ArchList, FdfParserOb= j) >diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py >b/BaseTools/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 > >-- >2.6.1.windows.1 > >_______________________________________________ >edk2-devel mailing list >edk2-devel@lists.01.org >https://lists.01.org/mailman/listinfo/edk2-devel