|
@@ -1,5 +1,6 @@
|
|
|
# @file EccCheck.py
|
|
|
#
|
|
|
+# Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
|
|
|
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
|
|
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
##
|
|
@@ -61,16 +62,17 @@ class EccCheck(ICiBuildPlugin):
|
|
|
# - output_stream the StringIO output stream from this plugin via logging
|
|
|
def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, PLM, PLMHelper, tc, output_stream=None):
|
|
|
edk2_path = Edk2pathObj.WorkspacePath
|
|
|
- python_path = os.path.join(edk2_path, "BaseTools", "Source", "Python")
|
|
|
+ basetools_path = environment.GetValue("EDK_TOOLS_PATH")
|
|
|
+ python_path = os.path.join(basetools_path, "Source", "Python")
|
|
|
env = shell_environment.GetEnvironment()
|
|
|
env.set_shell_var('PYTHONPATH', python_path)
|
|
|
env.set_shell_var('WORKSPACE', edk2_path)
|
|
|
self.ECC_PASS = True
|
|
|
- self.ApplyConfig(pkgconfig, edk2_path, packagename)
|
|
|
+ self.ApplyConfig(pkgconfig, edk2_path, basetools_path, packagename)
|
|
|
modify_dir_list = self.GetModifyDir(packagename)
|
|
|
patch = self.GetDiff(packagename)
|
|
|
ecc_diff_range = self.GetDiffRange(patch, packagename, edk2_path)
|
|
|
- self.GenerateEccReport(modify_dir_list, ecc_diff_range, edk2_path)
|
|
|
+ self.GenerateEccReport(modify_dir_list, ecc_diff_range, edk2_path, basetools_path)
|
|
|
ecc_log = os.path.join(edk2_path, "Ecc.log")
|
|
|
self.RevertCode()
|
|
|
if self.ECC_PASS:
|
|
@@ -176,11 +178,11 @@ class EccCheck(ICiBuildPlugin):
|
|
|
return comment_range
|
|
|
|
|
|
def GenerateEccReport(self, modify_dir_list: List[str], ecc_diff_range: Dict[str, List[Tuple[int, int]]],
|
|
|
- edk2_path: str) -> None:
|
|
|
+ edk2_path: str, basetools_path: str) -> None:
|
|
|
ecc_need = False
|
|
|
ecc_run = True
|
|
|
- config = os.path.join(edk2_path, "BaseTools", "Source", "Python", "Ecc", "config.ini")
|
|
|
- exception = os.path.join(edk2_path, "BaseTools", "Source", "Python", "Ecc", "exception.xml")
|
|
|
+ config = os.path.join(basetools_path, "Source", "Python", "Ecc", "config.ini")
|
|
|
+ exception = os.path.join(basetools_path, "Source", "Python", "Ecc", "exception.xml")
|
|
|
report = os.path.join(edk2_path, "Ecc.csv")
|
|
|
for modify_dir in modify_dir_list:
|
|
|
target = os.path.join(edk2_path, modify_dir)
|
|
@@ -234,7 +236,7 @@ class EccCheck(ICiBuildPlugin):
|
|
|
log.writelines(all_line)
|
|
|
return
|
|
|
|
|
|
- def ApplyConfig(self, pkgconfig: Dict[str, List[str]], edk2_path: str, pkg: str) -> None:
|
|
|
+ def ApplyConfig(self, pkgconfig: Dict[str, List[str]], edk2_path: str, basetools_path: str, pkg: str) -> None:
|
|
|
if "IgnoreFiles" in pkgconfig:
|
|
|
for a in pkgconfig["IgnoreFiles"]:
|
|
|
a = os.path.join(edk2_path, pkg, a)
|
|
@@ -251,7 +253,7 @@ class EccCheck(ICiBuildPlugin):
|
|
|
|
|
|
if "ExceptionList" in pkgconfig:
|
|
|
exception_list = pkgconfig["ExceptionList"]
|
|
|
- exception_xml = os.path.join(edk2_path, "BaseTools", "Source", "Python", "Ecc", "exception.xml")
|
|
|
+ exception_xml = os.path.join(basetools_path, "Source", "Python", "Ecc", "exception.xml")
|
|
|
try:
|
|
|
logging.info("Appending exceptions")
|
|
|
self.AppendException(exception_list, exception_xml)
|