Making patch-builder script executable
This change, together with other change in tools repository, makes patch_builder script executable and update the metadata module to utilize the $PATCH_BUILDER_PATH env variable to fetch the xsd schema. We update the README file and the recipes examples to correctly represent theses change. Test plan: PASS: Call patch-builder in different ways, using: "patch-builder --recipe <path>" "stx shell -c 'patch-builder --recipe <path>'" PASS: Test building patches with different recipes: Recipe with one packages Recipe with multiple packages Recipe with pre and post install script Recipe with precheck scripts Depends-On: https://review.opendev.org/c/starlingx/tools/+/924770 Story: 2010676 Task: 50643 Change-Id: If46cf8c388efaa05d80458393049558a193ce656 Signed-off-by: Dostoievski Batista <dostoievski.albinobatista@windriver.com>
This commit is contained in:
parent
e9313cc9d8
commit
0caedf9b84
@ -18,6 +18,7 @@
|
||||
</requires>
|
||||
<semantics></semantics>
|
||||
<!-- Pre and Post install hook scripts -->
|
||||
<!-- Both fields require the full path to hook scripts -->
|
||||
<pre_install>scripts/pre-install.sh</pre_install>
|
||||
<post_install>scripts/post-install.sh</post_install>
|
||||
<!-- Packages to be included -->
|
||||
|
@ -13,6 +13,7 @@
|
||||
<requires></requires>
|
||||
<semantics></semantics>
|
||||
<!-- Pre and Post install hook scripts are optional -->
|
||||
<!-- Both fields require the full path to hook scripts -->
|
||||
<pre_install></pre_install>
|
||||
<post_install></post_install>
|
||||
<!-- Packages to be included -->
|
||||
|
@ -18,6 +18,7 @@
|
||||
</requires>
|
||||
<semantics></semantics>
|
||||
<!-- Pre and Post install hook scripts -->
|
||||
<!-- Both fields require the full path to hook scripts -->
|
||||
<pre_install>scripts/pre-install.sh</pre_install>
|
||||
<post_install>scripts/post-install.sh</post_install>
|
||||
<!-- Packages to be included -->
|
||||
|
@ -18,6 +18,7 @@
|
||||
</requires>
|
||||
<semantics></semantics>
|
||||
<!-- Pre and Post install hook scripts are optional -->
|
||||
<!-- Both fields require the full path to hook scripts -->
|
||||
<pre_install>scripts/pre-install.sh</pre_install>
|
||||
<post_install>scripts/post-install.sh</post_install>
|
||||
<!-- Packages to be included -->
|
||||
|
@ -41,7 +41,7 @@ The patch builder requires the following tags in the input xml (or patch recipe)
|
||||
<semantics></semantics>
|
||||
<!--
|
||||
Pre and Post install hook scripts that are executed before/after patch installation.
|
||||
Leave if blank if no scripts are required.
|
||||
Leave if blank if no scripts are required. Both fields require full path to the files.
|
||||
-->
|
||||
<pre_install>scripts/pre-install.sh</pre_install>
|
||||
<post_install>scripts/post-install.sh</post_install>
|
||||
@ -81,5 +81,5 @@ $ pip install -r requirements.txt
|
||||
- Build your patch:
|
||||
|
||||
```bash
|
||||
$ ./patch_builder.py --recipe EXAMPLES\patch-recipe-sample.xml
|
||||
$ ./patch-builder --recipe EXAMPLES\patch-recipe-sample.xml
|
||||
```
|
||||
|
@ -20,7 +20,8 @@ from xml.dom import minidom
|
||||
logger = logging.getLogger('metadata_parser')
|
||||
utils.set_logger(logger)
|
||||
|
||||
INPUT_XML_SCHEMA = 'config/patch-recipe-schema.xsd'
|
||||
PATCH_BUILDER_PATH = os.environ.get('PATCH_BUILDER_PATH')
|
||||
INPUT_XML_SCHEMA = f'{PATCH_BUILDER_PATH}/config/patch-recipe-schema.xsd'
|
||||
|
||||
# Metadata components
|
||||
PATCH_ROOT_TAG = 'patch'
|
||||
@ -51,6 +52,10 @@ class PatchMetadata(object):
|
||||
self.binary_packages = []
|
||||
self.requires = []
|
||||
|
||||
# Verify if the path to the patch builder folder is set
|
||||
if not PATCH_BUILDER_PATH:
|
||||
raise Exception("Environment variable PATCH_BUILDER_PATH is not set.")
|
||||
|
||||
def __str__(self):
|
||||
return json.dumps(self.__dict__)
|
||||
|
||||
@ -211,6 +216,6 @@ class PatchMetadata(object):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
patch_recipe_file = "EXAMPLES/patch-recipe-sample.xml"
|
||||
patch_recipe_file = f"${PATCH_BUILDER_PATH}/EXAMPLES/patch-recipe-sample.xml"
|
||||
patch_metadata = PatchMetadata(patch_recipe_file)
|
||||
patch_metadata.parse_input_xml_data()
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (c) 2023 Wind River Systems, Inc.
|
||||
# Copyright (c) 2023-2024 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
Loading…
Reference in New Issue
Block a user