]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Update ECC tool to support multiple workspaces
authorLi YangX <yangx.li@intel.com>
Thu, 8 Oct 2015 09:28:51 +0000 (09:28 +0000)
committerlgao4 <lgao4@Edk2>
Thu, 8 Oct 2015 09:28:51 +0000 (09:28 +0000)
Update ECC to refer MultipleWorkspace class to convert
the file path from WORKSPACE and PACKAGES_PATH.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Li YangX <yangx.li@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18581 6f19259b-4bc3-4df7-8a09-765794883524

BaseTools/Source/Python/Ecc/Check.py
BaseTools/Source/Python/Ecc/Ecc.py
BaseTools/Source/Python/Ecc/MetaDataParser.py

index c2be1b01d31956017184feafe2436275024dea48..5e5c8e72e4002369a36ac5786227b6402d5202d1 100644 (file)
@@ -19,6 +19,7 @@ from MetaDataParser import ParseHeaderCommentSection
 import EccGlobalData\r
 import c\r
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
+from Common.MultipleWorkspace import MultipleWorkspace as mws\r
 \r
 ## Check\r
 #\r
@@ -380,9 +381,7 @@ class Check(object):
             for Key in RecordDict:\r
                 if len(RecordDict[Key]) > 1:\r
                     for Item in RecordDict[Key]:\r
-                        Path = Item[1].replace(EccGlobalData.gWorkspace, '')\r
-                        if Path.startswith('\\') or Path.startswith('/'):\r
-                            Path = Path[1:]\r
+                        Path = mws.relpath(Item[1], EccGlobalData.gWorkspace)\r
                         if not EccGlobalData.gException.IsException(ERROR_INCLUDE_FILE_CHECK_NAME, Path):\r
                             EccGlobalData.gDb.TblReport.Insert(ERROR_INCLUDE_FILE_CHECK_NAME, OtherMsg="The file name for [%s] is duplicate" % Path, BelongsToTable='File', BelongsToItem=Item[0])\r
 \r
@@ -653,7 +652,7 @@ class Check(object):
                 if LibraryClass[1].upper() == 'NULL' or LibraryClass[1].startswith('!ifdef') or LibraryClass[1].startswith('!ifndef') or LibraryClass[1].endswith('!endif'):\r
                     continue\r
                 else:\r
-                    LibraryIns = os.path.normpath(os.path.join(EccGlobalData.gWorkspace, LibraryClass[2]))\r
+                    LibraryIns = os.path.normpath(mws.join(EccGlobalData.gWorkspace, LibraryClass[2]))\r
                     SqlCommand = """select Value3 from Inf where BelongsToFile =\r
                                     (select ID from File where lower(FullPath) = lower('%s'))\r
                                     and Value2 = '%s'""" % (LibraryIns, 'LIBRARY_CLASS')\r
@@ -729,7 +728,7 @@ class Check(object):
             for Record in RecordSet:\r
                 FdfID = Record[0]\r
                 FilePath = Record[1]\r
-                FilePath = os.path.normpath(os.path.join(EccGlobalData.gWorkspace, FilePath))\r
+                FilePath = os.path.normpath(mws.join(EccGlobalData.gWorkspace, FilePath))\r
                 SqlCommand = """select ID from Inf where Model = %s and BelongsToFile = (select ID from File where FullPath like '%s')\r
                                 """ % (MODEL_EFI_SOURCE_FILE, FilePath)\r
                 NewRecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)\r
@@ -913,9 +912,7 @@ class Check(object):
         RecordSet = Table.Exec(SqlCommand)\r
         Path = ""\r
         for Record in RecordSet:\r
-            Path = Record[0].replace(EccGlobalData.gWorkspace, '')\r
-            if Path.startswith('\\') or Path.startswith('/'):\r
-                Path = Path[1:]\r
+            Path = mws.relpath(Record[0], EccGlobalData.gWorkspace)\r
         return Path\r
 \r
     # Check whether two module INFs under one workspace has the same FILE_GUID value\r
index ec8f6c22cfa46be93d4f1a47f8874cd52ee8f2ac..c2ad4faff4466b82b08c279a9858ef5c4ac870c7 100644 (file)
@@ -38,6 +38,7 @@ import c
 import re, string\r
 from Exception import *\r
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
+from Common.MultipleWorkspace import MultipleWorkspace as mws\r
 \r
 ## Ecc\r
 #\r
@@ -70,8 +71,13 @@ class Ecc(object):
         #\r
         WorkspaceDir = os.path.normcase(os.path.normpath(os.environ["WORKSPACE"]))\r
         os.environ["WORKSPACE"] = WorkspaceDir\r
+        \r
+        # set multiple workspace\r
+        PackagesPath = os.getenv("PACKAGES_PATH")\r
+        mws.setWs(WorkspaceDir, PackagesPath)\r
+        \r
         if "ECP_SOURCE" not in os.environ:\r
-            os.environ["ECP_SOURCE"] = os.path.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg)\r
+            os.environ["ECP_SOURCE"] = mws.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg)\r
         if "EFI_SOURCE" not in os.environ:\r
             os.environ["EFI_SOURCE"] = os.environ["ECP_SOURCE"]\r
         if "EDK_SOURCE" not in os.environ:\r
index d80a5cff5d680fb0dae3dc89fb2ca2d66163c37e..82ede3eb330c93dff68c2ca9692f6f47fb0e2899 100644 (file)
@@ -14,6 +14,7 @@
 import Common.LongFilePathOs as os\r
 from CommonDataClass.DataClass import *\r
 from EccToolError import *\r
+from Common.MultipleWorkspace import MultipleWorkspace as mws\r
 import EccGlobalData\r
 import re\r
 ## Get the inlcude path list for a source file\r
@@ -33,8 +34,8 @@ def GetIncludeListOfFile(WorkSpace, Filepath, Db):
                 % (MODEL_META_DATA_PACKAGE, MODEL_EFI_SOURCE_FILE, '\\', Filepath)\r
     RecordSet = Db.TblFile.Exec(SqlCommand)\r
     for Record in RecordSet:\r
-        DecFullPath = os.path.normpath(os.path.join(WorkSpace, Record[0]))\r
-        InfFullPath = os.path.normpath(os.path.join(WorkSpace, Record[1]))\r
+        DecFullPath = os.path.normpath(mws.join(WorkSpace, Record[0]))\r
+        InfFullPath = os.path.normpath(mws.join(WorkSpace, Record[1]))\r
         (DecPath, DecName) = os.path.split(DecFullPath)\r
         (InfPath, InfName) = os.path.split(InfFullPath)\r
         SqlCommand = """select Value1 from Dec where BelongsToFile =\r