]> git.proxmox.com Git - mirror_edk2.git/commitdiff
.pytool/EccCheck: Rename edk2_path as workspace_path
authorPierre Gondois <Pierre.Gondois@arm.com>
Tue, 6 Jul 2021 20:55:39 +0000 (04:55 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 12 Jul 2021 14:53:55 +0000 (14:53 +0000)
The edk2 path and the workspace path are identical when running
Ecc on edk2. When running Ecc on another repository
(e.g.: edk2-platforms with edk2 as a submodule of edk2-platforms),
these directories are different. Indeed, in the latter configuration,
Ecc must run git commands on the tested repository, i.e. the workspace
directory, edk2-platforms.

Thus, rename edk2_path as workspace_path.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
.pytool/Plugin/EccCheck/EccCheck.py

index bb93446441de17026bb568cf2754194a4f4c1aea..fff317f2311099fc7cae8ed34350ef52fb8000f2 100644 (file)
@@ -61,19 +61,19 @@ class EccCheck(ICiBuildPlugin):
     #   - Junit Logger\r
     #   - output_stream the StringIO output stream from this plugin via logging\r
     def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, PLM, PLMHelper, tc, output_stream=None):\r
-        edk2_path = Edk2pathObj.WorkspacePath\r
+        workspace_path = Edk2pathObj.WorkspacePath\r
         basetools_path = environment.GetValue("EDK_TOOLS_PATH")\r
         python_path = os.path.join(basetools_path, "Source", "Python")\r
         env = shell_environment.GetEnvironment()\r
         env.set_shell_var('PYTHONPATH', python_path)\r
-        env.set_shell_var('WORKSPACE', edk2_path)\r
+        env.set_shell_var('WORKSPACE', workspace_path)\r
         self.ECC_PASS = True\r
-        self.ApplyConfig(pkgconfig, edk2_path, basetools_path, packagename)\r
+        self.ApplyConfig(pkgconfig, workspace_path, basetools_path, packagename)\r
         modify_dir_list = self.GetModifyDir(packagename)\r
         patch = self.GetDiff(packagename)\r
-        ecc_diff_range = self.GetDiffRange(patch, packagename, edk2_path)\r
-        self.GenerateEccReport(modify_dir_list, ecc_diff_range, edk2_path, basetools_path)\r
-        ecc_log = os.path.join(edk2_path, "Ecc.log")\r
+        ecc_diff_range = self.GetDiffRange(patch, packagename, workspace_path)\r
+        self.GenerateEccReport(modify_dir_list, ecc_diff_range, workspace_path, basetools_path)\r
+        ecc_log = os.path.join(workspace_path, "Ecc.log")\r
         self.RevertCode()\r
         if self.ECC_PASS:\r
             tc.SetSuccess()\r
@@ -178,24 +178,24 @@ class EccCheck(ICiBuildPlugin):
         return comment_range\r
 \r
     def GenerateEccReport(self, modify_dir_list: List[str], ecc_diff_range: Dict[str, List[Tuple[int, int]]],\r
-                           edk2_path: str, basetools_path: str) -> None:\r
+                           workspace_path: str, basetools_path: str) -> None:\r
         ecc_need = False\r
         ecc_run = True\r
         config = os.path.join(basetools_path, "Source", "Python", "Ecc", "config.ini")\r
         exception = os.path.join(basetools_path, "Source", "Python", "Ecc", "exception.xml")\r
-        report = os.path.join(edk2_path, "Ecc.csv")\r
+        report = os.path.join(workspace_path, "Ecc.csv")\r
         for modify_dir in modify_dir_list:\r
-            target = os.path.join(edk2_path, modify_dir)\r
+            target = os.path.join(workspace_path, modify_dir)\r
             logging.info('Run ECC tool for the commit in %s' % modify_dir)\r
             ecc_need = True\r
             ecc_params = "-c {0} -e {1} -t {2} -r {3}".format(config, exception, target, report)\r
-            return_code = RunCmd("Ecc", ecc_params, workingdir=edk2_path)\r
+            return_code = RunCmd("Ecc", ecc_params, workingdir=workspace_path)\r
             if return_code != 0:\r
                 ecc_run = False\r
                 break\r
             if not ecc_run:\r
                 logging.error('Fail to run ECC tool')\r
-            self.ParseEccReport(ecc_diff_range, edk2_path)\r
+            self.ParseEccReport(ecc_diff_range, workspace_path)\r
 \r
         if not ecc_need:\r
             logging.info("Doesn't need run ECC check")\r
@@ -204,10 +204,10 @@ class EccCheck(ICiBuildPlugin):
         RunCmd("git", revert_params)\r
         return\r
 \r
-    def ParseEccReport(self, ecc_diff_range: Dict[str, List[Tuple[int, int]]], edk2_path: str) -> None:\r
-        ecc_log = os.path.join(edk2_path, "Ecc.log")\r
+    def ParseEccReport(self, ecc_diff_range: Dict[str, List[Tuple[int, int]]], workspace_path: str) -> None:\r
+        ecc_log = os.path.join(workspace_path, "Ecc.log")\r
         ecc_csv = "Ecc.csv"\r
-        file = os.listdir(edk2_path)\r
+        file = os.listdir(workspace_path)\r
         row_lines = []\r
         ignore_error_code = self.GetIgnoreErrorCode()\r
         if ecc_csv in file:\r
@@ -236,10 +236,10 @@ class EccCheck(ICiBuildPlugin):
             log.writelines(all_line)\r
         return\r
 \r
-    def ApplyConfig(self, pkgconfig: Dict[str, List[str]], edk2_path: str, basetools_path: str, pkg: str) -> None:\r
+    def ApplyConfig(self, pkgconfig: Dict[str, List[str]], workspace_path: str, basetools_path: str, pkg: str) -> None:\r
         if "IgnoreFiles" in pkgconfig:\r
             for a in pkgconfig["IgnoreFiles"]:\r
-                a = os.path.join(edk2_path, pkg, a)\r
+                a = os.path.join(workspace_path, pkg, a)\r
                 a = a.replace(os.sep, "/")\r
 \r
                 logging.info("Ignoring Files {0}".format(a))\r