From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.8047.1646746941125860812 for ; Tue, 08 Mar 2022 05:42:21 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=k71iIn4c; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: yi1.li@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646746941; x=1678282941; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1ETtV1HcAgaYJE1U/awiaA9RUSr+CphgOwlalFGnvjs=; b=k71iIn4cu83qk563ID7M/Sr00OSgSF2oSi1tNFOipGwg0q2W0myWyGm0 hl+CLRImYmhVuDDZcW6AJXZSh6mHTJLDc8peV4AuQwuRIuNfWHsAWXCP3 ZOJUPmxoCqvGVkqYsxpGuM/cmnXLnfRku8GD17QZDBBhaDT4ku7KOZ0ht FwwMmokR3v+iAVBZCyzgcM826FAfMwYs4Z94YvX8Q96V3hlEXnUtMSX3X EIbikUPZkHbslOM68gNMKgQgSgssJKN/s3rax7eid34yyLFvsoaFLZ2UV IW/sl/Ib5PbXqZpnheVWv4tT/bHZ2qmeGb/x1TMXxn9uKt9/UIlJqJd8o g==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="234637202" X-IronPort-AV: E=Sophos;i="5.90,165,1643702400"; d="scan'208";a="234637202" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2022 05:42:20 -0800 X-IronPort-AV: E=Sophos;i="5.90,165,1643702400"; d="scan'208";a="537569302" Received: from shwdejointd178.ccr.corp.intel.com ([10.239.153.103]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2022 05:42:18 -0800 From: "yi1 li" To: devel@edk2.groups.io Cc: yi1 li , Bob Feng , Liming Gao , Heng Luo Subject: [PATCH V2 2/2] BaseTools:Add the FeatureFlagExpression usage to the Source Section Date: Tue, 8 Mar 2022 21:42:07 +0800 Message-Id: <964dee97e12793125d8c6cb486cf4d6498c05570.1646746598.git.yi1.li@intel.com> X-Mailer: git-send-email 2.33.0.windows.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1446 FeatureFlagExpression Support in Source section of INF file. The Pcd value in the expression is from INF or DEC. When a FeatureFlagExpression is present,if the expression evaluates to TRUE,then the entry is valid. If the expression evaluates to FALSE, then the EDK II build tools must ignore the entry. This patch is going to add this feature. Cc: Bob Feng Cc: Liming Gao Cc: Heng Luo Signed-off-by: yi1 li --- BaseTools/Source/Python/Workspace/InfBuildData.py | 14 ++++++++++---- .../Source/Python/Workspace/MetaFileParser.py | 4 ++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py index 91d986d8cb1b..cb58e612cbd0 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -529,11 +529,17 @@ class InfBuildData(ModuleBuildClassObject): for Record in RecordList: LineNo = Record[-1] ToolChainFamily = Record[1] - TagName = Record[2] - ToolCode = Record[3] - + # OptionsList := [TagName, ToolCode, FeatureFlag] + OptionsList = ['','',''] + TokenList = GetSplitValueList(Record[2], TAB_VALUE_SPLIT) + for Index in range(len(TokenList)): + OptionsList[Index] = TokenList[Index] + if OptionsList[2]: + FeaturePcdExpression = self.CheckFeatureFlagPcd(OptionsList[2]) + if not FeaturePcdExpression: + continue File = PathClass(NormPath(Record[0], Macros), self._ModuleDir, '', - '', False, self._Arch, ToolChainFamily, '', TagName, ToolCode) + '', False, self._Arch, ToolChainFamily, '', OptionsList[0], OptionsList[1]) # check the file validation ErrorCode, ErrorInfo = File.Validate() if ErrorCode != 0: diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index a3b6edbd15ee..3508591b281e 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -736,6 +736,10 @@ class InfParser(MetaFileParser): @ParseMacro def _SourceFileParser(self): TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) + # Let TokenList[2] be TagName|ToolCode|FeatureFlag + if len(TokenList) > 3: + for extraToken in range(3, len(TokenList)): + TokenList[2] = TokenList[2] + '|' + TokenList[extraToken] self._ValueList[0:len(TokenList)] = TokenList Macros = self._Macros # For Acpi tables, remove macro like ' TABLE_NAME=Sata1' -- 2.33.0.windows.2