Old output: flashrom v0.9.7-r1716 on Linux 3.8.0-6-generic (x86_64)
New output with svn with local changes: flashrom v0.9.7-r1716-dirty on Linux 3.8.0-6-generic (x86_64) modified 2013-08-21T14:56:25+0200, available from svn://flashrom.org/flashrom/trunk
New output with git with local changes when URL is unavailable: flashrom v0.9.7-r1716-50e143e-2-dirty on Linux 3.8.0-6-generic (x86_64) modified 2013-08-21T14:34:40+0200
New output with git with local changes when URL is available: flashrom v0.9.7-r1716-f6845c7-2 on Linux 3.8.0-6-generic (x86_64) modified 2013-08-21T14:34:56+0200, available from git@github.com:stefanct/flashrom.git git
Signed-Off-By: David Hendricks dhendrix@google.com Signed-off-by: Stefan Tauner stefan.tauner@student.tuwien.ac.at --- Makefile | 21 ++++++++++++++------- flashrom.c | 7 +++++++ 2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile index 540e5da..9ce60d2 100644 --- a/Makefile +++ b/Makefile @@ -325,13 +325,17 @@ CLI_OBJS = cli_classic.o cli_output.o print.o # 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) +UPSTREAMREV := $(shell ./util/getrevision.sh --upstream) +LOCALREV := $(shell ./util/getrevision.sh --local) +TIMESTAMP := $(shell ./util/getrevision.sh --timestamp) +SCMURL := $(shell ./util/getrevision.sh --url)
RELEASE := 0.9.7 -VERSION := $(RELEASE)-$(SVNVERSION) +VERSION := $(RELEASE)-$(UPSTREAMREV) RELEASENAME ?= $(VERSION)
-SVNDEF := -D'FLASHROM_VERSION="$(VERSION)"' +SCMDEF := -D'FLASHROM_VERSION="$(VERSION)"' -D'FLASHROM_SCMURL="$(SCMURL)"' \ + -D'FLASHROM_LOCALREV="$(LOCALREV)"' -D'FLASHROM_TIMESTAMP="$(TIMESTAMP)"'
# Always enable internal/onboard support for now. CONFIG_INTERNAL ?= yes @@ -652,7 +656,7 @@ libflashrom.a: $(LIBFLASHROM_OBJS) TAROPTIONS = $(shell LC_ALL=C tar --version|grep -q GNU && echo "--owner=root --group=root")
%.o: %.c .features - $(CC) -MMD $(CFLAGS) $(CPPFLAGS) $(FLASHROM_CFLAGS) $(FEATURE_CFLAGS) $(SVNDEF) -o $@ -c $< + $(CC) -MMD $(CFLAGS) $(CPPFLAGS) $(FLASHROM_CFLAGS) $(FEATURE_CFLAGS) $(SCMDEF) -o $@ -c $<
# Make sure to add all names of generated binaries here. # This includes all frontends and libflashrom. @@ -860,9 +864,12 @@ install: $(PROGRAM)$(EXEC_SUFFIX)
export: @rm -rf $(EXPORTDIR)/flashrom-$(RELEASENAME) - @svn export -r BASE . $(EXPORTDIR)/flashrom-$(RELEASENAME) - @sed "s/^SVNVERSION.*/SVNVERSION := $(SVNVERSION)/" Makefile >$(EXPORTDIR)/flashrom-$(RELEASENAME)/Makefile - @LC_ALL=C svn log >$(EXPORTDIR)/flashrom-$(RELEASENAME)/ChangeLog + @svn export -r BASE . $(EXPORTDIR)/flashrom-$(RELEASENAME) 2>/dev/null || git checkout-index -a -f --prefix=$(EXPORTDIR)/flashrom-$(RELEASENAME)/ + @# If SCMVERSION or SCMEXTVERSION contain a slash or SCMURL contains a hash, this will explode + @sed "s/^SCMVERSION.*/SCMVERSION := $(SCMVERSION)/;s/^SCMEXTVERSION.*/SCMEXTVERSION := $(SCMEXTVERSION)/;s#^SCMURL.*#SCMURL := $(SCMURL)#" Makefile >$(EXPORTDIR)/flashrom-$(RELEASENAME)/Makefile + @# ChangeLog should be in English, but we want UTF-8 for names. + @( LC_ALL=en_US.UTF-8 svn log 2>/dev/null || LC_ALL=en_US.UTF-8 git log 2>/dev/null || echo "Unable to extract log from SCM" ) >$(EXPORTDIR)/flashrom-$(RELEASENAME)/ChangeLog + @rm -f $(EXPORTDIR)/flashrom-$(RELEASENAME)/.gitignore $(EXPORTDIR)/flashrom-$(RELEASENAME)/.gitattributes $(EXPORTDIR)/flashrom-$(RELEASENAME)/.gitmodules @echo Exported $(EXPORTDIR)/flashrom-$(RELEASENAME)/
tarball: export diff --git a/flashrom.c b/flashrom.c index 86e64a2..6944140 100644 --- a/flashrom.c +++ b/flashrom.c @@ -1666,7 +1666,14 @@ void print_buildinfo(void) void print_version(void) { msg_ginfo("flashrom v%s", flashrom_version); + if (strlen(FLASHROM_LOCALREV) > 0) + msg_ginfo("-%s", FLASHROM_LOCALREV); + print_sysinfo(); + msg_ginfo("\nmodified %s", FLASHROM_TIMESTAMP); + if (strlen(FLASHROM_SCMURL) > 0) + msg_ginfo(", available from %s", FLASHROM_SCMURL); + msg_ginfo("\n"); }