Add support for prop overrides

The format of the overrides is KEY=VALUE
Where KEY is one of the dict keys used in config
https://cs.android.com/android/platform/superproject/main/+/main:build/soong/scripts/gen_build_prop.py
And VALUE is the value you want take over.

An example:
PRODUCT_BUILD_PROP_OVERRIDES += \
    BuildDesc="jfltevzw-user 4.2.2 JDQ39 I545VRUAMDK release-keys" \
    BuildFingerprint=Verizon/jfltevzw/jfltevzw:4.2.2/JDQ39/I545VRUAMDK:user/release-keys \
    DeviceName=jfltevzw \
    DeviceProduct=jfltevzw \
    SystemDevice=jfltevzw \
    SystemName=jfltevzw

Change-Id: Ib44a3bb573d08d492acc092e104cb4f687f3b168
This commit is contained in:
Luca Stefani 2024-09-07 11:49:03 +02:00 committed by Bartłomiej Rudecki
parent f9b8137457
commit 2e6152ee86
Signed by: przekichane
GPG key ID: 751F23C6F014EF76

View file

@ -45,6 +45,24 @@ def get_build_keys(product_config):
return "test-keys"
return "dev-keys"
def override_config(config):
if "PRODUCT_BUILD_PROP_OVERRIDES" in config:
current_key = None
props_overrides = {}
for var in config["PRODUCT_BUILD_PROP_OVERRIDES"]:
if "=" in var:
current_key, value = var.split("=")
props_overrides[current_key] = value
else:
props_overrides[current_key] += f" {var}"
for key, value in props_overrides.items():
if key not in config:
print(f"Key \"{key}\" isn't a valid prop override", file=sys.stderr)
sys.exit(1)
config[key] = value
def parse_args():
"""Parse commandline arguments."""
parser = argparse.ArgumentParser()
@ -100,6 +118,8 @@ def parse_args():
if args.build_thumbprint_file:
config["BuildThumbprint"] = args.build_thumbprint_file.read().strip()
override_config(config)
append_additional_system_props(args)
append_additional_vendor_props(args)
append_additional_product_props(args)