Re: [viewvc-users] vhosts or root-path config overrides for [cvsdb] config section

"C. Michael Pilato" <[email protected]>
Newsgroups gmane.comp.version-control.cvs.viewcvs.user
Organization CollabNet, Inc.
Message-ID <4B2175E3.9010300__1732.77772632918$1260484095$gmane$org@collab.net>
C. Michael Pilato wrote:
> Tom Throckmorton wrote:
>> On Nov 03 17:51, Asd Asdasd wrote:
>>> Can you please indicate if there is anything wrong with the above config
>>> scenario? Are per vhost or per root-path config overrides even supported for
>>> the cvsdb config section. Is there a bug?
>> Interestingly, a per-root config (e.g. [root-ROOTNAME/cvsdb]) does seem to work
>> within viewvc itself, but svndbadmin operations fail.  So, it's a problem with
>> that script only, afaict...
> 
> That seems pretty likely, yes.  There are some extra configuration-related
> steps that have to be taken for per-root configury to work, and I'm pretty
> sure I did *not* add those steps to 'cvsdbadmin' and 'svndbadmin'.
> 
> Anybody interested in whipping up a patch for those tools that helps them
>   a) determine the rootname based on the root path, and then
>   b) call cfg.overlay_root_options(rootname)
> ?
> 
> Operators on our dev@ list are standing by for your call.  :-)

So, I recently revamped the per-root and per-vhost configuration override
stuffs.  And one of the decisions I made was to disallow per-root overrides
of the [cvsdb] section.  Why?  Because the query.cgi script allows for
queries that span roots.

Now, I'm not so much a fan of query.cgi, and find that it often gets in the
way of ViewVC's forward progress.  So I'm considering allowing per-root
overrides of [cvsdb] in ViewVC and the command-line tools, and just having
query.cgi ignore them if they are found in the configuration.  I don't have
a sense of how many folks are still using query.cgi now that ViewVC has an
integrated query interface.

What do you guys think?

(Attaching a patch that makes this work for 'svndbadmin' lest I lose it.)

-- 
C. Michael Pilato <[email protected]>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4255&dsMessageId=2429610

To unsubscribe from this discussion, e-mail: [[email protected]].
svndbadmin-per-root-overrides-patch.txt (text/plain, 1.8 KB)
Index: lib/config.py
===================================================================
--- lib/config.py	(revision 2305)
+++ lib/config.py	(working copy)
@@ -123,6 +123,7 @@
                'utilities',
                ),
     'root'  : ('authz-*',
+               'cvsdb',
                'options',
                'templates',
                'utilities',
Index: bin/svndbadmin
===================================================================
--- bin/svndbadmin	(revision 2305)
+++ bin/svndbadmin	(working copy)
@@ -238,8 +238,7 @@
         else:
             print "skipped (already recorded)."
 
-def main(command, repository, revs=[], verbose=0, force=0):
-    cfg = viewvc.load_config(CONF_PATHNAME)
+def main(cfg, command, repository, revs=[], verbose=0, force=0):
     db = cvsdb.ConnectDatabase(cfg)
 
     if command in ('rebuild', 'purge'):
@@ -334,7 +333,18 @@
     if not os.path.exists(repository):
         sys.stderr.write('ERROR: could not find repository %s\n' % args[2])
         usage()
+
+    # Load the configuration, and see if the provided repository path
+    # matches one of the configured roots.  If so, overlay any
+    # root-specific configuration overrides.
+    cfg = viewvc.load_config(CONF_PATHNAME)
     repository = vclib.svn.canonicalize_rootpath(repository)
+    viewvc.expand_root_parents(cfg)
+    for key, value in cfg.general.svn_roots.items():
+        value = vclib.svn.canonicalize_rootpath(value)
+        if value == repository:
+            cfg.overlay_root_options(key)
+            break
 
     revs = []
     if len(sys.argv) > 3:
@@ -359,7 +369,7 @@
 
     try:
         repository = cvsdb.CleanRepository(os.path.abspath(repository))
-        main(command, repository, revs, verbose, force)
+        main(cfg, command, repository, revs, verbose, force)
     except KeyboardInterrupt:
         print
         print '** break **'
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkshdeMACgkQokEGqRcG/W79EwCgjWZYfFFpFRqlWEIxWBQZrVR8
G3EAoIDY344UQ4RA/J7ElSmR/5DzaoCn
=aFFe
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.