From 9620912607d5e99650624f74545268bba0f310ca Mon Sep 17 00:00:00 2001 From: Stefan Tauner Date: Sun, 1 Oct 2017 16:41:35 +0200 Subject: fixup! Convert flashrom to git - make version string generation independent of the actual VCS used by not generating "unknown" in the makefile but letting getrevision do that - make hook installation independent of version string generation since they have nothing to do with each other and there are no synergies anymore Change-Id: Iedc9df4c033a70447b8b1b65c83764c769b02c3f Signed-off-by: Stefan Tauner Reviewed-on: https://review.coreboot.org/21827 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- Makefile | 14 +++++--------- util/getrevision.sh | 5 +++-- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 980f2f6d..3349f033 100644 --- a/Makefile +++ b/Makefile @@ -528,17 +528,10 @@ CLI_OBJS = cli_classic.o cli_output.o cli_common.o print.o # versioninfo.inc is used when packaging flashrom and is generated by the # export rule. If versioninfo.inc is not found, version info will be obtained -# using util/getrevision.sh or "unknown" if SCM metadata directory isn't found. +# using util/getrevision.sh. ifeq ($(wildcard versioninfo.inc),) -ifeq ($(wildcard .git),) -VERSION ?= unknown -MAN_DATE ?= unknown -else VERSION ?= $(shell ./util/getrevision.sh --local) -MAN_DATE ?= $(shell ./util/getrevision.sh -d $(PROGRAM).8.tmpl 2>/dev/null) -# This is also a convenient time to install hooks. -$(shell ./util/git-hooks/install.sh) -endif +MAN_DATE ?= $(shell ./util/getrevision.sh --date $(PROGRAM).8.tmpl 2>/dev/null) else include versioninfo.inc endif @@ -557,6 +550,9 @@ RELEASENAME ?= $(shell echo "$(VERSION)" | sed -e 's/ /_/') # Inform user of the version string $(info Replacing all version templates with $(VERSION).) +# If a VCS is found then try to install hooks. +$(shell ./util/getrevision.sh -c 2>/dev/null && ./util/git-hooks/install.sh) + ############################################################################### # Default settings of CONFIG_* variables. diff --git a/util/getrevision.sh b/util/getrevision.sh index e1580e5e..0f975462 100755 --- a/util/getrevision.sh +++ b/util/getrevision.sh @@ -131,13 +131,14 @@ timestamp() { # Retrieve local revision info. local_revision() { + local r if git_is_file_tracked "$1" ; then - local r=$(git describe $(git_last_commit "$1")) + r=$(git describe $(git_last_commit "$1")) if git_has_local_changes "$1" ; then r="$r-dirty" fi else - return ${EXIT_FAILURE} + r="unknown" fi echo "${r}" -- cgit v1.2.3