root/build-tools/stx/patch
Dostoievski Batista a1a167bb71 Change scripts names in the patch's metadata
When adding a pre-install or post-install script to the patch, we rename
it to "pre-install.sh" or "post-install.sh" to facilitate the use of the
patch afterwards. This change makes the metadata inside the patch
reflect this. Together with this change we move PATCH_SCRIPTS constant
to separate file as the same will be call in different files.

Test plan:
    PASS: Create patch without any scripts
    PASS: Create patch with only pre-install script
    PASS: Create patch with only post-install script
    PASS: Create patch with all scripts
    PASS: Install patch with all scripts in a running AIO-SX,
    check if scripts are present in /opt/software/software-scripts/
    PASS: Delete patch with all scripts in a running AIO-SX,
    check if scripts are not present in /opt/software/software-scripts/

Story: 2010676
Task: 50926

Change-Id: I639ff15e306ec69ed1bbbfea8c99aa96affa1dec
Signed-off-by: Dostoievski Batista <dostoievski.albinobatista@windriver.com>
2024-08-28 09:56:23 -03:00
..
config Automatically add prechecks scripts to patch 2024-04-29 16:30:26 -03:00
EXAMPLES Making patch-builder script executable 2024-07-23 16:28:27 -03:00
scripts Automatically add prechecks scripts to patch 2024-04-29 16:30:26 -03:00
signing Add patch builder utility 2023-09-29 13:33:46 -04:00
constants.py Change scripts names in the patch's metadata 2024-08-28 09:56:23 -03:00
fetch_debs.py Add patch builder utility 2023-09-29 13:33:46 -04:00
metadata.py Change scripts names in the patch's metadata 2024-08-28 09:56:23 -03:00
patch-builder Change scripts names in the patch's metadata 2024-08-28 09:56:23 -03:00
README.md Making patch-builder script executable 2024-07-23 16:28:27 -03:00
requirements.txt Add patch builder utility 2023-09-29 13:33:46 -04:00

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)

<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. Both fields require full path to the files.
    -->
    <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
$ stx shell
$ cd $MY_REPO/build-tools/stx/patch
  • Install py requirements
$ 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:

$ ./patch-builder --recipe EXAMPLES\patch-recipe-sample.xml