From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 F25F221E47D4D for ; Thu, 24 Aug 2017 06:34:33 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Aug 2017 06:37:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,421,1498546800"; d="scan'208";a="141563217" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga005.jf.intel.com with ESMTP; 24 Aug 2017 06:37:08 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 24 Aug 2017 06:37:08 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 24 Aug 2017 06:37:07 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.183]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.98]) with mapi id 14.03.0319.002; Thu, 24 Aug 2017 21:37:06 +0800 From: "Zhu, Yonghong" To: "Chen, Hesheng" , "edk2-devel@lists.01.org" Thread-Topic: [patch] BaseTools/UPT: Fix UNI file name issue Thread-Index: AQHTG9QtrwuvVDrceka0uaGJdB1XmqKThE7g Date: Thu, 24 Aug 2017 13:37:05 +0000 Message-ID: References: <1503467616-15412-1-git-send-email-hesheng.chen@intel.com> In-Reply-To: <1503467616-15412-1-git-send-email-hesheng.chen@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/UPT: Fix UNI file name issue X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 13:34:34 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: Chen, Hesheng=20 Sent: Wednesday, August 23, 2017 1:54 PM To: edk2-devel@lists.01.org Cc: Zhu, Yonghong Subject: [patch] BaseTools/UPT: Fix UNI file name issue Fix the issue of creating duplicate UNI file names Fix the issue of removin= g packages Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: hesschen --- BaseTools/Source/Python/UPT/Core/DependencyRules.py | 2 ++ BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py | 6 ++++-- BaseTools/Source/Python/UPT/Library/String.py | 4 +++- BaseTools/Source/Python/UPT/Object/POM/ModuleObject.py | 8 +++++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/Python/UPT/Core/DependencyRules.py b/BaseTool= s/Source/Python/UPT/Core/DependencyRules.py index 909c584..26c5a97 100644 --- a/BaseTools/Source/Python/UPT/Core/DependencyRules.py +++ b/BaseTools/Source/Python/UPT/Core/DependencyRules.py @@ -55,6 +55,8 @@ class DependencyRules(object): self.PkgsToBeDepend.extend(self.GenToBeInstalledPkgList(ToBeInstal= ledPkgList)) =20 def GenToBeInstalledPkgList(self, ToBeInstalledPkgList): + if not ToBeInstalledPkgList: + return [] RtnList =3D [] for Dist in ToBeInstalledPkgList: for Package in Dist.PackageSurfaceArea: diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py b/BaseTo= ols/Source/Python/UPT/GenMetaFile/GenInfFile.py index a376f56..d7eaf3e 100644 --- a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py +++ b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py @@ -140,7 +140,9 @@ def ModuleToInf(ModuleObject, PackageObject=3DNone, Dis= tHeader=3DNone): # FileHeader =3D GenHeaderCommentSection(ModuleAbstract, ModuleDescripti= on, ModuleCopyright, ModuleLicense, False, \ DT.TAB_COMMENT_EDK1_SPLIT) - GenModuleUNIEncodeFile(ModuleObject, FileHeader) + ModuleUniFile =3D GenModuleUNIEncodeFile(ModuleObject, FileHeader) + if ModuleUniFile: + ModuleObject.SetModuleUniFile(os.path.basename(ModuleUniFile)) =20 # # Judge whether the INF file is an AsBuild INF. @@ -310,7 +312,7 @@ def GenDefines(ModuleObject): # TAB_INF_DEFINES_VERSION_STRING if ModuleObject.UNIFlag: Statement =3D (u'%s ' % DT.TAB_INF_DEFINES_MODULE_UNI_FILE).ljust(= LeftOffset) + \ - u'=3D %s' % ModuleObject.GetBaseName() + '.uni' + u'=3D %s' % ModuleObject.GetModuleUniFile() SpecialStatementList.append(Statement) =20 # TAB_INF_DEFINES_MODULE_TYPE diff --git a/BaseTools/Source/Python/UPT/Library/String.py b/BaseTools/Sour= ce/Python/UPT/Library/String.py index 89371db..278073e 100644 --- a/BaseTools/Source/Python/UPT/Library/String.py +++ b/BaseTools/Source/Python/UPT/Library/String.py @@ -969,6 +969,7 @@ def GetUniFileName(FilePath, FileName): pass =20 LargestIndex =3D -1 + IndexNotFound =3D True for File in Files: if File.upper().startswith(FileName.upper()) and File.upper().ends= with('.UNI'): Index =3D File.upper().replace(FileName.upper(), '').replace('= .UNI', '') @@ -978,11 +979,12 @@ def GetUniFileName(FilePath, FileName): except Exception: Index =3D -1 else: + IndexNotFound =3D False Index =3D 0 if Index > LargestIndex: LargestIndex =3D Index + 1 =20 - if LargestIndex > -1: + if LargestIndex > -1 and not IndexNotFound: return os.path.normpath(os.path.join(FilePath, FileName + str(Larg= estIndex) + '.uni')) else: return os.path.normpath(os.path.join(FilePath, FileName + '.uni'))= diff --git a/BaseTools/Source/Python/UPT/Object/POM/ModuleObject.py b/Base= Tools/Source/Python/UPT/Object/POM/ModuleObject.py index e85b8fa..4052d28 100644 --- a/BaseTools/Source/Python/UPT/Object/POM/ModuleObject.py +++ b/BaseTools/Source/Python/UPT/Object/POM/ModuleObject.py @@ -1,7 +1,7 @@ ## @file # This file is used to define a class object to describe a module # -# Co= pyright (c) 2011 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights=20 +reserved.
# # This program and the accompanying materials are licensed and made availa= ble # under the terms and conditions of the BSD License which accompanies = this @@ -105,6 +105,7 @@ class ModuleHeaderObject(IdentificationObject, Com= monHeaderObject, BinaryHeaderO self.PiSpecificationVersion =3D '' self.UefiSpecificationVersion =3D '' self.UNIFlag =3D False + self.ModuleUniFile =3D '' # # SpecObject # @@ -208,6 +209,11 @@ class ModuleHeaderObject(IdentificationObject, CommonH= eaderObject, BinaryHeaderO def GetSupArchList(self): return self.SupArchList =20 + def SetModuleUniFile(self, ModuleUniFile): + self.ModuleUniFile =3D ModuleUniFile + + def GetModuleUniFile(self): + return self.ModuleUniFile ## # SourceFileObject # -- 2.7.2.windows.1