[OpenBIOS] [PATCH] Add revision number to banner

Programmingkid programmingkidx at gmail.com
Tue Dec 1 22:23:00 CET 2015


On Dec 1, 2015, at 4:09 PM, Mark Cave-Ayland wrote:

> On 28/11/15 20:26, Programmingkid wrote:
> 
>> 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 at gmail.com>
>> 
>> Index: Makefile.target
>> ===================================================================
>> --- Makefile.target	(revision 1358)
>> +++ Makefile.target	(working copy)
>> @@ -52,11 +52,18 @@
>> 
>> 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),)
>> +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 +70,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 ( -- )
>> 
> 
> Unfortunately this wouldn't work for my particular setup because I use
> git rather than SVN for day-to-day development :(  Part of me thinks
> that a patch based upon git would be better, however since the master
> repository is SVN then that doesn't quite seem right either.
> 
> I suspect that perhaps the best solution is to have more frequent
> releases although again this isn't as clear cut as it should be since a
> significant proportion of commits require associated updates in QEMU to
> work...

Conditionally deciding to use git or svn isn't a problem. How do you print the svn revision from git?


More information about the OpenBIOS mailing list