summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbdul Lateef Attar <AbdulLateef.Attar@amd.com>2024-08-31 09:19:30 +0000
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-09-11 03:52:33 +0000
commit9a4088777fbe7941664ad9bb2bd78446d223cbf9 (patch)
treea41e7baddc2ae0289f027d9fec19b351322c8e8f
parent1328938560be440f25c122bcf6635af210291a4e (diff)
downloadedk2-9a4088777fbe7941664ad9bb2bd78446d223cbf9.tar.gz
edk2-9a4088777fbe7941664ad9bb2bd78446d223cbf9.tar.bz2
edk2-9a4088777fbe7941664ad9bb2bd78446d223cbf9.zip
.pytool/EccCheck: Trim leading path to modified directory
The code changes in the patch is for trimming the leading path to the modified directory in the .pytool/EccCheck script. This is necessary when running Ecc on other repositories, such as edk2-platforms, where the platform package is located in a subfolder, like Platform/AMD/AmdPlatformPkg. The EccCheck script checks for modified directories and expects them to start with the package name. # # Skip directory names that do not start with the package being scanned. # if file_dir.split('/')[0] != pkg: continue However, if the package name is in a subfolder, the "git diff" command gives a relative path, like Platform/AMD, which causes the condition to be false. "M Platform/AMD/AmdPlatformPkg/Universal/LogoDxe/Logo.c" As a result, EccCheck does not happen on modified files. To fix this issue, the leading path needs to be trimmed so that it starts from the directory name. This change will not affect the existing check for the edk2 repository, where all package names are at the first level directory. Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Joey Vagedes <joey.vagedes@gmail.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
-rw-r--r--.pytool/Plugin/EccCheck/EccCheck.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/.pytool/Plugin/EccCheck/EccCheck.py b/.pytool/Plugin/EccCheck/EccCheck.py
index 7235fcb55c..0002143f1a 100644
--- a/.pytool/Plugin/EccCheck/EccCheck.py
+++ b/.pytool/Plugin/EccCheck/EccCheck.py
@@ -182,6 +182,11 @@ class EccCheck(ICiBuildPlugin):
#
file_dir = os.path.dirname(file_path[-1])
#
+ # strip the prefix path till the package name
+ #
+ if pkg in file_dir:
+ file_dir = file_dir[file_dir.find(pkg):]
+ #
# Skip directory names that do not start with the package being scanned.
#
if file_dir.split('/')[0] != pkg: