From nobody Tue Apr 23 14:35:50 2024 Delivered-To: importer@patchew.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; Authentication-Results: mx.zoho.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 1487142458508944.9322265974598; Tue, 14 Feb 2017 23:07:38 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9AC3982135; Tue, 14 Feb 2017 23:07:36 -0800 (PST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 5E72482130 for ; Tue, 14 Feb 2017 23:07:35 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2017 23:07:31 -0800 Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.121]) by orsmga005.jf.intel.com with ESMTP; 14 Feb 2017 23:07:29 -0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,164,1484035200"; d="scan'208";a="64886035" From: Yonghong Zhu To: edk2-devel@lists.01.org Date: Wed, 15 Feb 2017 15:07:28 +0800 Message-Id: <1487142448-35416-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [edk2] [Patch] BaseTools: Fix bug for GUIDED tool path override by DSC [BuildOptions] X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao 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" Current the GUIDED tool path can't be override to the different path in the [BuildOptions] of DSC file. This patch fix the bug. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=3D283 Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/AutoGen.py | 24 +++++++++---- BaseTools/Source/Python/GenFds/GenFds.py | 57 +++++++++++++++++++++-----= ---- 2 files changed, 59 insertions(+), 22 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index c35f0b2..06e674a 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -1716,11 +1716,14 @@ class PlatformAutoGen(AutoGen): if Tool in self.BuildOption and Attr in self.BuildOpti= on[Tool]: # check if override is indicated if self.BuildOption[Tool][Attr].startswith('=3D'): Value =3D self.BuildOption[Tool][Attr][1:] else: - Value +=3D " " + self.BuildOption[Tool][Attr] + if Attr !=3D 'PATH': + Value +=3D " " + self.BuildOption[Tool][At= tr] + else: + Value =3D self.BuildOption[Tool][Attr] =20 if Attr =3D=3D "PATH": # Don't put MAKE definition in the file if Tool =3D=3D "MAKE": MakePath =3D Value @@ -2379,12 +2382,15 @@ class PlatformAutoGen(AutoGen): if Tool not in BuildOptions: BuildOptions[Tool] =3D {} if Attr !=3D "FLAGS" or Attr not in BuildOptions[T= ool] or Options[Key].startswith('=3D'): BuildOptions[Tool][Attr] =3D Options[Key] else: - # append options for the same tool - BuildOptions[Tool][Attr] +=3D " " + Options[Ke= y] + # append options for the same tool except PATH + if Attr !=3D 'PATH': + BuildOptions[Tool][Attr] +=3D " " + Option= s[Key] + else: + BuildOptions[Tool][Attr] =3D Options[Key] # Build Option Family has been checked, which need't to be checked= again for family. if FamilyMatch or FamilyIsNull: return BuildOptions =20 for Key in Options: @@ -2411,12 +2417,15 @@ class PlatformAutoGen(AutoGen): if Tool not in BuildOptions: BuildOptions[Tool] =3D {} if Attr !=3D "FLAGS" or Attr not in BuildOptions[T= ool] or Options[Key].startswith('=3D'): BuildOptions[Tool][Attr] =3D Options[Key] else: - # append options for the same tool - BuildOptions[Tool][Attr] +=3D " " + Options[Ke= y] + # append options for the same tool except PATH + if Attr !=3D 'PATH': + BuildOptions[Tool][Attr] +=3D " " + Option= s[Key] + else: + BuildOptions[Tool][Attr] =3D Options[Key] return BuildOptions =20 ## Append build options in platform to a module # # @param Module The module to which the build options will be appe= ned @@ -2471,11 +2480,14 @@ class PlatformAutoGen(AutoGen): ToolPath =3D Value[1:] ToolPath =3D mws.handleWsMacro(ToolPath) BuildOptions[Tool][Attr] =3D ToolPath else: Value =3D mws.handleWsMacro(Value) - BuildOptions[Tool][Attr] +=3D " " + Value + if Attr !=3D 'PATH': + BuildOptions[Tool][Attr] +=3D " " + Value + else: + BuildOptions[Tool][Attr] =3D Value if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag != =3D None: # # Override UNI flag only for EDK module. # if 'BUILD' not in BuildOptions: diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Py= thon/GenFds/GenFds.py index c2e9418..b0ebd6a 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -1,9 +1,9 @@ ## @file # generate flash image # -# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the B= SD License # which accompanies this distribution. The full text of the license may = be found at # http://opensource.org/licenses/bsd-license.php @@ -28,11 +28,11 @@ from Workspace.BuildClassObject import ModuleBuildClass= Object import RuleComplexFile from EfiSection import EfiSection import StringIO import Common.TargetTxtClassObject as TargetTxtClassObject import Common.ToolDefClassObject as ToolDefClassObject -import Common.DataType +from Common.DataType import * import Common.GlobalData as GlobalData from Common import EdkLogger from Common.String import * from Common.Misc import DirCache, PathClass from Common.Misc import SaveFileOnChange @@ -43,11 +43,11 @@ from Common.BuildVersion import gBUILD_VERSION from Common.MultipleWorkspace import MultipleWorkspace as mws =20 ## Version and Copyright versionNumber =3D "1.0" + ' ' + gBUILD_VERSION __version__ =3D "%prog Version " + versionNumber -__copyright__ =3D "Copyright (c) 2007 - 2016, Intel Corporation All right= s reserved." +__copyright__ =3D "Copyright (c) 2007 - 2017, Intel Corporation All right= s reserved." =20 ## Tool entrance method # # This method mainly dispatch specific methods per the command line option= s. # If no error found, return zero value so the caller of this tool can know @@ -422,15 +422,15 @@ def BuildOptionPcdValueFormat(TokenSpaceGuidCName, To= kenCName, PcdDatumType, Val # @param KeyStringList Filter for inputs of section generation # @param CurrentArchList Arch list # @param NameGuid The Guid name # def FindExtendTool(KeyStringList, CurrentArchList, NameGuid): + ToolDb =3D ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir= ).ToolsDefTxtDatabase # if user not specify filter, try to deduce it from global data. if KeyStringList =3D=3D None or KeyStringList =3D=3D []: Target =3D GenFdsGlobalVariable.TargetName ToolChain =3D GenFdsGlobalVariable.ToolChainTag - ToolDb =3D ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.Con= fDir).ToolsDefTxtDatabase if ToolChain not in ToolDb['TOOL_CHAIN_TAG']: EdkLogger.error("GenFds", GENFDS_ERROR, "Can not find external= tool because tool tag %s is not defined in tools_def.txt!" % ToolChain) KeyStringList =3D [Target + '_' + ToolChain + '_' + CurrentArchLis= t[0]] for Arch in CurrentArchList: if Target + '_' + ToolChain + '_' + Arch not in KeyStringList: @@ -441,37 +441,62 @@ def FindExtendTool(KeyStringList, CurrentArchList, Na= meGuid): return GenFdsGlobalVariable.GuidToolDefinition[NameGuid] =20 ToolDefinition =3D ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable= .ConfDir).ToolsDefTxtDictionary ToolPathTmp =3D None ToolOption =3D None + ToolPathKey =3D None + ToolOptionKey =3D None for ToolDef in ToolDefinition.items(): if NameGuid =3D=3D ToolDef[1]: KeyList =3D ToolDef[0].split('_') Key =3D KeyList[0] + \ '_' + \ KeyList[1] + \ '_' + \ KeyList[2] if Key in KeyStringList and KeyList[4] =3D=3D 'GUID': - - ToolPath =3D ToolDefinition.get(Key + \ - '_' + \ - KeyList[3] + \ - '_' + \ - 'PATH') - - ToolOption =3D ToolDefinition.get(Key + \ - '_' + \ - KeyList[3] + \ - '_' + \ - 'FLAGS') + ToolPathKey =3D Key + '_' + KeyList[3] + '_PATH' + ToolOptionKey =3D Key + '_' + KeyList[3] + '_FLAGS' + ToolPath =3D ToolDefinition.get(ToolPathKey) + ToolOption =3D ToolDefinition.get(ToolOptionKey) if ToolPathTmp =3D=3D 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)) =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 KeyList[3] + '_PATH' in item[1] or KeyList[3] + '_FLAGS' in= item[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 [TAB_TOD_DEFINES_TARGET, TAB_TOD_DEFINES_TOOL_CHA= IN_TAG, TAB_TOD_DEFINES_TARGET_ARCH] + for Index in range(2, -1, -1): + for Key in dict(BuildOption): + List =3D Key.split('_') + if List[Index] =3D=3D '*': + 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 ToolPathKey in BuildOption.keys(): + ToolPathTmp =3D BuildOption.get(ToolPathKey) + if ToolOptionKey in BuildOption.keys(): + ToolOption =3D BuildOption.get(ToolOptionKey) + GenFdsGlobalVariable.GuidToolDefinition[NameGuid] =3D (ToolPathTmp, To= olOption) return ToolPathTmp, ToolOption =20 ## Parse command line options # --=20 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel