From 471cc1eca3bdb2c70732c256420f1bb621c9a912 Mon Sep 17 00:00:00 2001 From: Wilfred Mallawa Date: Wed, 11 Jun 2025 17:36:18 +1000 Subject: [PATCH] scripts: format_nix: allow newer versions of uncrustify Use `sort -v` to sort versions and allow versions greater than 0.78. For example, Fedora 42 ships 0.80, which fails to work since this script currently checks exactly for 0.78. Signed-off-by: Wilfred Mallawa --- script/format_nix.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/format_nix.sh b/script/format_nix.sh index bd485d9e6aa..c24bc9860c6 100755 --- a/script/format_nix.sh +++ b/script/format_nix.sh @@ -17,8 +17,8 @@ fi VERSION=$(uncrustify --version 2>/dev/null | sed -E 's/Uncrustify-([0-9]+\.[0-9]+).*/\1/') REQUIRED_VERSION="0.78" -if [ "$VERSION" != "$REQUIRED_VERSION" ]; then - echo "ERROR: uncrustify version $REQUIRED_VERSION is required, but found $VERSION." +if [ "$(printf '%s\n' "$REQUIRED_VERSION" "$VERSION" | sort -V | head -n1)" != "$REQUIRED_VERSION" ]; then + echo "ERROR: uncrustify version $REQUIRED_VERSION or higher is required, but found $VERSION." exit 1 fi