diff --git a/BaseTools/Plugin/OverrideValidation/OverrideValidation.py b/BaseTools/Plugin/OverrideValidation/OverrideValidation.py index 0408c2613aa..7682c1552d7 100644 --- a/BaseTools/Plugin/OverrideValidation/OverrideValidation.py +++ b/BaseTools/Plugin/OverrideValidation/OverrideValidation.py @@ -400,30 +400,50 @@ def deprecation_process_line_with_version1(self, thebuilder, filepath, Deprecati normalized_file_path = filepath.replace("\\", "/") # Check if the module is part of the skip list - skip_list = thebuilder.env.GetValue("DEPRECATED_MODULES_SKIPLIST") - for module in skip_list: - if module.strip() == "": - continue + skip_list_str = thebuilder.env.GetValue("DEPRECATED_MODULES_SKIPLIST") + + # Skip the modules that are part of skiplist + if skip_list_str is not None: + skip_list = skip_list_str.split(";") + for skipped_module in skip_list: + if skipped_module.strip() == "": + continue - normalized_relative_path = module.strip().replace("\\", "/") - if normalized_file_path.endswith(normalized_relative_path): - logging.info("Use of Deprecated module: %s skipped as part of platform skip list", filepath) - return self.OverrideResult.DR_ALL_GOOD + skipped_module_path = skipped_module.strip().replace("\\", "/") + if normalized_file_path.endswith(skipped_module_path): + logging.info("Use of Deprecated module: %s skipped as part of platform skip list", filepath) + return self.OverrideResult.DR_ALL_GOOD # Check if the module has passed the deprecation date deprecation_timeline = int(DeprecationEntry[3]) deprecation_dt = datetime.strptime(DeprecationEntry[2].strip(), TIMESTAMP_FORMAT).replace(tzinfo=timezone.utc) + timedelta(days=deprecation_timeline) current_dt = datetime.now(timezone.utc) + # Check if replacement file exists + if DeprecationEntry[1].strip() == "REMOVED_COMPLETELY": + replacement_path = None + else: + replacement_path = thebuilder.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath(DeprecationEntry[1].strip()) + # Module has crossed date of deprecation if current_dt > deprecation_dt: - logging.error("Use of Deprecated module: %s post date of deprecation.\nPlease switch to: %s.", - filepath, thebuilder.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath(DeprecationEntry[1].strip())) + logging.error("Use of Deprecated module: %s post date of deprecation.", filepath) + if replacement_path is None: + logging.error("Please remove the module (or) Add to DEPRECATED_MODULES_SKIPLIST") + else: + logging.error("Replace with: %s (or) Add to DEPRECATED_MODULES_SKIPLIST", replacement_path) + return self.OverrideResult.DR_DEPRECATED_ERROR + # Module is not deprecated yet else: - logging.warning("Use of Deprecated module: %s.\nPlease switch to: %s before %s.", - filepath, thebuilder.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath(DeprecationEntry[1].strip()), DeprecationEntry[2].strip()) + logging.warning("Use of Deprecated module: %s.", filepath) + + if replacement_path is None: + logging.warning("Please remove the module (or) Add to DEPRECATED_MODULES_SKIPLIST before %s", deprecation_dt.strftime(TIMESTAMP_FORMAT)) + else: + logging.warning("Replace with: %s (or) Add to DEPRECATED_MODULES_SKIPLIST before %s", deprecation_dt.strftime(TIMESTAMP_FORMAT)) + return self.OverrideResult.DR_DEPRECATION_WARNING # Check override record against parsed entries diff --git a/BaseTools/Plugin/OverrideValidation/ReadMe.md b/BaseTools/Plugin/OverrideValidation/ReadMe.md index ed770adfa55..5588c98d496 100644 --- a/BaseTools/Plugin/OverrideValidation/ReadMe.md +++ b/BaseTools/Plugin/OverrideValidation/ReadMe.md @@ -123,7 +123,7 @@ WARNING - Use of Deprecated module: C:\Repo\MU_BASECORE\MdeModulePkg\BaseMemoryL To disable Deprecation warnings for a given module, add it to the deprecation modules skip list. ``` cmd -self.env.SetValue("DEPRECATED_MODULES_SKIPLIST", ["MdeModulePkg\BaseMemoryLib\BaseMemoryLib.inf"], "Skip list for platforms") +self.env.SetValue("DEPRECATED_MODULES_SKIPLIST", "MdeModulePkg\BaseMemoryLib\BaseMemoryLib.inf; MdeModulePkg\MemoryAllocationLib\MemoryAllocationLib.inf", "Skip list for platforms") ``` Override log generated during pre-build process: @@ -196,7 +196,7 @@ overridden file (the INF or DSC) and the overriding file. ### Deprecation Version 1 ``` cmd -#Deprecated : 00000001 | MdeModulePkg/BaseMemoryLibV2/BaseMemoryLib.inf | 2024-02-16T04-00-28 +#Deprecated : 00000001 | MdeModulePkg/BaseMemoryLibV2/BaseMemoryLib.inf | 2024-02-16T04-00-28 | 90 ``` ## Copyright & License