detect.py: Avoid adding patches when hardware’s been removed

This commit is contained in:
Mykola Grymalyuk
2024-09-06 15:02:35 -06:00
parent 87469b71d0
commit 1f000d893f

View File

@@ -459,7 +459,7 @@ class HardwarePatchsetDetection:
if self._validation is False:
present_hardware = self._strip_incompatible_hardware(present_hardware)
# Second pass to gather all properties
# Second pass to determine requirements
for item in present_hardware:
item: BaseHardware
device_properties[item.name()] = True
@@ -478,8 +478,6 @@ class HardwarePatchsetDetection:
if item.required_amfi_level() > highest_amfi_level:
highest_amfi_level = item.required_amfi_level()
patches.update(item.patches())
if self._validation is False:
if requires_metallib_support_pkg is True:
missing_metallib_support_pkg = not self._is_cached_metallib_support_pkg_present()
@@ -515,6 +513,13 @@ class HardwarePatchsetDetection:
if requirements[HardwarePatchsetValidation.MISSING_NETWORK_CONNECTION] is True:
requirements, device_properties = self._handle_missing_network_connection(requirements, device_properties)
# Third pass to sync stripped hardware (ie. '_handle_missing_network_connection()')
for item in present_hardware:
item: BaseHardware
if item.name() not in device_properties:
continue
patches.update(item.patches())
_cant_patch = not self._can_patch(requirements)
requirements[HardwarePatchsetValidation.PATCHING_NOT_POSSIBLE] = _cant_patch