Skip to content

Commit

Permalink
[SQUASH ON REBASE] ImageValidation.py: Support gitignore style syntax…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
Javagedes authored Sep 18, 2024
1 parent 66f3d70 commit 23f8354
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions .pytool/Plugin/ImageValidation/ImageValidation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from edk2toollib.uefi.edk2.parsers.fdf_parser import FdfParser
from edk2toollib.uefi.edk2.parsers.dsc_parser import DscParser
from edk2toollib.uefi.edk2.parsers.inf_parser import InfParser
from edk2toollib.gitignore_parser import parse_gitignore_lines
import yaml
from typing import List
import logging
Expand Down Expand Up @@ -124,7 +125,9 @@ def do_post_build(self, thebuilder):

self.test_manager.config_data = config_data
self.config_data = config_data
self.ignore_list = config_data["IGNORE_LIST"]
self.ignore = parse_gitignore_lines(config_data.get("IGNORE_LIST", []), os.path.join(
thebuilder.ws, "nofile.txt"), thebuilder.ws)

self.arch_dict = config_data["TARGET_ARCH"]

count = 0
Expand Down Expand Up @@ -169,7 +172,7 @@ def do_post_build(self, thebuilder):
logging.warning(
"Unable to parse the path to the pre-compiled efi")
continue
if os.path.basename(efi_path) in self.ignore_list:
if self.ignore(efi_path):
continue
logging.debug(
f'Performing Image Verification ... {os.path.basename(efi_path)}')
Expand All @@ -186,7 +189,7 @@ def do_post_build(self, thebuilder):
['.efi'], f'{os.path.join(thebuilder.env.GetValue("BUILD_OUTPUT_BASE"), arch)}')

for efi_path in efi_path_list:
if os.path.basename(efi_path) in self.ignore_list:
if self.ignore(efi_path):
continue

# Perform Image Verification on any output efi's
Expand Down
3 changes: 2 additions & 1 deletion .pytool/Plugin/ImageValidation/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ X64:
If your platform deems a particular binary does not, and cannot meet the
requirements set by the Image Validation plugin, or the platform's custom
config, it can be ignored by adding a `IGNORE_LIST = [...]` section to the
configuration file provided via PE_VALIDATION_PATH.
configuration file provided via PE_VALIDATION_PATH. gitignore style syntax
is supported for ignoring multiple files.

## Common Errors

Expand Down

0 comments on commit 23f8354

Please sign in to comment.