sm6150-common: releasetools: Use unique version-baseband strings for different regions

Android 12 forbids to assign version-baseband multiple times with
different values for different regions, hence append the hwc value
to the version-baseband string.

The lines have to follow this syntax now:
require version-baseband-${ro.boot.hwc}=${modem_version},${firmware_version}

Example for a device that wants assertions for global and chinese devices:
require version-baseband-CN=4.3.c5-00100,21.4.21
require version-baseband-GLOBAL=4.3.c5-00100,V12.1.2.0.RFJMIXM

Change-Id: Ib2c5b1c4588e6bfff1ebf5b7b1d8933d71e09251
This commit is contained in:
Arian 2022-03-17 00:48:49 +01:00
parent fc459f07b0
commit a07caa8f8f

View File

@ -55,9 +55,9 @@ def OTA_InstallEnd(info):
def AddBasebandAssertion(info, input_zip):
android_info = input_zip.open("OTA/android-info.txt")
for line in android_info.readlines():
m = re.search(r'require\s+version-baseband\s*=\s*(.+)', line.decode('utf-8'))
m = re.search(r'require\s+version-baseband\s*-\s*(.+)', line.decode('utf-8'))
if m:
hwc, modem_version, firmware_version = m.group(1).rstrip().split(',')
hwc, modem_version, firmware_version = re.split('[=,]', m.group(1).rstrip())
if (len(hwc) and len(modem_version) and len(firmware_version)):
cmd = 'assert(getprop("ro.boot.hwc") == "{0}" && (xiaomi.verify_baseband("{1}") == "1" || abort("ERROR: This package requires firmware from MIUI {2} or newer. Please upgrade firmware and retry!");) || true);'
info.script.AppendExtra(cmd.format(hwc, modem_version, firmware_version))