Friday April 10, 2009
Using CVS with OpenGrok
If you look at the mail archives for OpenGrok it seems that the most popular question out there right now is how to configure OpenGrok with CVS. Personally I have extremely limited experience with cvs, but I guess there is some old projects out there that haven't converted to a distributed scm system yet (check out http://www.selenic.com/mercurial/wiki/index.cgi/RepositoryConversion ;-)). In this blog I'll show you how to configure a project using cvs in OpenGrok.
I don't use cvs, so the first thing we need to do is to install cvs and create a cvs repository for our source. An empty cvs repository doesn't help us, so lets import the OpenGrok sources and use them in the example:
trond@opensolaris> pfexec pkg install SUNWcvs trond@opensolaris> pfexec zfs create -o mountpoint=/cvsroot rpool/cvsroot trond@opensolaris> pfexec chown trond:staff /cvsroot trond@opensolaris> cd /cvsroot trond@opensolaris> export CVSROOT=`pwd` trond@opensolaris> cvs init trond@opensolaris> cd /tmp trond@opensolaris> hg clone ssh://anon@hg.opensolaris.org/hg/opengrok/trunk opengrok trond@opensolaris> cd opengrok trond@opensolaris> rm -rf .hg trond@opensolaris> cvs import -m "Initial import of OpenGrok" opengrok opengrok-trunk start trond@opensolaris> rm -rf opengrok
I got my OpenGrok installation in /var/opengrok with the sources in /var/opengrok/source, so let's check out the sources:
trond@opensolaris> cd /var/opengrok/source trond@opensolaris> cvs co opengrok
The next thing we need to do is to update the configuration with the knowledge of the new project (and it's repository):
trond@opensolaris> cd /var/opengrok
trond@opensolaris> java -jar /var/opengrok/bin/opengrok.jar -c /var/opengrok/bin/ctags \
-v -s /var/opengrok/source -d /var/opengrok/data -S -P \
-p /opengrok -n -W /etc/opengrok/configuration.xml
(run look at the man page for a description of the different options).
With the new configuration in place, we can start the index generation:
trond@opensolaris> cd /var/opengrok trond@opensolaris> java -Xmx2g -jar /var/opengrok/bin/opengrok.jar -R /etc/opengrok/configuration.xml
So let's install tomcat and try it out:
trond@opensolaris> pfexec pkg install SUNWtcat trond@opensolaris> pfexec cp /var/opengrok/source.war /var/tomcat6/webapps trond@opensolaris> svcadm enable tomcat6
If you navigate to http://localhost:8080/source/history/opengrok/LICENSE.txt you should get the history for the LICENSE file and the annotate link should be available. You should be able to navigate around and look at the change history for the files in your repository. Please note that cvs operates on a pr file basis, so you cannot request history for a directory.
Posted at 02:44PM Apr 10, 2009 by trond in OpenGrok | Comments[3]
| « January 2010 | ||||||
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | ||||||
| Today | ||||||
Thanks, pretty useful.
What did you put in configuration.xml ?
Posted by Mads on April 10, 2009 at 05:22 PM CEST #
configuration.xml is generated by the command above. It contains the paths to the source and data directories, and information about the SCM repositories the source is located in.
Posted by Trond Norbye on April 10, 2009 at 08:41 PM CEST #
Two more likely steps:
1) If you used anything other than /etc/opengrok/configuration.xml for the configuration file, you will have to tell OpenGrok where it is. One way is to find and edit the web.xml for OpenGrok.
2) If you put the configuration file outside of the webapp, as shown in the example, you will probably need to increase the permissions given to OpenGrok, to allow it to read the configuration file. If this is the problem, you will get a nice stack trace in the log, but when viewed with a browser, it will look like the application isn't even there.
Posted by Curt Cox on April 21, 2009 at 11:08 PM CEST #