1. Unwanted dash in version string when EXTRAVERSION is empty
The current logic always appends a dash (-), even if EXTRAVERSION is unset.
This patch ensures the dash and EXTRAVERSION are only appended if
EXTRAVERSION is non-empty.
2. git describe fails in out-of-tree Yocto builds
Yocto uses separate source and build directories, causing git describe to
fail when invoked outside the source tree. This is fixed by running
git describe in a subshell with cd into the source directory.
Fixes: d275fec4bb2d4a0bc75f32853eca4794634d9dc4
Signed-off-by: Michael Glembotzki <
Michael.G...@iris-sensing.com>
---
Makefile.flags | 2 +-
include/globals.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.flags b/Makefile.flags
index 9561ec82..462f06ad 100644
--- a/Makefile.flags
+++ b/Makefile.flags
@@ -22,7 +22,7 @@ KBUILD_CPPFLAGS += -D_GNU_SOURCE -DNDEBUG
KBUILD_CPPFLAGS += -DVERSION=$(VERSION)
KBUILD_CPPFLAGS += -DVERSION_PATCHLEVEL=$(PATCHLEVEL)
KBUILD_CPPFLAGS += -DVERSION_SUBLEVEL=$(SUBLEVEL)
-KBUILD_CPPFLAGS += -DVERSION_EXTRAVERSION=$(shell $(srctree)/scripts/gen_extraversion)
+KBUILD_CPPFLAGS += -DVERSION_EXTRAVERSION=$(shell cd $(srctree) && ver=$$(./scripts/gen_extraversion); [ -n "$$ver" ] && echo -$$ver)
KBUILD_CFLAGS += $(call cc-option,-Wall,)
KBUILD_CFLAGS += $(call cc-option,-Wshadow,)
diff --git a/include/globals.h b/include/globals.h
index 0b3fd883..2ab5643a 100644
--- a/include/globals.h
+++ b/include/globals.h
@@ -11,7 +11,7 @@
#define STR(x) STR_HELPER(x)
#define BANNER "SWUpdate v" \
- STR(VERSION)"."STR(VERSION_PATCHLEVEL)"."STR(VERSION_SUBLEVEL)"-"STR(VERSION_EXTRAVERSION)
+ STR(VERSION)"."STR(VERSION_PATCHLEVEL)"."STR(VERSION_SUBLEVEL) STR(VERSION_EXTRAVERSION)
#define SWUPDATE_GENERAL_STRING_SIZE 256
#define SWUPDATE_UPDATE_DESCRIPTION_STRING_SIZE 512
--
2.44.1