blob: 35fba356a3663e64bdd4be16903bdb1f6072d60a [file]
"""Recipe for running a ota build on the given SDK patch."""
from slave import base_recipe
from slave.recipe import combined_sdk
from slave.recipe import ota_builder
from slave.step import combined_sdk_compile
SDK_CONFIG = {
'korlan-eng-with-sdk': {
'product': 'korlan',
'sdk_path': 'vendor/amlogic/amlogic_sdk_korlan',
'fake_out_path': 'out',
'ota_config_key': 'korlan-eng',
'sdk_config_key': 'combined-sdk-kernel-bootloader-amlogic-korlan',
},
'korlan-user-with-sdk': {
'product': 'korlan',
'sdk_path': 'vendor/amlogic/amlogic_sdk_korlan',
'fake_out_path': 'out',
'ota_config_key': 'korlan-user',
'sdk_config_key': 'combined-sdk-kernel-bootloader-amlogic-korlan',
},
}
def GetValidBuildNames():
return list(SDK_CONFIG.keys())
def CreateRecipe(build_name: str, **kwargs):
"""Builds a recipe object."""
return SdkOtaRecipe(build_name, **kwargs)
class SdkOtaRecipe(base_recipe.BaseRecipe):
"""Recipe to run an ota build."""
def __init__(self, build_name, **kwargs):
base_recipe.BaseRecipe.__init__(
self, enable_build_accelerator=True, **kwargs)
self._build_name = build_name
self._build_config = SDK_CONFIG[self._build_name]
self._build_kwargs = kwargs
def get_steps(self):
steps = []
sdk_config_key = self._build_config.get('sdk_config_key')
sdk_path = self._build_config.get('sdk_path')
combined_sdk_recipe = combined_sdk.CreateRecipe(
sdk_config_key, cwd=sdk_path, repo_regex=sdk_path,
**self._build_kwargs)
steps += combined_sdk_recipe.get_steps_for_ota_builder()
ota_config_key = self._build_config.get('ota_config_key')
steps += ota_builder.CreateRecipe(ota_config_key,
**self._build_kwargs).get_steps()
return steps