star-build

Automation tool for project installation
git clone git://git.meso-star.fr/star-build.git
Log | Files | Refs | README | LICENSE

commit 9ff08618fb92e2c163c2457fd6367ed69a4e40d0
parent 0bb476fdb127879c98b5da352dda9065d42364f3
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 30 Apr 2025 12:07:05 +0200

Check for conflicts between RSys versions required

Return an error if two different versions are required in the same
build.

Diffstat:
Msrc/build.sh | 20++++++++++++++++++++
Msrc/rsys_0.14.sh | 13++++++++-----
Msrc/rsys_0.15.sh | 13++++++++-----
3 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/src/build.sh b/src/build.sh @@ -20,6 +20,26 @@ set -e [ -n "${BUILD_SH}" ] && return export BUILD_SH=1 +# Check for conflicts between script versions of the same build +# Return 0 if version do not conflicts, and >0 otherwise +check_conflict() # name, version0, version 1 +{ + # Do not define local variables to avoid risk of updating variables + # defined in the calling's environment + + if [ $# -lt 3 ]; then + >&2 printf 'usage: check_conflict name version0 version1\n' + return 1 + fi + + if [ "$2" != "$3" ]; then + >&2 printf '%s %s conflicts with %s %s\n' "$1" "$2" "$1" "$3" + return 1 + fi + + return 0 +} + # Generate the targets for a git repository. The input variables are: # - name : the name of the target (required) # - url : the URL of the git repository (required) diff --git a/src/rsys_0.14.sh b/src/rsys_0.14.sh @@ -17,13 +17,16 @@ set -e -[ -n "${RSYS_SH}" ] && return -export RSYS_SH=1 - . "build.sh" name="rsys" -url="$\(REPO_VAPLV\)/rsys.git" tag="0.14" +url="$\(REPO_VAPLV\)/rsys.git" opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)" -git_repo + +if [ -n "${RSYS_SH}" ]; then + check_conflict "${name}" "${tag}" "${RSYS_SH}" +else + export RSYS_SH="${tag}" + git_repo +fi diff --git a/src/rsys_0.15.sh b/src/rsys_0.15.sh @@ -17,13 +17,16 @@ set -e -[ -n "${RSYS_SH}" ] && return -export RSYS_SH=1 - . "build.sh" name="rsys" -url="$\(REPO_VAPLV\)/rsys.git" tag="0.15" +url="$\(REPO_VAPLV\)/rsys.git" opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)" -git_repo + +if [ -n "${RSYS_SH}" ]; then + check_conflict "${name}" "${tag}" "${RSYS_SH}" +else + export RSYS_SH="${tag}" + git_repo +fi