From 543a217064786c3ac2742c24c09f603de495541d Mon Sep 17 00:00:00 2001
From: Tim Jaacks <tim.jaacks@garz-fricke.com>
Date: Tue, 18 Oct 2022 13:25:30 +0200
Subject: [PATCH] manifest_package: add release suffix

Customer specific manifest projects can now set the RELEASE_SUFFIX
variable, which then gets appended to the deployment folder names.
---
 manifest-package.yml       |  8 ++++++--
 scripts/alphaplan_fwr.py   | 10 ++++++++++
 scripts/package_release.py |  9 +++++++++
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/manifest-package.yml b/manifest-package.yml
index 5ee632be..0267c30b 100644
--- a/manifest-package.yml
+++ b/manifest-package.yml
@@ -45,6 +45,7 @@
       echo "${LOGPREFIX} ARTIFACTS_LICENSES_PATH=$ARTIFACTS_LICENSES_PATH"
       echo "${LOGPREFIX} ARTIFACTS_SDK_PATH=$ARTIFACTS_SDK_PATH"
       echo "${LOGPREFIX} UPLOAD_PARAM=$UPLOAD_PARAM"
+      echo "${LOGPREFIX} RELEASE_SUFFIX=$RELEASE_SUFFIX"
       echo "${LOGPREFIX} outdir=$outdir"
 
       # Check if the package_release script is available
@@ -65,6 +66,7 @@
               --licenses-dir="${ARTIFACTS_LICENSES_PATH}" \
               --doc-dir=. \
               --output-dir=${outdir} \
+              --release-suffix="${RELEASE_SUFFIX}" \
               $UPLOAD_PARAM
       else
           echo "${LOGPREFIX} No image found"
@@ -76,7 +78,8 @@
           echo "${LOGPREFIX} SDK dir found, execute ${script}"
           ${script} \
               --sdk-dir=${ARTIFACTS_SDK_PATH} \
-              --output-dir="${outdir}"
+              --output-dir="${outdir}" \
+              --release-suffix="${RELEASE_SUFFIX}"
       else
           echo "${LOGPREFIX} No SDK found"
       fi
@@ -99,7 +102,8 @@
           ${apscript} \
                 --images-dir="${ARTIFACTS_IMAGE_PATH}" \
                 --outputdir-local=${outdir} \
-                --outputdir-upload=release
+                --outputdir-upload=release \
+                --release-suffix="${RELEASE_SUFFIX}"
       else
           echo "${LOGPREFIX} No AlphaPlan FWR articles need to be generated"
       fi
diff --git a/scripts/alphaplan_fwr.py b/scripts/alphaplan_fwr.py
index 7e557bd6..7b27dcab 100755
--- a/scripts/alphaplan_fwr.py
+++ b/scripts/alphaplan_fwr.py
@@ -284,6 +284,11 @@ def main():
         help="""Base directory for locally deployed artifacts, should contain absolut path.""",
         dest="outputdir_local",
     )
+    parser.add_argument(
+        "--release-suffix",
+        help="""Suffix to append to the release folder""",
+        dest="release_suffix",
+    )
     args, _ = parser.parse_known_args()
 
     if args.outputdir_upload is None or args.outputdir_local is None:
@@ -302,11 +307,16 @@ def main():
     artifacts_all = buildvars["DISTRO_RELEASE_ARTEFACTS"].split()
     artifacts_all.append("BUILD_SRCREVS.log")
 
+    # Set release name
     if version.startswith("fngsystem"):
         release_name = version.replace("fngsystem", "FNGSystem")
     else:
         release_name = "Yocto-%s" % version
 
+    # Append release suffix
+    if args.release_suffix is not None:
+        release_name = release_name + args.release_suffix
+
     output_dir = os.path.join(args.outputdir_upload, release_name)
     outlocal_dir = os.path.join(args.outputdir_local, release_name)
     if not os.path.isdir(outlocal_dir):
diff --git a/scripts/package_release.py b/scripts/package_release.py
index 0f482774..6db2c7bb 100755
--- a/scripts/package_release.py
+++ b/scripts/package_release.py
@@ -83,6 +83,11 @@ def main():
         action="append",
         required=True,
     )
+    parser.add_argument(
+        "--release-suffix",
+        help="""Suffix to append to the release folder""",
+        dest="release_suffix",
+    )
     args, _ = parser.parse_known_args()
 
     # Get bitbake variables from testdata.json file
@@ -122,6 +127,10 @@ def main():
     else:
         release_name = "Yocto-%s" % version
 
+    # Append release suffix
+    if args.release_suffix is not None:
+        release_name = release_name + args.release_suffix
+
     # Create output directories
     output_dirs = []
     for output_dir in args.output_dir:
-- 
GitLab