Skip to content

Commit 85f4938

Browse files
committed
[SQUASH ON REBASE] ImageValidation.py: Support gitignore style syntax for file exclusion (#1140)
## Description Add gitignore style syntax for file exclusion - [ ] Impacts functionality? - [ ] Impacts security? - [ ] Breaking change? - [ ] Includes tests? - [ ] Includes documentation? - [x] Squash into 6310e1e ## How This Was Tested Ensured existing syntax (filename only) continues to work. Ensured gitignore style syntax now works. ## Integration Instructions N/A
1 parent d857e20 commit 85f4938

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.pytool/Plugin/ImageValidation/ImageValidation.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from edk2toollib.uefi.edk2.parsers.fdf_parser import FdfParser
1818
from edk2toollib.uefi.edk2.parsers.dsc_parser import DscParser
1919
from edk2toollib.uefi.edk2.parsers.inf_parser import InfParser
20+
from edk2toollib.gitignore_parser import parse_gitignore_lines
2021
import yaml
2122
from typing import List
2223
import logging
@@ -124,7 +125,9 @@ def do_post_build(self, thebuilder):
124125

125126
self.test_manager.config_data = config_data
126127
self.config_data = config_data
127-
self.ignore_list = config_data["IGNORE_LIST"]
128+
self.ignore = parse_gitignore_lines(config_data.get("IGNORE_LIST", []), os.path.join(
129+
thebuilder.ws, "nofile.txt"), thebuilder.ws)
130+
128131
self.arch_dict = config_data["TARGET_ARCH"]
129132

130133
count = 0
@@ -169,7 +172,7 @@ def do_post_build(self, thebuilder):
169172
logging.warning(
170173
"Unable to parse the path to the pre-compiled efi")
171174
continue
172-
if os.path.basename(efi_path) in self.ignore_list:
175+
if self.ignore(efi_path):
173176
continue
174177
logging.debug(
175178
f'Performing Image Verification ... {os.path.basename(efi_path)}')
@@ -186,7 +189,7 @@ def do_post_build(self, thebuilder):
186189
['.efi'], f'{os.path.join(thebuilder.env.GetValue("BUILD_OUTPUT_BASE"), arch)}')
187190

188191
for efi_path in efi_path_list:
189-
if os.path.basename(efi_path) in self.ignore_list:
192+
if self.ignore(efi_path):
190193
continue
191194

192195
# Perform Image Verification on any output efi's

.pytool/Plugin/ImageValidation/ReadMe.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ X64:
6464
If your platform deems a particular binary does not, and cannot meet the
6565
requirements set by the Image Validation plugin, or the platform's custom
6666
config, it can be ignored by adding a `IGNORE_LIST = [...]` section to the
67-
configuration file provided via PE_VALIDATION_PATH.
67+
configuration file provided via PE_VALIDATION_PATH. gitignore style syntax
68+
is supported for ignoring multiple files.
6869

6970
## Common Errors
7071

0 commit comments

Comments
 (0)