|
From: <js...@us...> - 2011-08-11 09:23:37
|
Revision: 2246
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2246&view=rev
Author: jsu1
Date: 2011-08-11 08:08:37 +0000 (Thu, 11 Aug 2011)
Log Message:
-----------
Support distribution file relative path to current working directory during install.
Signed-off-by: jsu1
Reviewed-by: gikidy
Reviewed-by: yingke
Modified Paths:
--------------
trunk/BaseTools/Source/Python/UPT/InstallPkg.py
trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py
trunk/BaseTools/Source/Python/UPT/UPT.py
Modified: trunk/BaseTools/Source/Python/UPT/InstallPkg.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/InstallPkg.py 2011-08-10 02:19:55 UTC (rev 2245)
+++ trunk/BaseTools/Source/Python/UPT/InstallPkg.py 2011-08-11 08:08:37 UTC (rev 2246)
@@ -136,7 +136,7 @@
def UnZipDp(WorkspaceDir, Options, DataBase):
ContentZipFile = None
Logger.Quiet(ST.MSG_UZIP_PARSE_XML)
- DpPkgFileName = os.path.normpath(os.path.join(WorkspaceDir, Options.PackageFile))
+ DpPkgFileName = Options.PackageFile
DistFile = PackageFile(DpPkgFileName)
DpDescFileName, ContentFileName = GetDPFile(DistFile.GetZipFile())
Modified: trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py 2011-08-10 02:19:55 UTC (rev 2245)
+++ trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py 2011-08-11 08:08:37 UTC (rev 2246)
@@ -543,6 +543,8 @@
ERR_INSTALL_FILE_DEC_FILE_ERROR = _("Could not obtain the TokenSpaceGuidCName and the PcdCName from the DEC files "
"that the package depends on for this pcd entry: TokenValue: %s Token: %s")
ERR_NOT_SUPPORTED_SA_MODULE = _("Stand-alone module distribution does not allow EDK 1 INF")
+ERR_INSTALL_DIST_NOT_FOUND = \
+_("Distribution file to be installed is not found in current working directory or workspace: %s")
#
# Expression error message
Modified: trunk/BaseTools/Source/Python/UPT/UPT.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/UPT.py 2011-08-10 02:19:55 UTC (rev 2245)
+++ trunk/BaseTools/Source/Python/UPT/UPT.py 2011-08-11 08:08:37 UTC (rev 2246)
@@ -178,6 +178,27 @@
elif Opt.PackFileToInstall:
if not Opt.PackFileToInstall.endswith('.dist'):
Logger.Error("InstallPkg", FILE_TYPE_MISMATCH, ExtraData=ST.ERR_DIST_EXT_ERROR % Opt.PackFileToInstall)
+
+ #
+ # check file existence, if not absolute path, then try current working directory, then $(WORKSPACE)
+ #
+ Existed = True
+ if os.path.isabs(Opt.PackFileToInstall):
+ if not (os.path.exists(Opt.PackFileToInstall) and os.path.isfile(Opt.PackFileToInstall)):
+ Existed = False
+ else:
+ AbsPath = os.path.normpath(os.path.join(os.getcwd(), Opt.PackFileToInstall))
+ if not (os.path.exists(AbsPath) and os.path.isfile(AbsPath)):
+ AbsPath = os.path.normpath(os.path.join(WorkspaceDir, Opt.PackFileToInstall))
+ if not (os.path.exists(AbsPath) and os.path.isfile(AbsPath)):
+ Existed = False
+
+ if Existed:
+ Opt.PackFileToInstall = AbsPath
+
+ if not Existed:
+ Logger.Error("InstallPkg", FILE_NOT_FOUND, ST.ERR_INSTALL_DIST_NOT_FOUND % Opt.PackFileToInstall)
+
setattr(Opt, 'PackageFile', Opt.PackFileToInstall)
RunModule = InstallPkg.Main
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|