From 5bc9d7f28ddf5029576a85385110845273b9113f Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Wed, 2 Mar 2016 15:24:03 +0100 Subject: [PATCH] Include repository status (-{clean,dirty}) in version string --- u-boot/Makefile | 11 +++++++++-- u-boot/lib_mips/board.c | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/u-boot/Makefile b/u-boot/Makefile index 62aea60..9bd2c1e 100644 --- a/u-boot/Makefile +++ b/u-boot/Makefile @@ -24,10 +24,17 @@ VERSION = 1 PATCHLEVEL = 1 SUBLEVEL = 4 -EXTRAVERSION = -$(shell git rev-parse --short=8 HEAD) -U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) +EXTRAVERSION = -$(shell git rev-parse --short=8 HEAD) +ISREPODIRTY = $(shell if git diff-files | read dummy; then echo 1; else echo 0; fi) VERSION_FILE = include/version_autogenerated.h +# Show in version string if we are not building from clean repository +ifeq ($(ISREPODIRTY), 1) +U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)"-dirty" +else +U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)"-clean" +endif + HOSTARCH := $(shell uname -m | \ sed -e s/i.86/i386/ \ -e s/sun4u/sparc64/ \ diff --git a/u-boot/lib_mips/board.c b/u-boot/lib_mips/board.c index 3fd8ac2..998123d 100644 --- a/u-boot/lib_mips/board.c +++ b/u-boot/lib_mips/board.c @@ -96,7 +96,7 @@ static int display_banner(void) #endif printf("\n***************************************" - "\n* %s *" + "\n* %s *" "\n* " __DATE__ ", " __TIME__ " *" "\n***************************************\n\n", version_string); -- 2.25.1