validation.py: Add exemptions for PatchType checks

This commit is contained in:
Mykola Grymalyuk
2024-09-06 09:25:51 -06:00
parent 8d838a3148
commit 87469b71d0

View File

@@ -124,6 +124,9 @@ class PatcherValidation:
minor_kernel (int): Minor kernel version
"""
patch_type_merge_exempt = ["MechanismPlugins"]
patch_type_overwrite_exempt = []
patchset = HardwarePatchsetDetection(self.constants, xnu_major=major_kernel, xnu_minor=minor_kernel, validation=True).patches
for patch_core in patchset:
@@ -144,10 +147,10 @@ class PatcherValidation:
# Technically there is nothing wrong with using a .framework with OVERWRITE, but it's a good indicator of a mistake
if install_type in [PatchType.OVERWRITE_SYSTEM_VOLUME, PatchType.OVERWRITE_DATA_VOLUME]:
if install_file.endswith(".framework"):
if install_file.endswith(".framework") and install_file not in patch_type_overwrite_exempt:
raise Exception(f"{install_file} used with {install_type}, are you certain this is correct?")
elif install_type in [PatchType.MERGE_SYSTEM_VOLUME, PatchType.MERGE_DATA_VOLUME]:
if not install_file.endswith(".framework"):
if not install_file.endswith(".framework") and install_file not in patch_type_merge_exempt:
raise Exception(f"{install_file} used with {install_type}, are you certain this is correct?")
source_file = str(self.constants.payload_local_binaries_root_path) + "/" + patchset[patch_core][install_type][install_directory][install_file] + install_directory + "/" + install_file