From f08102bf416f69024e174d7ee1fed10e294729bc Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 27 Jun 2023 15:18:02 +0200 Subject: [PATCH] contrib: autodetect the Fedora version for "nm-code-format-container.sh" script From time to time we bump the used clang-format (and Fedora) version. Previously, we had to change more than one places. Instead, let the "nm-code-format-container.sh" parse it from ".gitlab-ci/config.yml". --- contrib/scripts/nm-code-format-container.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/scripts/nm-code-format-container.sh b/contrib/scripts/nm-code-format-container.sh index d447e203b0..e6584322d3 100755 --- a/contrib/scripts/nm-code-format-container.sh +++ b/contrib/scripts/nm-code-format-container.sh @@ -10,7 +10,11 @@ die() { DIR="$(realpath "$(dirname "$0")/../../")" cd "$DIR" -FEDORA_VERSION=38 +# The correct clang-format version is the one from the Fedora version used in our +# gitlab-ci pipeline. Parse it from ".gitlab-ci/config.yml". +FEDORA_VERSION="$(sed '/^ tier: 1/,/^ - name/!d' .gitlab-ci/config.yml | sed -n "s/^ - '\([0-9]\+\)'$/\1/p" | sed -n 1p)" + +test -n "$FEDORA_VERSION" || die "Could not detect the Fedora version in .gitlab-ci/config.yml" PODNAME="nm-code-format-f$FEDORA_VERSION"