Greg Stein wrote:
>On Thu, Aug 09, 2001 at 11:42:16PM -0000, brane@tigris.org wrote:
>
>>...
>>        - Option values may be expanded within a value by enclosing the
>>          option name in parentheses, preceded by a percent sign:
>>  
>>            %(name)
>>  
>>          The expansion is performed recursively and on demand, during
>>          svn_option_get. The name is first searched for in the same section,
>>          then in the special [DEFAULTS] section. If the name is not found,
>>          the whole %(name) placeholder is left unchanged.
>>  
>>          Any modifications to the configuration data invalidate all
>>          previously expanded values, so that the next svn_option_get
>>          will take the modifications into account.
>>...
>>
>
>Is this feature truly needed? I've never seen/used it in all the time that
>I've used ConfigParser (which was even before it was part of the Python
>distro...).
>
I found this feature immensely useful for programs that look for 
components places relative to the installation directory. Many Unix 
packages today expect to be installed in a specific directory (/opt/foo, 
/usr/local, ...), and can't be relocated. That's often a pain. (Yes, 
--rpath is evil.)
>It is a rather complex feature, and I would think for marginal benefit. I'd
>recommend dropping it unless we have a firm requirement for it. Any
>examples?
>
Well, let's take the problem that popped up recently -- finding the RA 
libraries. With variable expansion, you could set up your /etc/svn.conf 
like this:
    [DEFAULTS]
    # Installation prefix, set up by "make install" or other scrip
    prefix: /opt/subversion
    # File name extension of shared libraries, guessed by configure
    # (this one is for HP-UX)
    .so: .sl
    # Paths to installed Repository Access libraries
    [ra_libs]
    ra_local: %(prefix)/lib/libsvn_ra_local%(.so)
    ra_dav:   %(prefix)/lib/libsvn_ra_dav%(.so)
    # Paths to uninstalled RA libraries, for testing
    [ra_libs.test]
    ra_local: %(exepath)/../../libsvn_ra_local/.libs/libsvn_ra_local%(.so)
    ra_dav:   %(exepath)/../../libsvn_ra_dav/.libs/libsvn_ra_dav%(so)
Then, in svn, you set up the variables:
    /* Absolute path to svn */
    svn_config_set (cfg, "DEFAULTS", "exepath", dirname(fullpath(argv[0])));
and have the RA loader look at [ra_libs.test] or [ra_libs] to find the 
correct paths.
Granted, this may not seem very useful for svn right now, but I think it 
will become so, e.g., once we support client-side hooks. I'm also sort 
of hoping that /all/ SVN clients will use the same configuration files, 
as far as humanly possible.
    Brane
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:35 2006