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 420E421E25735 for ; Thu, 10 Aug 2017 19:38:03 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Aug 2017 19:40:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,356,1498546800"; d="scan'208";a="117853816" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga004.jf.intel.com with ESMTP; 10 Aug 2017 19:40:16 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 10 Aug 2017 19:40:16 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 10 Aug 2017 19:40:15 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.236]) by shsmsx102.ccr.corp.intel.com ([169.254.2.183]) with mapi id 14.03.0319.002; Fri, 11 Aug 2017 10:40:12 +0800 From: "Zhu, Yonghong" To: "Chen, Hesheng" , "edk2-devel@lists.01.org" Thread-Topic: [patch] BaseTools/UPT: Support Multiple Installation Thread-Index: AQHTEbP5VcXAUPfLWUe0oJuGsS2mIqJ+csBA Date: Fri, 11 Aug 2017 02:40:12 +0000 Message-ID: References: <1502354207-13864-1-git-send-email-hesheng.chen@intel.com> In-Reply-To: <1502354207-13864-1-git-send-email-hesheng.chen@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMGU1NjBlNDktZDYyNS00YWIxLTg2MjItNzRhYTUzMmJjZWQxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Im5QSEhUZDhHblJkbHhNZTZkSWRwT0t3dWdOUWhTbWtBUXFYeWV2ZUROXC9ZPSJ9 x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [patch] BaseTools/UPT: Support Multiple Installation 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: Fri, 11 Aug 2017 02:38:03 -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: Thursday, August 10, 2017 4:37 PM To: edk2-devel@lists.01.org Cc: Zhu, Yonghong Subject: [patch] BaseTools/UPT: Support Multiple Installation Add a new feature to UPT to support installing multiple DIST packages in on= e time. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: hesschen --- .../Source/Python/UPT/Core/DependencyRules.py | 18 ++++- .../Python/UPT/GenMetaFile/GenMetaFileMisc.py | 90 +++++++++++++-----= --- BaseTools/Source/Python/UPT/InstallPkg.py | 94 +++++++++++-------= ---- BaseTools/Source/Python/UPT/Library/GlobalData.py | 9 ++- BaseTools/Sou= rce/Python/UPT/Logger/StringTable.py | 4 +- BaseTools/Source/Python/UPT/ReplacePkg.py | 8 +- BaseTools/Source/Python/UPT/TestInstall.py | 8 +- BaseTools/Source/Python/UPT/UPT.py | 16 ++-- 8 files changed, 145 insertions(+), 102 deletions(-) diff --git a/BaseTools/Source/Python/UPT/Core/DependencyRules.py b/BaseTool= s/Source/Python/UPT/Core/DependencyRules.py index 57f7b40..909c584 100644 --- a/BaseTools/Source/Python/UPT/Core/DependencyRules.py +++ b/BaseTools/Source/Python/UPT/Core/DependencyRules.py @@ -44,12 +44,24 @@ DEPEX_CHECK_PACKAGE_NOT_FOUND, DEPEX_CHECK_DP_NOT_FOUND= ) =3D (0, 1, 2, 3) # @param object: Inherited from object class # class DependencyRules(object): - def __init__(self, Datab): + def __init__(self, Datab, ToBeInstalledPkgList=3DNone): self.IpiDb =3D Datab self.WsPkgList =3D GetWorkspacePackage() self.WsModuleList =3D GetWorkspaceModule() - self.PkgsToBeDepend =3D [] + + self.PkgsToBeDepend =3D [(PkgInfo[1], PkgInfo[2]) for PkgInfo in=20 + self.WsPkgList] + + # Add package info from the DIST to be installed. + =20 + self.PkgsToBeDepend.extend(self.GenToBeInstalledPkgList(ToBeInstalledP + kgList)) =20 + def GenToBeInstalledPkgList(self, ToBeInstalledPkgList): + RtnList =3D [] + for Dist in ToBeInstalledPkgList: + for Package in Dist.PackageSurfaceArea: + RtnList.append((Package[0], Package[1])) + + return RtnList + ## Check whether a module exists by checking the Guid+Version+Name+Pat= h combination # # @param Guid: Guid of a module @@ -182,7 +194,6 @@ class DependencyRules(object): # False else # def CheckInstallDpDepexSatisfied(self, DpObj): - self.PkgsToBeDepend =3D [(PkgInfo[1], PkgInfo[2]) for PkgInfo in s= elf.WsPkgList] return self.CheckDpDepexSatisfied(DpObj) =20 # # Check whether multiple DP depex satisfied by current workspace for= Install @@ -192,7 +203,6 @@ class DependencyRules(object): # False else # def CheckTestInstallPdDepexSatisfied(self, DpObjList): - self.PkgsToBeDepend =3D [(PkgInfo[1], PkgInfo[2]) for PkgInfo in s= elf.WsPkgList] for DpObj in DpObjList: if self.CheckDpDepexSatisfied(DpObj): for PkgKey in DpObj.PackageSurfaceArea.keys(): diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py b/B= aseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py index 3c6c9ee..ae8dc85 100644 --- a/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py +++ b/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py @@ -79,6 +79,10 @@ def AddExternToDefineSec(SectionDict, Arch, ExternList): # Using TokenSpaceGuidValue and Token to obtain PcdName from DEC file # = def ObtainPcdName(Packages, TokenSpaceGuidValue, Token): + TokenSpaceGuidName =3D '' + PcdCName =3D '' + TokenSpaceGuidNameFound =3D False + for PackageDependency in Packages: # # Generate generic comment @@ -86,6 +90,7 @@ def ObtainPcdName(Packages, TokenSpaceGuidValue, Token): Guid =3D PackageDependency.GetGuid() Version =3D PackageDependency.GetVersion() =20 + Path =3D None # # find package path/name # @@ -95,41 +100,58 @@ def ObtainPcdName(Packages, TokenSpaceGuidValue, Token= ): Path =3D PkgInfo[3] break =20 - DecFile =3D None - if Path not in GlobalData.gPackageDict: - DecFile =3D Dec(Path) - GlobalData.gPackageDict[Path] =3D DecFile - else: - DecFile =3D GlobalData.gPackageDict[Path] - - DecGuidsDict =3D DecFile.GetGuidSectionObject().ValueDict - DecPcdsDict =3D DecFile.GetPcdSectionObject().ValueDict - - TokenSpaceGuidName =3D '' - PcdCName =3D '' - TokenSpaceGuidNameFound =3D False - - # - # Get TokenSpaceGuidCName from Guids section=20 - # - for GuidKey in DecGuidsDict: - GuidList =3D DecGuidsDict[GuidKey] - for GuidItem in GuidList: - if TokenSpaceGuidValue.upper() =3D=3D GuidItem.GuidString.= upper(): - TokenSpaceGuidName =3D GuidItem.GuidCName - TokenSpaceGuidNameFound =3D True + # The dependency package in workspace + if Path: + DecFile =3D None + if Path not in GlobalData.gPackageDict: + DecFile =3D Dec(Path) + GlobalData.gPackageDict[Path] =3D DecFile + else: + DecFile =3D GlobalData.gPackageDict[Path] + + DecGuidsDict =3D DecFile.GetGuidSectionObject().ValueDict + DecPcdsDict =3D DecFile.GetPcdSectionObject().ValueDict + + TokenSpaceGuidName =3D '' + PcdCName =3D '' + TokenSpaceGuidNameFound =3D False + + # + # Get TokenSpaceGuidCName from Guids section + # + for GuidKey in DecGuidsDict: + GuidList =3D DecGuidsDict[GuidKey] + for GuidItem in GuidList: + if TokenSpaceGuidValue.upper() =3D=3D GuidItem.GuidStr= ing.upper(): + TokenSpaceGuidName =3D GuidItem.GuidCName + TokenSpaceGuidNameFound =3D True + break + if TokenSpaceGuidNameFound: break - if TokenSpaceGuidNameFound: - break - # - # Retrieve PcdCName from Pcds Section - # - for PcdKey in DecPcdsDict: - PcdList =3D DecPcdsDict[PcdKey] - for PcdItem in PcdList: - if TokenSpaceGuidName =3D=3D PcdItem.TokenSpaceGuidCName a= nd Token =3D=3D PcdItem.TokenValue: - PcdCName =3D PcdItem.TokenCName - return TokenSpaceGuidName, PcdCName + # + # Retrieve PcdCName from Pcds Section + # + for PcdKey in DecPcdsDict: + PcdList =3D DecPcdsDict[PcdKey] + for PcdItem in PcdList: + if TokenSpaceGuidName =3D=3D PcdItem.TokenSpaceGuidCNa= me and Token =3D=3D PcdItem.TokenValue: + PcdCName =3D PcdItem.TokenCName + return TokenSpaceGuidName, PcdCName + + # The dependency package in ToBeInstalledDist + else: + for Dist in GlobalData.gTO_BE_INSTALLED_DIST_LIST: + for Package in Dist.PackageSurfaceArea.values(): + if Guid =3D=3D Package.Guid: + for GuidItem in Package.GuidList: + if TokenSpaceGuidValue.upper() =3D=3D GuidItem= .Guid.upper(): + TokenSpaceGuidName =3D GuidItem.CName + TokenSpaceGuidNameFound =3D True + break + for PcdItem in Package.PcdList: + if TokenSpaceGuidName =3D=3D PcdItem.TokenSpac= eGuidCName and Token =3D=3D PcdItem.Token: + PcdCName =3D PcdItem.CName + return TokenSpaceGuidName, PcdCName =20 return TokenSpaceGuidName, PcdCName =20 diff --git a/BaseTools/Source/Python/UPT/InstallPkg.py b/BaseTools/Source/P= ython/UPT/InstallPkg.py index 0e99d2f..a8d0e1e 100644 --- a/BaseTools/Source/Python/UPT/InstallPkg.py +++ b/BaseTools/Source/Python/UPT/InstallPkg.py @@ -1,7 +1,7 @@ ## @file # Install distribution package. # -# Copyright (c) 2011 - 2015, 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 @@ -133,16 +133,16 @@ def InstallNewFile(WorkspaceDir, File): # # UnZipDp # -def UnZipDp(WorkspaceDir, DpPkgFileName): +def UnZipDp(WorkspaceDir, DpPkgFileName, Index=3D1): ContentZipFile =3D None Logger.Quiet(ST.MSG_UZIP_PARSE_XML) DistFile =3D PackageFile(DpPkgFileName) =20 DpDescFileName, ContentFileName =3D GetDPFile(DistFile.GetZipFile()) =20 - GlobalData.gUNPACK_DIR =3D os.path.normpath(os.path.join(WorkspaceDir,= ".tmp")) - DistPkgFile =3D DistFile.UnpackFile(DpDescFileName, - os.path.normpath(os.path.join(GlobalData.gUNPACK_DIR, DpDescFileNa= me))) + TempDir =3D os.path.normpath(os.path.join(WorkspaceDir, "Conf/.tmp%s" = % str(Index))) + GlobalData.gUNPACK_DIR.append(TempDir) + DistPkgFile =3D DistFile.UnpackFile(DpDescFileName,=20 + os.path.normpath(os.path.join(TempDir, DpDescFileName))) if not DistPkgFile: Logger.Error("InstallPkg", FILE_NOT_FOUND, ST.ERR_FILE_BROKEN %DpD= escFileName) =20 @@ -159,23 +159,15 @@ def UnZipDp(WorkspaceDir, DpPkgFileName): # # unzip contents.zip file # - ContentFile =3D DistFile.UnpackFile(ContentFileName, - os.path.normpath(os.path.join(GlobalData.gUNPACK_DIR, ContentFileN= ame))) + ContentFile =3D DistFile.UnpackFile(ContentFileName,=20 + os.path.normpath(os.path.join(TempDir, ContentFileName))) if not ContentFile: Logger.Error("InstallPkg", FILE_NOT_FOUND, ST.ERR_FILE_BROKEN % ContentFileName) =20 - FilePointer =3D __FileHookOpen__(ContentFile, "rb") - # - # Assume no archive comment. - # - FilePointer.seek(0, SEEK_SET) - FilePointer.seek(0, SEEK_END) # # Get file size # =20 - FileSize =3D FilePointer.tell() - FilePointer.close() + FileSize =3D os.path.getsize(ContentFile) =20 if FileSize !=3D 0: =20 ContentZipFile =3D PackageFile(ContentFile) @@ -202,8 +194,8 @@ de= f GetPackageList(DistPkg, Dep, WorkspaceDir, Options, ContentZipFile, Modul= eLi PackagePath =3D Path Package =3D DistPkg.PackageSurfaceArea[Guid, Version, Path] Logger.Info(ST.MSG_INSTALL_PACKAGE % Package.GetName()) - if Dep.CheckPackageExists(Guid, Version): - Logger.Info(ST.WRN_PACKAGE_EXISTED %(Guid, Version)) +# if Dep.CheckPackageExists(Guid, Version): +# Logger.Info(ST.WRN_PACKAGE_EXISTED %(Guid, Version)) if Options.UseGuidedPkgPath: GuidedPkgPath =3D "%s_%s_%s" % (Package.GetName(), Guid, Versi= on) NewPackagePath =3D InstallNewPackage(WorkspaceDir, GuidedPkgPa= th, Options.CustomPath) @@ -509,29 +501,40 @@ def GenToolMisc(DistPkg, Work= spaceDir, ContentZipFile): # @param Options: command Options # def Main(Options =3D None): - ContentZipFile, DistFile =3D None, None - try: DataBase =3D GlobalData.gDB WorkspaceDir =3D GlobalData.gWORKSPACE if not Options.PackageFile: Logger.Error("InstallPkg", OPTION_MISSING, ExtraData=3DST.ERR_= SPECIFY_PACKAGE) =20 - # - # unzip dist.pkg file - # - DistPkg, ContentZipFile, DpPkgFileName, DistFile =3D UnZipDp(Works= paceDir, Options.PackageFile) + # Get all Dist Info + DistInfoList =3D [] + DistPkgList =3D [] + Index =3D 1 + for ToBeInstalledDist in Options.PackageFile: + # + # unzip dist.pkg file + # + DistInfoList.append(UnZipDp(WorkspaceDir, ToBeInstalledDist, I= ndex)) + DistPkgList.append(DistInfoList[-1][0]) + Index +=3D 1 =20 - # - # check dependency - # - Dep =3D DependencyRules(DataBase) - CheckInstallDpx(Dep, DistPkg) + # + # Add dist + # + =20 + GlobalData.gTO_BE_INSTALLED_DIST_LIST.append(DistInfoList[-1][0]) =20 - # - # Install distribution - # - InstallDp(DistPkg, DpPkgFileName, ContentZipFile, Options, Dep, Wo= rkspaceDir, DataBase) + # Check for dependency + Dep =3D DependencyRules(DataBase, DistPkgList) + + for ToBeInstalledDist in DistInfoList: + CheckInstallDpx(Dep, ToBeInstalledDist[0],=20 + ToBeInstalledDist[2]) + + # + # Install distribution + # + InstallDp(ToBeInstalledDist[0], ToBeInstalledDist[2], ToBeInst= alledDist[1], + Options, Dep, WorkspaceDir, DataBase) ReturnCode =3D 0 =20 except FatalError, XExcept: @@ -556,16 +559,16 @@ def Main(Options =3D None): Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(), platform) + format_exc()) finally: - if ReturnCode !=3D UPT_ALREADY_INSTALLED_ERROR: - Logger.Quiet(ST.MSG_REMOVE_TEMP_FILE_STARTED) - if DistFile: - DistFile.Close() - if ContentZipFile: - ContentZipFile.Close() - if GlobalData.gUNPACK_DIR: - rmtree(GlobalData.gUNPACK_DIR) - GlobalData.gUNPACK_DIR =3D None - Logger.Quiet(ST.MSG_REMOVE_TEMP_FILE_DONE) + Logger.Quiet(ST.MSG_REMOVE_TEMP_FILE_STARTED) + for ToBeInstalledDist in DistInfoList: + if ToBeInstalledDist[3]: + ToBeInstalledDist[3].Close() + if ToBeInstalledDist[1]: + ToBeInstalledDist[1].Close() + for TempDir in GlobalData.gUNPACK_DIR: + rmtree(TempDir) + GlobalData.gUNPACK_DIR =3D [] + Logger.Quiet(ST.MSG_REMOVE_TEMP_FILE_DONE) if ReturnCode =3D=3D 0: Logger.Quiet(ST.MSG_FINISH) return ReturnCode @@ -609,14 +612,15 @@ def BackupDist(DpPkgFileName, Guid, Version, Workspac= eDir): # @param Dep: the DependencyRules instance that used to check dependenc= y # @param DistPkg: the distribution object # -def CheckInstallDpx(Dep, DistPkg): +def CheckInstallDpx(Dep, DistPkg, DistPkgFileName): # # Check distribution package installed or not # if Dep.CheckDpExists(DistPkg.Header.GetGuid(), DistPkg.Header.GetVersion()): - Logger.Error("InstallPkg", UPT_ALREADY_INSTALLED_ERROR, - ST.WRN_DIST_PKG_INSTALLED) + Logger.Error("InstallPkg", + UPT_ALREADY_INSTALLED_ERROR, + ST.WRN_DIST_PKG_INSTALLED %=20 + os.path.basename(DistPkgFileName)) # # Check distribution dependency (all module dependency should be # satisfied) diff --git a/BaseTools/Source/Python/UPT/Library/GlobalData.py b/BaseTools/= Source/Python/UPT/Library/GlobalData.py index 8f446d4..1ae2417 100644 --- a/BaseTools/Source/Python/UPT/Library/GlobalData.py +++ b/BaseTools/Source/Python/UPT/Library/GlobalData.py @@ -1,7 +1,7 @@ ## @file # This file is used to define common static strings and global data used b= y UPT # -# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserv= ed.
+# 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 @@ -87,7 +87,7 @@ gWARNING_AS_ERROR =3D False # # Used to specify th= e temp directory to hold the unpacked distribution files # -gUNPACK_DIR = =3D None +gUNPACK_DIR =3D [] =20 # # Flag used to mark whether the INF file is Binary INF or not. @@ -109,3 +109,8 @@ gPackageDict =3D {} # {FilePath: FileObj} # gLIBINSTANCEDICT =3D {} + +# +# Store the list of DIST +# +gTO_BE_INSTALLED_DIST_LIST =3D [] diff --git a/BaseTools/Source/Python/UPT/Logger/StringTable.py b/BaseTools/= Source/Python/UPT/Logger/StringTable.py index 4c42661..83ae0ae 100644 --- a/BaseTools/Source/Python/UPT/Logger/StringTable.py +++ b/BaseTools/Source/Python/UPT/Logger/StringTable.py @@ -1,7 +1,7 @@ ## @file # This file is used to define strings used in the UPT tool # -# Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.
# # This program and the accompanying materials are licensed and made availa= ble=20 # under the terms and conditions of the BSD License which accompanies this= =20 @@ -785,7 +785,7 @@ WRN_MODULE_EXISTED =3D _("This module already ex= ists: %s") WRN_FILE_EXISTED =3D _("This file already exists: %s") WRN_FILE_NOT_OVERWRITTEN =3D \ _("This file already exist and cannot be overwritten: %s") -WRN_DIST_PKG_INSTALLED =3D _("This distribution package has previously bee= n installed.") +WRN_DIST_PKG_INSTALLED =3D _("This distribution package %s has previously = been installed.") WRN_DIST_NOT_FOUND =3D _( "Distribution is not found at location %s") WRN_MULTI_PCD_RANGES =3D _( diff --git a/BaseTools/Source/Python/UPT/ReplacePkg.py b/BaseTools/Source/P= ython/UPT/ReplacePkg.py index 9f231f9..efbf68a 100644 --- a/BaseTools/Source/Python/UPT/ReplacePkg.py +++ b/BaseTools/Source/Python/UPT/ReplacePkg.py @@ -1,7 +1,7 @@ ## @file # Replace distribution package. # -# Copyright (c) 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.
# # This program and the accompanying materials are licensed and made availa= ble=20 # under the terms and conditions of the BSD License which accompanies this= =20 @@ -99,9 +99,9 @@ def Main(Options =3D None): DistFile.Close() if ContentZipFile: ContentZipFile.Close() - if GlobalData.gUNPACK_DIR: - rmtree(GlobalData.gUNPACK_DIR) - GlobalData.gUNPACK_DIR =3D None + for TempDir in GlobalData.gUNPACK_DIR: + rmtree(TempDir) + GlobalData.gUNPACK_DIR =3D [] Logger.Quiet(ST.MSG_REMOVE_TEMP_FILE_DONE) =20 =20 if ReturnCode =3D=3D 0: diff --git a/BaseTools/Source/Python/UPT/TestInstall.py b/BaseTools/Source/= Python/UPT/TestInstall.py index dae4415..899cae5 100644 --- a/BaseTools/Source/Python/UPT/TestInstall.py +++ b/BaseTools/Source/Python/UPT/TestInstall.py @@ -1,7 +1,7 @@ # # @file # Test Install distribution package # -# Copyright (c) 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2016 - 2017, Intel Corporation. All rights 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 @@ -90,9 +90,9 @@ def Main(Options=3DNone): DistFile.Close() if ContentZipFile: ContentZipFile.Close() - if GlobalData.gUNPACK_DIR: - shutil.rmtree(GlobalData.gUNPACK_DIR) - GlobalData.gUNPACK_DIR =3D None + for TempDir in GlobalData.gUNPACK_DIR: + shutil.rmtree(TempDir) + GlobalData.gUNPACK_DIR =3D [] Logger.Quiet(ST.MSG_REMOVE_TEMP_FILE_DONE) if ReturnCode =3D=3D 0: Logger.Quiet(ST.MSG_FINISH) diff --git a/BaseTools/Source/Python/UPT/UPT.py b/BaseTools/Source/Python/U= PT/UPT.py index d98b469..325b96b 100644 --- a/BaseTools/Source/Python/UPT/UPT.py +++ b/BaseTools/Source/Python/UPT/UPT.py @@ -120,7 +120,7 @@ def Main(): =20 Parser.add_option("-q", "--quiet", action=3D"store_true", dest=3D"opt_= quiet", help=3DST.HLP_RETURN_AND_DISPLAY) =20 - Parser.add_option("-i", "--install", action=3D"store", type=3D"string"= , dest=3D"Install_Distribution_Package_File", + Parser.add_option("-i", "--install", action=3D"append", type=3D"string= ", dest=3D"Install_Distribution_Package_File", help=3DST.HLP_SPECIFY_PACKAGE_NAME_INSTALL) =20 Parser.add_option("-c", "--create", action=3D"store", type=3D"string",= dest=3D"Create_Distribution_Package_File", @@ -228,12 +228,14 @@ def Main(): RunModule =3D MkPkg.Main =20 elif Opt.PackFileToInstall: - if not Opt.PackFileToInstall.endswith('.dist'): - Logger.Error("InstallPkg", FILE_TYPE_MISMATCH, ExtraData= =3DST.ERR_DIST_EXT_ERROR % Opt.PackFileToInstall) - - AbsPath =3D GetFullPathDist(Opt.PackFileToInstall, WorkspaceDi= r) - if not AbsPath: - Logger.Error("InstallPkg", FILE_NOT_FOUND, ST.ERR_INSTALL_= DIST_NOT_FOUND % Opt.PackFileToInstall) + AbsPath =3D [] + for Item in Opt.PackFileToInstall: + if not Item.endswith('.dist'): + Logger.Error("InstallPkg", FILE_TYPE_MISMATCH, ExtraDa= ta=3DST.ERR_DIST_EXT_ERROR % Item) + + AbsPath.append(GetFullPathDist(Item, WorkspaceDir)) + if not AbsPath: + Logger.Error("InstallPkg", FILE_NOT_FOUND, ST.ERR_INST= ALL_DIST_NOT_FOUND % Item) =20 Opt.PackFileToInstall =3D AbsPath setattr(Opt, 'PackageFile', Opt.PackFileToInstall) --=20 2.7.2.windows.1