From e53283011ada3fc29ff449a63f6ac3577a2d16a5 Mon Sep 17 00:00:00 2001 From: Leonardo Fagundes Luz Serrano Date: Wed, 8 Oct 2025 13:09:27 -0300 Subject: [PATCH] patch-builder: Making patch scripts optional With this change, the following fields are not longer mandatory in the patch XML: - pre_start - post_start - pre_install - post_install - activation_scripts If these are omitted from the patch XML, the patch-builder will simply consider them empty. Test plan: pass - Generate patch using XML without patch script fields and confirm metadata.xml in patch still has them with empty values Story: 2011498 Task: 52893 Change-Id: I66bb034694a3cd51b7b31ba850dcc90a7e79aca7 Signed-off-by: Leonardo Fagundes Luz Serrano --- build-tools/stx/patch/config/patch-recipe-schema.xsd | 10 +++++----- build-tools/stx/patch/metadata.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build-tools/stx/patch/config/patch-recipe-schema.xsd b/build-tools/stx/patch/config/patch-recipe-schema.xsd index 2ef27ee1..7a9253b5 100644 --- a/build-tools/stx/patch/config/patch-recipe-schema.xsd +++ b/build-tools/stx/patch/config/patch-recipe-schema.xsd @@ -20,11 +20,11 @@ - - - - - + + + + + diff --git a/build-tools/stx/patch/metadata.py b/build-tools/stx/patch/metadata.py index 07522557..4b581235 100644 --- a/build-tools/stx/patch/metadata.py +++ b/build-tools/stx/patch/metadata.py @@ -183,7 +183,7 @@ class PatchMetadata(object): # For each patch script, validate the path provided self.patch_script_paths = { - script_id: self.check_script_path(patch_recipe[script_id]) + script_id: self.check_script_path(patch_recipe.get(script_id, None)) for script_id in PATCH_SCRIPTS.keys() } @@ -192,7 +192,7 @@ class PatchMetadata(object): if 'id' in patch_recipe[REQUIRES]: self.requires = self.__tag_to_list(patch_recipe[REQUIRES]['id']) self.semantics = patch_recipe[SEMANTICS] - if 'script' in patch_recipe[ACTIVATION_SCRIPTS]: + if ACTIVATION_SCRIPTS in patch_recipe and 'script' in patch_recipe[ACTIVATION_SCRIPTS]: # the xml parser transform the 'script' value in string or in # array depending on how much elements we add. scripts_lst = []