j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
The banner is displayed at the start of openbios with the version and build time. This patch adds the revision number for easier identification of binary version. It would look like this:
Welcome to OpenBIOS v1.1 (Revision 1358) built on Nov 28 2015 18:22
If the user doesn't have the svn command or an svn repo, the word "unknown" is used instead of the number.
Signed-off-by: John Arbuckle programmingkidx@gmail.com
New in revision 2: Added support for git if the repo is being managed by it.
Index: Makefile.target =================================================================== --- Makefile.target (revision 1358) +++ Makefile.target (working copy) @@ -52,11 +52,21 @@
versions: $(ODIR)/target/include/openbios-version.h $(ODIR)/forth/version.fs
+# Set the REVISION variable to the current svn revision or to "unknown" +REVISION := $(shell svn info .. | grep "Revision: " | cut -c11-16) +ifeq ($(REVISION),) # Try using git to find the revision number + REVISION := $(shell git svn log --oneline -1 | cut -d '|' -f1 | cut -c2-5) +endif +ifeq ($(REVISION),) # if both svn and git failed to find a revision number + REVISION = "unknown" +endif + $(ODIR)/forth/version.fs: $(call quiet-command,true, " GEN $(TARGET_DIR)$@") @DATE="$(shell echo `LC_ALL=C TZ=UTC date +'%b %e %Y %H:%M'`)" ; \ ( echo ": builddate " $$DATE" ; " ; \ - echo ": version " $(VERSION)" ; " ; ) \ + echo ": version " $(VERSION)" ; " ; \ + echo ": revision " $(REVISION)" ; " ; ) \ > $(dir $@)/version.fs
$(ODIR)/target/include/openbios-version.h: @@ -63,7 +73,8 @@ $(call quiet-command,true, " GEN $(TARGET_DIR)$@") @DATE="$(shell echo `LC_ALL=C TZ=UTC date +'%b %e %Y %H:%M'`)" ; \ ( echo "#define OPENBIOS_BUILD_DATE "$$DATE"" ; \ - echo "#define OPENBIOS_VERSION_STR "$(VERSION)"" ; ) \ + echo "#define OPENBIOS_VERSION_STR "$(VERSION)"" ; \ + echo "#define OPENBIOS_REVISION "$(REVISION)"" ; ) \ > $(dir $@)/openbios-version.h
info: Index: forth/admin/banner.fs =================================================================== --- forth/admin/banner.fs (revision 1358) +++ forth/admin/banner.fs (working copy) @@ -9,8 +9,8 @@ ; to builtin-logo
:noname - builddate s" built on " version s" Welcome to OpenBIOS v" pocket - tmpstrcat tmpstrcat tmpstrcat drop + builddate s" ) built on " revision s" (Revision " version s" Welcome to OpenBIOS v" pocket + tmpstrcat tmpstrcat tmpstrcat tmpstrcat tmpstrcat drop ; to builtin-banner
: suppress-banner ( -- )
On Tue, 1 Dec 2015, Programmingkid wrote:
+# Set the REVISION variable to the current svn revision or to "unknown" +REVISION := $(shell svn info .. | grep "Revision: " | cut -c11-16) +ifeq ($(REVISION),) # Try using git to find the revision number
- REVISION := $(shell git svn log --oneline -1 | cut -d '|' -f1 | cut -c2-5)
The revision number can be arbitrarily long so cutting from chars 2-5 may not always work. Maybe stripping unwanted leading and trailing chars via shell ${REVISION#r} and ${REVISION%% *} parameter expansion would work better or using sed to get numeric characters only could be more portable.
Regards, BALATON Zoltan
On Dec 2, 2015, at 6:48 AM, BALATON Zoltan wrote:
On Tue, 1 Dec 2015, Programmingkid wrote:
+# Set the REVISION variable to the current svn revision or to "unknown" +REVISION := $(shell svn info .. | grep "Revision: " | cut -c11-16) +ifeq ($(REVISION),) # Try using git to find the revision number
- REVISION := $(shell git svn log --oneline -1 | cut -d '|' -f1 | cut -c2-5)
The revision number can be arbitrarily long so cutting from chars 2-5 may not always work. Maybe stripping unwanted leading and trailing chars via shell ${REVISION#r} and ${REVISION%% *} parameter expansion would work better or using sed to get numeric characters only could be more portable.
Your right. I have made a new patch that works the way you suggested. Thank you.