lsampaio 65d830d1c8 Update patch xml schema to use id and sw_version
This commit removes the patch_version tag which will not be
required by the patch framework and renames the patch_id
tag to just 'id'.

The patch version will be used in the sw_version tag, e.g:
- 1.0.0 from release version
- 1.0.1 for the 1st patch for this release

The patch id will be generated based on component and
sw_version. The id is also the file name:
$id.patch

Test Plan:
- Enter the builder container
$ stx shell
$ cd $MY_REPO/build-tools/stx/patch

- Build patch
$ ./patch_builder.py --recipe patch-recipe.xml
- Verify metadata has the updated schema

Story: 2010676
Task: 48640
Change-Id: I311438403560f04d6d9dd32778af5c6da101b7ac
Signed-off-by: lsampaio <luis.sampaio@windriver.com>
2023-10-12 15:26:34 -04:00

86 lines
2.7 KiB
Markdown

# Patch Builder Utility
This utility will build patches based on .deb packages.
### Pre reqs
- Setup a build environment and build all packages/image
- Make code changes to your packages and build them
### Patch recipe schema
The patch builder requires the following tags in the input xml (or patch recipe)
```xml
<patch_recipe>
<!-- Software Version -->
<sw_version>1.0.0</sw_version>
<!-- Component -->
<component>starlingx</component>
<!-- Summary: Short text to give a summary about the patch -->
<summary>sample patch test</summary>
<!-- Description: Patch description. Usually it has a list of fixes -->
<description>Sample description</description>
<!-- Install Instructions: Any instructions to be done before the patch installation -->
<install_instructions>Sample instructions</install_instructions>
<!-- Warnings: Any warnings that this patch can trigger -->
<warnings>Sample warning</warnings>
<!-- Reboot required: Y (Yes) or N (No) for in service patch -->
<reboot_required>Y</reboot_required>
<!-- Unremovable: Y (Yes)/ N (No), specifices if the patch can be removed -->
<unremovable>N</unremovable>
<!-- Patch Status: Supported values are DEV (development) and REL (released) -->
<status>DEV</status>
<!-- Requires: List of patches that are required by this patch -->
<requires>
<!--
<id>PATCH_XYZ_01</id>
<id>PATCH_XYZ_02</id>
-->
</requires>
<semantics></semantics>
<!--
Pre and Post install hook scripts that are executed before/after patch installation.
Leave if blank if no scripts are required.
-->
<pre_install>scripts/pre-install.sh</pre_install>
<post_install>scripts/post-install.sh</post_install>
<!-- List Packages to be included in the patch -->
<stx_packages>
<!-- Starlingx packages list -->
<package>sysvinv</package>
<package>linux</package>
<package>linux-rt</package>
</stx_packages>
<!-- Binary packages list to be included in the patch (Packages that we download from 3rd party sources) -->
<binary_packages>
<!-- 3rd party packages list -->
<package>curl</package>
</binary_packages>
</patch_recipe>
```
### How to build a patch
- Enter the builder container
```bash
$ stx shell
$ cd $MY_REPO/build-tools/stx/patch
```
- Install py requirements
```bash
$ pip install -r requirements.txt
```
- Update the patch-recipe file. For examples please refer to the `EXAMPLES` folder.
- Update any pre/post script. For examples check refer to the `scripts` folder.
- Build your patch:
```bash
$ ./patch_builder.py --recipe EXAMPLES\patch-recipe-sample.xml
```