[flashrom] [commit] r1862 - in trunk: . util

repository service svn at flashrom.org
Sat Jan 10 10:32:08 CET 2015


Author: stefanct
Date: Sat Jan 10 10:32:07 2015
New Revision: 1862
URL: http://flashrom.org/trac/flashrom/changeset/1862

Log:
Refine revision handling.

Up to now, when compiling flashrom outside a VCS it would print two
warnings that are not very clear to the user. This patch adds a new
auxilary function to getrevision.sh and uses it in the makefile to print a
single and more meaningful message to the user while hiding the
warnings from getrevision.sh.

Signed-off-by: Stefan Tauner <stefan.tauner at alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner at alumni.tuwien.ac.at>

Modified:
   trunk/Makefile
   trunk/util/getrevision.sh

Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile	Tue Jan  6 00:00:14 2015	(r1861)
+++ trunk/Makefile	Sat Jan 10 10:32:07 2015	(r1862)
@@ -373,7 +373,7 @@
 # Set the flashrom version string from the highest revision number of the checked out flashrom files.
 # Note to packagers: Any tree exported with "make export" or "make tarball"
 # will not require subversion. The downloadable snapshots are already exported.
-SVNVERSION := $(shell ./util/getrevision.sh -u)
+SVNVERSION := $(shell ./util/getrevision.sh -u 2>/dev/null )
 
 RELEASE := 0.9.7
 VERSION := $(RELEASE)-$(SVNVERSION)
@@ -381,6 +381,11 @@
 
 SVNDEF := -D'FLASHROM_VERSION="$(VERSION)"'
 
+# Inform user if there is no meaningful version string. If there is version information from a VCS print
+# something anyway because $(info...) will print a line break in any case which would look suspicious.
+$(info $(shell ./util/getrevision.sh -c 2>/dev/null || echo "Files don't seem to be under version control." ; \
+	echo "Replacing all version templates with $(VERSION)." ))
+
 ###############################################################################
 # Default settings of CONFIG_* variables.
 
@@ -992,7 +997,7 @@
 	@rm -f .featuretest.c .featuretest$(EXEC_SUFFIX)
 
 $(PROGRAM).8: $(PROGRAM).8.tmpl
-	@sed -e '1 s#".*".*#"$(shell ./util/getrevision.sh -d $(PROGRAM).8.tmpl)" "$(VERSION)"#' <$< >$@
+	@sed -e '1 s#".*".*#"$(shell ./util/getrevision.sh -d $(PROGRAM).8.tmpl 2>/dev/null)" "$(VERSION)"#' <$< >$@
 
 install: $(PROGRAM)$(EXEC_SUFFIX) $(PROGRAM).8
 	mkdir -p $(DESTDIR)$(PREFIX)/sbin

Modified: trunk/util/getrevision.sh
==============================================================================
--- trunk/util/getrevision.sh	Tue Jan  6 00:00:14 2015	(r1861)
+++ trunk/util/getrevision.sh	Sat Jan 10 10:32:07 2015	(r1862)
@@ -215,6 +215,10 @@
 	echo "${r}"
 }
 
+is_tracked() {
+	is_file_tracked "$1"
+}
+
 show_help() {
 	echo "Usage:
 	${0} <command> [path]
@@ -222,6 +226,8 @@
 Commands
     -h or --help
         this message
+    -c or --check
+        test if path is under version control at all
     -l or --local
         local revision information including an indicator for uncommitted changes
     -u or --upstream
@@ -274,6 +280,10 @@
 			check_action $1
 			action="timestamp +%Y-%m-%dT%H:%M:%SZ" # There is only one valid time format! ISO 8601
 			shift;;
+		-c|--check)
+			check_action=$1
+			action="is_tracked"
+			shift;;
 		-*)
 			show_help;
 			echo "Error: Invalid option: ${1}"




More information about the flashrom mailing list