diff mbox series

scripts: dtc-version: support git version strings too

Message ID 20230503102339.94626-1-martin@geanix.com
State Accepted
Commit f07381529bf69f14abd18cd3bd47982f466e179f
Delegated to: Tom Rini
Headers show
Series scripts: dtc-version: support git version strings too | expand

Commit Message

Martin Hundebøll May 3, 2023, 10:23 a.m. UTC
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tom Rini May 15, 2023, 9:12 p.m. UTC | #1
On Wed, May 03, 2023 at 12:23:39PM +0200, Martin Hundebøll wrote:

> 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>

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/scripts/dtc-version.sh b/scripts/dtc-version.sh
index bfb514e179..53ff868bcd 100755
--- a/scripts/dtc-version.sh
+++ b/scripts/dtc-version.sh
@@ -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)