[build] add build version to the log and print warning if not matching runtime version

This commit is contained in:
Gautier Hattenberger
2014-12-21 01:15:09 +01:00
committed by Felix Ruess
parent c157cc3569
commit d3f9e39533
3 changed files with 19 additions and 2 deletions
+2
View File
@@ -108,6 +108,8 @@ print_build_version:
@echo "------------------------------------------------------------"
@echo "Building Paparazzi version" $(shell ./paparazzi_version)
@echo "------------------------------------------------------------"
$(Q)test -d $(PAPARAZZI_HOME)/var || mkdir -p $(PAPARAZZI_HOME)/var
$(Q)./paparazzi_version > $(PAPARAZZI_HOME)/var/build_version.txt
update_google_version:
-$(MAKE) -C data/maps
+8 -1
View File
@@ -84,6 +84,7 @@ ifneq ($(words $(GIT_SHA1)),1)
GIT_SHA1 := "UNKNOWN"
endif
GIT_DESC := $(shell ./paparazzi_version)
BUILD_DESC := $(shell cat $(PAPARAZZI_HOME)/var/build_version.txt)
PPRZ_VER := $(shell echo $(GIT_DESC) | sed 's/[^0-9.]*\([0-9.]*\).*/\1/')
PPRZ_VER_MAJOR := $(shell echo $(GIT_DESC) | sed 's/v\([0-9]*\).*/\1/')
PPRZ_VER_MINOR := $(shell echo $(GIT_DESC) | sed 's/v[0-9]*.\([0-9]*\).*/\1/')
@@ -92,11 +93,17 @@ ifneq ($(words $(PPRZ_VER_PATCH)),1)
PPRZ_VER_PATCH := 0
endif
export GIT_DESC
export BUILD_DESC
export GIT_SHA1
export PPRZ_VER_MAJOR
export PPRZ_VER_MINOR
export PPRZ_VER_PATCH
ifneq ($(GIT_DESC),$(BUILD_DESC))
VERSION_MATCH = "\nWarning: version differ from build version ($(BUILD_DESC))"
else
VERSION_MATCH = ""
endif
# "make Q=''" to get full echo
Q=@
@@ -126,7 +133,7 @@ init:
print_version:
@echo "-----------------------------------------------------------------------"
@echo "Paparazzi version" $(GIT_DESC)
@echo "Paparazzi version" $(GIT_DESC)$(VERSION_MATCH)
@echo "-----------------------------------------------------------------------"
+9 -1
View File
@@ -130,7 +130,15 @@ let logger = fun () ->
try
Str.replace_first (Str.regexp "[ \n]+$") "" (read_process (Env.paparazzi_src ^ "/paparazzi_version"))
with _ -> "UNKNOWN" in
output_string f ("<!-- logged with paparazzi_version " ^ version_str ^ " -->\n");
output_string f ("<!-- logged with runtime paparazzi_version " ^ version_str ^ " -->\n");
let build_str =
try
let f = open_in (Env.paparazzi_home ^ "/var/build_version.txt") in
let s = input_line f in
close_in f;
s
with _ -> "UNKNOWN" in
output_string f ("<!-- logged with build paparazzi_version " ^ build_str ^ " -->\n");
output_string f (Xml.to_string_fmt (log_xml start_time data_name));
close_out f;
open_out (logs_path // data_name)