## @file\r
# Replace distribution package.\r
#\r
-# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>\r
#\r
-# This program and the accompanying materials are licensed and made available \r
-# under the terms and conditions of the BSD License which accompanies this \r
-# distribution. The full text of the license may be found at \r
+# This program and the accompanying materials are licensed and made available\r
+# under the terms and conditions of the BSD License which accompanies this\r
+# distribution. The full text of the license may be found at\r
# http://opensource.org/licenses/bsd-license.php\r
#\r
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WorkspaceDir = GlobalData.gWORKSPACE\r
Dep = DependencyRules(DataBase)\r
DistPkg, ContentZipFile, DpPkgFileName, DistFile = UnZipDp(WorkspaceDir, Options.PackFileToReplace)\r
- \r
+\r
StoredDistFile, OrigDpGuid, OrigDpVersion = GetInstalledDpInfo(Options.PackFileToBeReplaced, \\r
Dep, DataBase, WorkspaceDir)\r
- \r
+\r
#\r
# check dependency\r
#\r
CheckReplaceDpx(Dep, DistPkg, OrigDpGuid, OrigDpVersion)\r
- \r
+\r
#\r
# Remove the old distribution\r
#\r
RemoveDist(OrigDpGuid, OrigDpVersion, StoredDistFile, DataBase, WorkspaceDir, Options.Yes)\r
- \r
+\r
#\r
# Install the new distribution\r
#\r
InstallDp(DistPkg, DpPkgFileName, ContentZipFile, Options, Dep, WorkspaceDir, DataBase)\r
ReturnCode = 0\r
- \r
+\r
except FatalError as XExcept:\r
ReturnCode = XExcept.args[0]\r
if Logger.GetLevel() <= Logger.DEBUG_9:\r
for TempDir in GlobalData.gUNPACK_DIR:\r
rmtree(TempDir)\r
GlobalData.gUNPACK_DIR = []\r
- Logger.Quiet(ST.MSG_REMOVE_TEMP_FILE_DONE) \r
+ Logger.Quiet(ST.MSG_REMOVE_TEMP_FILE_DONE)\r
\r
if ReturnCode == 0:\r
Logger.Quiet(ST.MSG_FINISH)\r
- \r
+\r
return ReturnCode\r
\r
def CheckReplaceDpx(Dep, DistPkg, OrigDpGuid, OrigDpVersion):\r
if Dep.CheckDpExists(DistPkg.Header.GetGuid(), DistPkg.Header.GetVersion()):\r
Logger.Error("\nReplacePkg", UPT_ALREADY_INSTALLED_ERROR,\r
ST.WRN_DIST_PKG_INSTALLED,\r
- ExtraData=ST.MSG_REPLACE_ALREADY_INSTALLED_DP) \r
+ ExtraData=ST.MSG_REPLACE_ALREADY_INSTALLED_DP)\r
\r
#\r
# check whether the original distribution could be replaced by new distribution\r
- # \r
+ #\r
Logger.Verbose(ST.MSG_CHECK_DP_FOR_REPLACE%(NewDpInfo, OrigDpInfo))\r
DepInfoResult = Dep.CheckDpDepexForReplace(OrigDpGuid, OrigDpVersion, NewDpPkgList)\r
Replaceable = DepInfoResult[0]\r
if not Replaceable:\r
Logger.Error("\nReplacePkg", UNKNOWN_ERROR,\r
ST.ERR_PACKAGE_NOT_MATCH_DEPENDENCY)\r
- \r
+\r
#\r
# check whether new distribution could be installed by dependency rule\r
#\r