[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Version-value-in-source alternative proposal

From: Matt England <mengland_at_mengland.net>
Date: 2006-01-27 03:22:43 CET

2 things on this topic:

At 1/25/2006 09:14 PM, Matt England wrote:
>I offer an additional alternative to the current 'svnversion -n'
>implementation of
><http://subversion.tigris.org/faq.html#version-value-in-source> that
>requires feature enhancements to the Subversion system:
>Define a $GlobalRevision$ keyword and a repo property (call it
>'svn-global-revision-files') that allows a repo admin to list all files
>with $GlobalRevision$ contained in them. Every client checkout/update
>will force a svn client to check for all files listed in
>'svn-global-revision-files' for $GlobalRevision$ and update said keyword
>appropriately.

Where can I go to pitch this to developers (if I'm not already)? Should I
post to a development list? A bug database? A feature-enhancement/task
tracker?

Also: Here's an excerpt from a *working* Makefile (my previous excerpt was
from a failing Makefile) using what I find to be a more-flexible
implementation of a build process controlling the svnversion value in the
source code (the "PROGRAM_template" canned-command-sequence calls other
functions/canned-command sequences like "program_naming" which are not
shown, let me know if you want more details):

##
## Automatically generate code value for
## the subversion repository version number.
##

SVN_VER_SRC := $(TGT_OBJ_DIR)/svn_version.cpp
SVN_VER_OBJ := $(SVN_VER_SRC:%.cpp=%.o)

SVN_WC_REV := $(shell svnversion -n $(CURRNT_DIR))
SVN_WC_REV_FROM_SRC := $(shell test -f $(SVN_VER_SRC) && sed
's,^.*SVN_Version = "\(.*\)".*$$,\1,' < $(SVN_VER_SRC))

ifneq '$(SVN_WC_REV_FROM_SRC)' '$(SVN_WC_REV)'
$(shell rm -f $(SVN_VER_SRC))
# Debugging stuff
#$(shell echo 'rm -f $(SVN_VER_SRC)' 1>&2)
#$(shell echo SVN_WC_REV = \'$(SVN_WC_REV)\' 1>&2)
#$(shell echo SVN_WC_REV_FROM_SRC = \'$(SVN_WC_REV_FROM_SRC)\' 1>&2)
endif

$(SVN_VER_SRC):
         @echo -n 'const char* svn_version(void) { const char* SVN_Version
= "' \
> $(SVN_VER_SRC)
         @echo -n $(SVN_WC_REV) >> $(SVN_VER_SRC)
         @echo '"; return SVN_Version; }' >> $(SVN_VER_SRC)

$(SVN_VER_OBJ): $(SVN_VER_SRC)

ALL_OBJS += $(SVN_VER_OBJ)

##
## Create the canned-command sequences (aka "templates)
## that automatically create the rules for programs
## and libraries.
##

define PROGRAM_template
$(call create_app_cpp_vars,$(1))
$(call create_obj_and_dfile_deps,$(1))
$(call program_naming,$(1)): $$($(1)_LIBS:%=-l%) $$($(1)_OBJS) $(SVN_VER_OBJ)
$(call add_to_all_vars,$(1))
endef

-Matt

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Jan 27 03:24:27 2006

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.