]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
scripts: dtc-version: support git version strings too
authorMartin Hundebøll <martin@geanix.com>
Wed, 3 May 2023 10:23:39 +0000 (12:23 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 15 May 2023 18:08:44 +0000 (14:08 -0400)
Building dtc from git causes the version number to start with a 'v'
(e.g. v1.7.0). printf then fails to parse 'v1' as a decimal value, and
prints '000700' instead of '010700'. Subsequently, the build fails,
because '000700' is less than the required '010400' version.

Signed-off-by: Martin Hundebøll <martin@geanix.com>
scripts/dtc-version.sh

index bfb514e179f3ec9f7508f7f311f164106d6632fa..53ff868bcdcecfe861304400d6e8b4ddcbeafefe 100755 (executable)
@@ -20,7 +20,7 @@ if ! which $dtc >/dev/null ; then
        exit 1
 fi
 
-MAJOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 1)
+MAJOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 1 | tr -d v)
 MINOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 2)
 PATCH=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 3 | cut -d - -f 1)